Skip to content

fix!: css obfuscation logic#2203

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 18 commits into
mainfrom
oscarld/fix-css-obfuscation-logic
Jul 10, 2026
Merged

fix!: css obfuscation logic#2203
gh-worker-dd-mergequeue-cf854d[bot] merged 18 commits into
mainfrom
oscarld/fix-css-obfuscation-logic

Conversation

@Eldolfin

@Eldolfin Eldolfin commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

  • fix the condition for CSS obfuscation (now needs the obfuscation_versions to be equal)
  • ensure each bucket is composed only of obfuscated or un-obfuscated stats
  • ensure each stats payload is composed only of obfuscated or un-obfuscated stats buckets

Motivation

  • CSS spec compliance

Additional Notes

  • removing the unused results.xml file is an unrelated change but making a PR for it would've been overkill.

How to test the change?

  • system tests

APMSP-2985

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Clippy Allow Annotation Report

Comparing clippy allow annotations between branches:

  • Base Branch: origin/main
  • PR Branch: origin/oscarld/fix-css-obfuscation-logic

Summary by Rule

Rule Base Branch PR Branch Change
unwrap_used 3 3 No change (0%)
Total 3 3 No change (0%)

Annotation Counts by File

File Base Branch PR Branch Change
datadog-sidecar/src/service/stats_flusher.rs 1 1 No change (0%)
libdd-data-pipeline/src/otlp/metrics.rs 1 1 No change (0%)
libdd-trace-stats/src/stats_exporter.rs 1 1 No change (0%)

Annotation Stats by Crate

Crate Base Branch PR Branch Change
clippy-annotation-reporter 5 5 No change (0%)
datadog-ffe-ffi 1 1 No change (0%)
datadog-ipc 22 22 No change (0%)
datadog-live-debugger 4 4 No change (0%)
datadog-live-debugger-ffi 10 10 No change (0%)
datadog-profiling-replayer 4 4 No change (0%)
datadog-sidecar 45 45 No change (0%)
libdd-common 13 13 No change (0%)
libdd-common-ffi 12 12 No change (0%)
libdd-data-pipeline 6 6 No change (0%)
libdd-ddsketch 2 2 No change (0%)
libdd-dogstatsd-client 1 1 No change (0%)
libdd-profiling 13 13 No change (0%)
libdd-remote-config 3 3 No change (0%)
libdd-telemetry 20 20 No change (0%)
libdd-tinybytes 4 4 No change (0%)
libdd-trace-normalization 2 2 No change (0%)
libdd-trace-obfuscation 3 3 No change (0%)
libdd-trace-stats 1 1 No change (0%)
libdd-trace-utils 11 11 No change (0%)
Total 182 182 No change (0%)

About This Report

