@@ -33,9 +33,7 @@ use tracing::{debug, error};
3333
3434use crate :: traces:: stats_generator:: StatsGenerator ;
3535use crate :: traces:: trace_aggregator:: { OwnedTracerHeaderTags , SendDataBuilderInfo } ;
36-
37- /// Sentinel value used by `collect_pb_trace_chunks` when `_sampling_priority_v1` is absent.
38- const CHUNK_PRIORITY_NOT_SET : i32 = i8:: MIN as i32 ;
36+ use libdd_trace_normalization:: normalizer:: SamplerPriority ;
3937
4038#[ derive( Clone ) ]
4139#[ allow( clippy:: module_name_repetitions) ]
@@ -378,15 +376,16 @@ impl TraceProcessor for ServerlessTraceProcessor {
378376
379377 // Remove sampled-out chunks so they won't be sent to Datadog.
380378 // Sampled-out chunks are preserved in payloads_for_stats above so their
381- // stats are still counted. CHUNK_PRIORITY_NOT_SET (-128) means no explicit priority
382- // was set and the trace is kept; valid drop priorities are -1 (USER_DROP) and 0
383- // (AUTO_DROP ).
379+ // stats are still counted. SamplerPriority::None (-128) means no explicit priority
380+ // was set and the trace is kept; drop priorities are SamplerPriority::AutoDrop (0)
381+ // and UserDrop (-1, not represented in SamplerPriority ).
384382 if config. compute_trace_stats_on_extension
385383 && let TracerPayloadCollection :: V07 ( ref mut tracer_payloads) = payload
386384 {
387385 for tp in tracer_payloads. iter_mut ( ) {
388- tp. chunks
389- . retain ( |chunk| chunk. priority > 0 || chunk. priority == CHUNK_PRIORITY_NOT_SET ) ;
386+ tp. chunks . retain ( |chunk| {
387+ chunk. priority > 0 || chunk. priority == SamplerPriority :: None as i32
388+ } ) ;
390389 }
391390 tracer_payloads. retain ( |tp| !tp. chunks . is_empty ( ) ) ;
392391 if tracer_payloads. is_empty ( ) {
0 commit comments