-
Notifications
You must be signed in to change notification settings - Fork 21
feat(data-pipeline)!: CSS Trace Filters #1985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
72288a1
bd2defb
c0724c6
29eb4f0
58b5939
859f929
38a03ca
9bab9f1
5ed2a51
3056bd2
e75b9bb
3abd80a
9ffd1c8
c2596f1
b200c2f
4e0ff40
d22bab9
f8c4e39
e235455
e7a8695
4b26fba
580ca86
5afa42a
db48e84
c88ad06
7265368
c0cc28f
e197714
977d4a4
36c65f4
c0cce0d
4ea70a8
32f1085
2c0ea25
d50be09
128d7b2
dde028f
4633ef8
daae8db
ab63da6
2fd1d04
71705f3
00e7913
dc57d61
5a05414
6e5f6bf
676e0b9
428a819
1dec1b0
8996a2a
b74e92e
c26d7ed
4efe15f
cc7156b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ mod trace_serializer; | |
|
|
||
| // Re-export the builder | ||
| pub use builder::TraceExporterBuilder; | ||
| use libdd_trace_utils::{span::trace_utils::DroppedStats, trace_filter::TraceFilterer}; | ||
|
|
||
| use self::agent_response::AgentResponse; | ||
| use self::metrics::MetricsEmitter; | ||
|
|
@@ -30,7 +31,7 @@ use crate::{ | |
| health_metrics, | ||
| health_metrics::{HealthMetric, SendResult, TransportErrorType}, | ||
| }; | ||
| use arc_swap::ArcSwapOption; | ||
| use arc_swap::{ArcSwap, ArcSwapOption}; | ||
| use bytes::Bytes; | ||
| use http::header::HeaderMap; | ||
| use http::uri::PathAndQuery; | ||
|
|
@@ -213,6 +214,7 @@ pub struct TraceExporter<C: HttpClientCapability + SleepCapability + MaybeSend + | |
| agent_payload_response_version: Option<AgentResponsePayloadVersion>, | ||
| /// When set, traces are exported via OTLP HTTP/JSON instead of the Datadog agent. | ||
| otlp_config: Option<OtlpTraceConfig>, | ||
| trace_filterer: ArcSwap<TraceFilterer>, | ||
| } | ||
|
|
||
| impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> TraceExporter<C> { | ||
|
|
@@ -348,9 +350,9 @@ impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> Tra | |
| .map(|s| s.as_str()) | ||
| } | ||
|
|
||
| #[cfg(not(target_arch = "wasm32"))] | ||
| /// Reconcile in-process stats state with the latest agent info. | ||
| /// Async so the `Enabled` arm can await a stats-worker shutdown without `block_on`. | ||
| #[cfg(not(target_arch = "wasm32"))] | ||
| async fn check_agent_info(&self) { | ||
| let Some(agent_info) = agent_info::get_agent_info() else { | ||
| return; | ||
|
|
@@ -363,6 +365,14 @@ impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> Tra | |
| self.refresh_v1_active(&agent_info); | ||
| } | ||
|
|
||
| self.trace_filterer.store(Arc::new(TraceFilterer::new( | ||
| &agent_info.info.filter_tags.require, | ||
| &agent_info.info.filter_tags.reject, | ||
| &agent_info.info.filter_tags_regex.require, | ||
| &agent_info.info.filter_tags_regex.reject, | ||
| &agent_info.info.ignore_resources, | ||
| ))); | ||
|
|
||
| // load_full() avoids holding an ArcSwap Guard (!Send) across .await. | ||
| let status = self.client_side_stats.status.load_full(); | ||
| match &*status { | ||
|
|
@@ -567,7 +577,8 @@ impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> Tra | |
| mp_payload: Vec<u8>, | ||
| headers: HeaderMap, | ||
| chunks: usize, | ||
| #[cfg_attr(not(feature = "telemetry"), allow(unused_variables))] chunks_dropped_p0: usize, | ||
| #[cfg_attr(not(feature = "telemetry"), allow(unused_variables))] | ||
| dropped_stats: DroppedStats, | ||
| ) -> Result<AgentResponse, TraceExporterError> { | ||
| let strategy = RetryStrategy::default(); | ||
| let payload_len = mp_payload.len(); | ||
|
|
@@ -588,7 +599,7 @@ impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> Tra | |
| &result, | ||
| payload_len as u64, | ||
| chunks as u64, | ||
| chunks_dropped_p0 as u64, | ||
| dropped_stats, | ||
| )) { | ||
| error!(?e, "Error sending telemetry"); | ||
| } | ||
|
|
@@ -605,11 +616,12 @@ impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> Tra | |
|
|
||
| // Process stats computation and drop non-sampled (p0) chunks. | ||
| // This must run before the OTLP path so that unsampled spans are not exported. | ||
| let dropped_p0_stats = stats::process_traces_for_stats( | ||
| let dropped_stats = stats::process_traces_for_stats( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a comment for this PR just a remark for future improvement. We should be able to submit telemetry from within the stats module rather than having to pass it to the |
||
| &mut traces, | ||
| &mut header_tags, | ||
| &self.client_side_stats.status, | ||
| self.client_computed_top_level, | ||
| &self.trace_filterer.load(), | ||
| ); | ||
|
|
||
| for chunk in &mut traces { | ||
|
|
@@ -662,7 +674,7 @@ impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> Tra | |
| prepared.data, | ||
| prepared.headers, | ||
| prepared.chunk_count, | ||
| dropped_p0_stats.dropped_p0_traces, | ||
| dropped_stats, | ||
| ) | ||
| .await; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.