This report tracks Clippy allow annotations for specific rules, showing how they've changed in this PR. Decreasing the number of these annotations generally improves code quality.

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 95.30%
Overall Coverage: 74.37% (+0.04%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: ef49c67 | Docs | Datadog PR Page | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.88 MB 7.88 MB 0% (0 B) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 85.88 MB 85.97 MB +.10% (+93.90 KB) 🔍
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 97.10 MB 97.21 MB +.10% (+109.02 KB) 🔍
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.61 MB 10.61 MB +.04% (+5.23 KB) 🔍
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 25.45 MB 25.43 MB --.07% (-19.00 KB) 💪
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 88.44 KB 88.44 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 184.55 MB 184.75 MB +.10% (+200.00 KB) 🔍
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 946.77 MB 956.10 MB +.98% (+9.33 MB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 8.32 MB 8.33 MB +.14% (+12.50 KB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 88.44 KB 88.44 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 24.62 MB 24.66 MB +.15% (+40.00 KB) 🔍
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 49.03 MB 49.11 MB +.15% (+80.28 KB) 🔍
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 22.05 MB 22.10 MB +.19% (+43.00 KB) 🔍
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 89.82 KB 89.82 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 188.76 MB 189.16 MB +.21% (+408.00 KB) 🔍
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 935.45 MB 944.11 MB +.92% (+8.66 MB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.43 MB 6.45 MB +.23% (+15.50 KB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 89.82 KB 89.82 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 26.43 MB 26.48 MB +.17% (+48.00 KB) 🔍
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 46.66 MB 46.73 MB +.16% (+79.13 KB) 🔍
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 76.58 MB 76.78 MB +.26% (+205.60 KB) 🔍
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.78 MB 8.79 MB +.17% (+16.00 KB) 🔍
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 92.10 MB 92.19 MB +.09% (+90.03 KB) 🔍
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.69 MB 10.70 MB +.06% (+7.38 KB) 🔍

@Eldolfin

Eldolfin commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@Eldolfin Eldolfin changed the title fix: css obfuscation logic fix!: css obfuscation logic Jul 7, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 85eaf0cd6f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread libdd-trace-stats/src/stats_exporter.rs
Comment thread libdd-trace-stats/src/span_concentrator/mod.rs Outdated
@Eldolfin Eldolfin marked this pull request as ready for review July 7, 2026 14:12
@Eldolfin Eldolfin requested review from a team as code owners July 7, 2026 14:12
@Eldolfin Eldolfin requested review from VianneyRuhlmann, Copilot and mabdinur and removed request for a team July 7, 2026 14:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates client-side trace-stats obfuscation to be CSS-spec compliant by tightening the agent-version gate and ensuring obfuscated and non-obfuscated stats are never mixed within the same bucket or payload (including during forced flush/shutdown).

Changes:

  • Require an exact obfuscation-version match (instead of a supported range) before enabling client-side obfuscation.
  • Track obfuscation state per stats bucket and prevent flushing mixed obfuscation states in a single payload; force-flush may emit up to two payloads to drain both states.
  • Adjust exporter/header behavior and update concentrator APIs/callers accordingly (including SHM and OTLP paths), plus remove an unused results.xml.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
libdd-trace-stats/src/stats_exporter.rs Flush/send logic updated to potentially emit two payloads on force flush; obfuscation header now driven by bucket state.
libdd-trace-stats/src/span_concentrator/mod.rs Adds per-bucket obfuscation state and changes flushing to avoid mixing obfuscation states.
libdd-trace-stats/src/span_concentrator/aggregation.rs Extends StatsBucket to record whether the bucket is obfuscated (when the feature is enabled).
libdd-trace-stats/src/span_concentrator/tests.rs Updates tests for updated concentrator flush return signature / OTLP flush API.
libdd-data-pipeline/src/trace_exporter/stats.rs Tightens obfuscation-activation predicate and updates worker construction for the new exporter API.
libdd-data-pipeline/src/otlp/metrics.rs Adapts to flush_with_otlp_exact API change (now returns buckets directly).
libdd-data-pipeline/results.xml Removes an unused file from the data-pipeline crate.
datadog-sidecar/src/service/stats_flusher.rs Updates sidecar exporter construction for the new exporter API (no client-side obfuscation header).
datadog-ipc/src/shm_stats.rs Updates SHM concentrator flush API to return the new (…, …, buckets_obfuscated) tuple.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libdd-trace-stats/src/stats_exporter.rs Outdated
Comment thread libdd-trace-stats/src/stats_exporter.rs Outdated
Comment on lines +176 to +181
// We flush twice with `force_flush` so that if we have a mix of obfuscated and unobfuscated
// buckets, both get flushed in separate payloads
let flush_count = if force_flush { 2 } else { 1 };
let mut sent_stats = false;
for _ in 0..flush_count {
let (payload, collapsed_spans, buckets_obfuscated) = self.flush(force_flush);
Comment thread libdd-data-pipeline/src/trace_exporter/stats.rs
@Eldolfin

Copy link
Copy Markdown
Contributor Author

/remove

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jul 10, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-10 11:59:03 UTC ℹ️ Start processing command /remove


2026-07-10 11:59:09 UTC ℹ️ Devflow: /remove

@Eldolfin Eldolfin force-pushed the oscarld/fix-css-obfuscation-logic branch from 7538b80 to 35d265b Compare July 10, 2026 12:12
@Eldolfin

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jul 10, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-10 13:28:07 UTC ℹ️ Start processing command /merge


2026-07-10 13:28:13 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 1h (p90).


2026-07-10 14:14:54 UTCMergeQueue: The checks failed on this merge request

Tests failed on this commit c9d1f44:

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.

@Eldolfin

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jul 10, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-10 14:19:11 UTC ℹ️ Start processing command /merge


2026-07-10 14:19:17 UTC ℹ️ MergeQueue: waiting for PR to be ready

This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
It will be added to the queue as soon as checks pass and/or get approvals. View in MergeQueue UI.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2026-07-10 15:40:12 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in main is approximately 1h (p90).


2026-07-10 16:26:14 UTC ℹ️ MergeQueue: This merge request was merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants