@@ -10,11 +10,11 @@ use sentry_arroyo::processing::strategies::{
1010} ;
1111use sentry_arroyo:: types:: { InnerMessage , Message , Partition } ;
1212use sentry_arroyo:: utils:: timing:: Deadline ;
13- use sentry_protos:: snuba:: v1:: TraceItem ;
13+ use sentry_protos:: snuba:: v1:: { TraceItem , TraceItemType } ;
1414
1515use sentry_options:: options;
1616
17- use crate :: types:: { AggregatedOutcomesBatch , BucketKey , ItemDedupKey } ;
17+ use crate :: types:: { item_type_name , AggregatedOutcomesBatch , BucketKey , ItemDedupKey } ;
1818
1919#[ derive( Debug , Default ) ]
2020struct TraceItemOutcome {
@@ -88,7 +88,8 @@ impl<TNext> OutcomesAggregator<TNext> {
8888 fn is_duplicate ( & mut self , trace_item : & TraceItem ) -> bool {
8989 let org_id = trace_item. organization_id ;
9090 let project_id = trace_item. project_id ;
91- let item_type = trace_item. item_type ;
91+ let item_type =
92+ TraceItemType :: try_from ( trace_item. item_type ) . unwrap_or ( TraceItemType :: Unspecified ) ;
9293
9394 if let Ok ( item_id) = <[ u8 ; 16 ] >:: try_from ( trace_item. item_id . as_slice ( ) ) {
9495 let dedup_key = ItemDedupKey {
@@ -129,7 +130,7 @@ impl<TNext> OutcomesAggregator<TNext> {
129130
130131 tracing:: info!( "flushed {} buckets after {} seconds" , num_buckets, seconds) ;
131132 for ( item_type, count) in duplicate_item_counts {
132- let item_type_str = item_type . to_string ( ) ;
133+ let item_type_str = item_type_name ( item_type ) ;
133134 counter ! ( "accepted_outcomes.duplicate_items" , count, "item_type" => item_type_str. as_str( ) ) ;
134135 }
135136 for ( category, m) in category_metrics {
@@ -923,7 +924,7 @@ mod tests {
923924 aggregator
924925 . batch
925926 . duplicate_item_count
926- . get( & TraceItemType :: Span . into ( ) ) ,
927+ . get( & TraceItemType :: Span ) ,
927928 Some ( & 1 )
928929 ) ;
929930 }
0 commit comments