Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c23938d
wip: integrate obfuscation to trace exporter
Eldolfin Mar 30, 2026
f2621f3
fix: cargo fmt
Eldolfin Mar 31, 2026
6659152
feat(data-pipeline): feature-gate stats obfuscation behind stats-obfu…
Eldolfin Mar 31, 2026
0602070
refactor(data-pipeline): use Arc<AtomicBool> for shared obfuscation s…
Eldolfin Mar 31, 2026
d41ad73
fix: cargo fmt
Eldolfin Apr 1, 2026
36cca8f
fix: update LICENSE-3rdparty.yml
Eldolfin Apr 1, 2026
1ffcde1
feat(data-pipeline): read obfuscation config from /info
Eldolfin Apr 3, 2026
02ab474
fix: obfuscation config optional in /info
Eldolfin Apr 8, 2026
0994585
fix: clippy
Eldolfin Apr 13, 2026
5a40e9a
Merge remote-tracking branch 'origin/main' into oscarld/integrate-obf…
Eldolfin Apr 13, 2026
4eb0aa3
fix(lint): remove all cancellation_token references
Eldolfin Apr 13, 2026
50c0469
fix: last clippy error
Eldolfin Apr 13, 2026
e7b04a6
WIP: moving stats obfuscation logic to SpanConcentrator (untested)
Eldolfin Apr 16, 2026
1567e34
fix: clippy
Eldolfin Apr 16, 2026
edd4a19
fix: tests
Eldolfin Apr 16, 2026
a7dc804
fix: clippy again...
Eldolfin Apr 16, 2026
1723dc2
fix: correct wasm32 client_side_stats construction to use StatsComput…
Eldolfin Apr 16, 2026
f758d03
fix: cargo fmt and clippy
Eldolfin Apr 16, 2026
0d3da7b
fix: remove temp default-feature
Eldolfin Apr 16, 2026
3808360
fix ci hopefully...
Eldolfin Apr 16, 2026
3e8388f
fix more ci and maybe the arcswap missuse ?
Eldolfin Apr 17, 2026
3feddef
fix: sql_obfuscation_mode = "" is the deprecated unspecified mode
Eldolfin Apr 17, 2026
fd1a97e
fix: random pascal case was wrong
Eldolfin Apr 20, 2026
1636c9f
feat: apply suggestions
Eldolfin Apr 29, 2026
74563dd
Merge remote-tracking branch 'origin/main' into oscarld/integrate-obf…
Eldolfin May 5, 2026
b2d3804
fix merge
Eldolfin May 5, 2026
957ced7
Merge remote-tracking branch 'origin/main' into oscarld/integrate-obf…
Eldolfin May 6, 2026
8d1b888
feat(css-obfuscation): add runtime feature flag
Eldolfin May 7, 2026
0a5a7f9
fix: clippy
Eldolfin May 7, 2026
3e62cea
Merge branch 'main' into oscarld/integrate-obfuscation-to-trace-exporter
Eldolfin May 11, 2026
0318585
feat: cleanup test
Eldolfin May 11, 2026
0cdd5fd
Merge remote-tracking branch 'origin/main' into oscarld/integrate-obf…
Eldolfin May 11, 2026
4a5e776
fix: cargo fmt
Eldolfin May 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions libdd-data-pipeline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ libdd-telemetry = { version = "4.0.0", path = "../libdd-telemetry", default-feat
libdd-trace-protobuf = { version = "3.0.1", path = "../libdd-trace-protobuf" }
libdd-trace-stats = { version = "2.0.0", path = "../libdd-trace-stats" }
libdd-trace-utils = { version = "3.0.1", path = "../libdd-trace-utils", default-features = false }
libdd-trace-obfuscation = { version = "2.0.0", path = "../libdd-trace-obfuscation" }
libdd-ddsketch = { version = "1.0.1", path = "../libdd-ddsketch" }
libdd-dogstatsd-client = { version = "2.0.0", path = "../libdd-dogstatsd-client", default-features = false }
libdd-tinybytes = { version = "1.1.0", path = "../libdd-tinybytes", features = [
Expand Down
2 changes: 2 additions & 0 deletions libdd-data-pipeline/src/agent_info/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pub struct AgentInfoStruct {
pub peer_tags: Option<Vec<String>>,
/// List of span kinds eligible for stats computation
pub span_kinds_stats_computed: Option<Vec<String>>,
/// Obfuscation version supported by the agent for client-side stats
pub obfuscation_version: Option<u32>,
/// Container tags hash from HTTP response header
pub container_tags_hash: Option<String>,
}
Expand Down
45 changes: 45 additions & 0 deletions libdd-data-pipeline/src/stats_exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub struct StatsExporter {
sequence_id: AtomicU64,
cancellation_token: CancellationToken,
client: HttpClient,
obfuscation_active: bool,
}

impl StatsExporter {
Expand All @@ -49,6 +50,7 @@ impl StatsExporter {
endpoint: Endpoint,
cancellation_token: CancellationToken,
client: HttpClient,
obfuscation_active: bool,
) -> Self {
Self {
flush_interval,
Expand All @@ -58,6 +60,7 @@ impl StatsExporter {
sequence_id: AtomicU64::new(0),
cancellation_token,
client,
obfuscation_active,
}
}

Expand Down Expand Up @@ -90,6 +93,13 @@ impl StatsExporter {
libdd_common::header::APPLICATION_MSGPACK,
);

if self.obfuscation_active {
headers.insert(
http::HeaderName::from_static("datadog-obfuscation-version"),
http::HeaderValue::from_static("1"),
);
}

let result = send_with_retry(
&self.client,
&self.endpoint,
Expand Down Expand Up @@ -274,6 +284,7 @@ mod tests {
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
CancellationToken::new(),
new_default_client(),
false,
);

let send_status = stats_exporter.send(true).await;
Expand Down Expand Up @@ -302,6 +313,7 @@ mod tests {
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
CancellationToken::new(),
new_default_client(),
false,
);

let send_status = stats_exporter.send(true).await;
Expand Down Expand Up @@ -336,6 +348,7 @@ mod tests {
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
CancellationToken::new(),
new_default_client(),
false,
);

tokio::time::pause();
Expand Down Expand Up @@ -378,6 +391,7 @@ mod tests {
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
cancellation_token.clone(),
new_default_client(),
false,
);

tokio::spawn(async move {
Expand Down Expand Up @@ -415,4 +429,35 @@ mod tests {
"Non-empty env should be preserved"
);
}
#[cfg_attr(miri, ignore)]
#[tokio::test]
async fn test_send_stats_with_obfuscation_header() {
let server = MockServer::start_async().await;

let mock = server
.mock_async(|when, then| {
when.method(POST)
.header("Content-type", "application/msgpack")
.header("datadog-obfuscation-version", "1")
.path("/v0.6/stats")
.body_includes("libdatadog-test");
then.status(200).body("");
})
.await;

let stats_exporter = StatsExporter::new(
BUCKETS_DURATION,
Arc::new(Mutex::new(get_test_concentrator())),
get_test_metadata(),
Endpoint::from_url(stats_url_from_agent_url(&server.url("/")).unwrap()),
CancellationToken::new(),
new_default_client(),
true,
);

let send_status = stats_exporter.send(true).await;
send_status.unwrap();

mock.assert_async().await;
}
}
6 changes: 5 additions & 1 deletion libdd-data-pipeline/src/trace_exporter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,9 @@ impl TraceExporter {
);
}
StatsComputationStatus::Enabled {
stats_concentrator, ..
stats_concentrator,
cancellation_token,
obfuscation_active,
} => {
let ctx = stats::StatsContext {
metadata: &self.metadata,
Expand All @@ -441,6 +443,8 @@ impl TraceExporter {
&ctx,
&agent_info,
stats_concentrator,
cancellation_token,
*obfuscation_active,
&self.client_side_stats,
&self.workers,
);
Expand Down
Loading
Loading