File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed
Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,7 @@ impl processing::Processor for LogsProcessor {
138138 ctx : Context < ' _ > ,
139139 ) -> Result < Output < Self :: Output > , Rejected < Error > > {
140140 validate:: container ( & logs) . reject ( & logs) ?;
141+ validate:: dsc ( & logs) ;
141142
142143 // Fast filters, which do not need expanded logs.
143144 filter:: feature_flag ( ctx) . reject ( & logs) ?;
Original file line number Diff line number Diff line change 11use crate :: processing:: Managed ;
22use crate :: processing:: logs:: { Error , Result , SerializedLogs } ;
3+ use crate :: statsd:: RelayCounters ;
34
45/// Validates that there is only a single log container processed at a time.
56///
@@ -18,3 +19,17 @@ pub fn container(logs: &Managed<SerializedLogs>) -> Result<()> {
1819
1920 Ok ( ( ) )
2021}
22+
23+ /// Validate that the envelope has no trace context header.
24+ ///
25+ /// For now, this only emits a metric so we can verify that logs envelopes do not
26+ /// contain a trace context.
27+ pub fn dsc ( logs : & Managed < SerializedLogs > ) {
28+ relay_statsd:: metric!(
29+ counter( RelayCounters :: EnvelopeWithLogs ) += 1 ,
30+ dsc = match logs. headers. dsc( ) {
31+ Some ( _) => "yes" ,
32+ None => "no" ,
33+ }
34+ )
35+ }
Original file line number Diff line number Diff line change @@ -936,6 +936,11 @@ pub enum RelayCounters {
936936 /// - `type`: `envelope` or `attachment_v2`
937937 #[ cfg( feature = "processing" ) ]
938938 AttachmentUpload ,
939+ /// Whether a logs envelope has a trace context header or not
940+ ///
941+ /// This metric is tagged with:
942+ /// - `dsc`: yes or no
943+ EnvelopeWithLogs ,
939944}
940945
941946impl CounterMetric for RelayCounters {
@@ -992,6 +997,7 @@ impl CounterMetric for RelayCounters {
992997 RelayCounters :: SamplingDecision => "sampling.decision" ,
993998 #[ cfg( feature = "processing" ) ]
994999 RelayCounters :: AttachmentUpload => "attachment.upload" ,
1000+ RelayCounters :: EnvelopeWithLogs => "logs.envelope" ,
9951001 }
9961002 }
9971003}
You can’t perform that action at this time.
0 commit comments