Skip to content

Activate _dd.p.ksr tests for all languages [java@brian.marks/add-ksr-tag][dotnet@brian.marks/add-ksr-tag][ruby@brian.marks/add-ksr-tag][nodejs@brian.marks/add-ksr-tag][cpp@brian.marks/fix-ksr-formatting][rust@brian.marks/add-ksr-tag][golang@brian.marks/fix-ksr-default]#6466

Draft
bm1549 wants to merge 9 commits intobrian.marks/multi-branch-overridefrom
brian.marks/activate-ksr-generation-test

Conversation

@bm1549
Copy link
Contributor

@bm1549 bm1549 commented Mar 11, 2026

Motivation

The test_sampling_knuth_sample_rate_trace_sampling_rule system test verifies that tracers set _dd.p.ksr in span meta when trace sampling rules are applied. This test was blocked by missing_feature overrides in all language manifests. Now that all tracers implement this feature, the test should be activated.

See RFC: "Transmit Knuth sampling rate to backend"

Changes

Manifest activation (commit 1)

Removes missing_feature overrides for test_sampling_knuth_sample_rate_trace_sampling_rule from 8 language manifests:

  • manifests/cpp.yml
  • manifests/golang.yml
  • manifests/java.yml
  • manifests/dotnet.yml
  • manifests/nodejs.yml
  • manifests/php.yml
  • manifests/ruby.yml
  • manifests/rust.yml

For Node.js and PHP, removed class-level missing_feature entries that were blocking all tests in the Test_Knuth_Sample_Rate class. Preserved individual extraction test version constraints for PHP.

New edge case tests (commit 2)

Added three new edge case tests for _dd.p.ksr:

  • test_sampling_knuth_sample_rate_not_set_for_default — Verifies ksr is NOT set when no sampling rules or agent rates are configured (default sampling only)
  • test_sampling_knuth_sample_rate_overwritten_by_local_sampling — Verifies that when a trace arrives with upstream ksr and the local tracer applies its own sampling rule, the local ksr overwrites the upstream value
  • Additional parametrize case (0.5) for test_sampling_knuth_sample_rate_trace_sampling_rule — Verifies no trailing zeros in ksr formatting for rate 0.5

Added missing_feature entries in PHP manifest for the new ksr generation tests (PHP does not support ksr generation).

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review

Related PRs across tracers:

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

🤖 Generated with Claude Code

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

CODEOWNERS have been resolved as:

manifests/cpp.yml                                                       @DataDog/dd-trace-cpp
manifests/dotnet.yml                                                    @DataDog/apm-dotnet @DataDog/asm-dotnet
manifests/golang.yml                                                    @DataDog/dd-trace-go-guild
manifests/java.yml                                                      @DataDog/asm-java @DataDog/apm-java
manifests/nodejs.yml                                                    @DataDog/dd-trace-js
manifests/php.yml                                                       @DataDog/apm-php @DataDog/asm-php
manifests/ruby.yml                                                      @DataDog/ruby-guild @DataDog/asm-ruby
manifests/rust.yml                                                      @DataDog/apm-rust
tests/parametric/test_sampling_span_tags.py                             @DataDog/system-tests-core @DataDog/apm-sdk-capabilities

@datadog-prod-us1-6
Copy link

datadog-prod-us1-6 bot commented Mar 11, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: b2e25c1 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@bm1549 bm1549 changed the title Activate _dd.p.ksr generation test for all languages Activate _dd.p.ksr generation test for all languages [java@brian.marks/add-ksr-tag][dotnet@brian.marks/add-ksr-tag][ruby@brian.marks/add-ksr-tag][nodejs@brian.marks/add-ksr-tag][cpp@brian.marks/fix-ksr-formatting][rust@brian.marks/add-ksr-tag] Mar 11, 2026
@bm1549 bm1549 changed the title Activate _dd.p.ksr generation test for all languages [java@brian.marks/add-ksr-tag][dotnet@brian.marks/add-ksr-tag][ruby@brian.marks/add-ksr-tag][nodejs@brian.marks/add-ksr-tag][cpp@brian.marks/fix-ksr-formatting][rust@brian.marks/add-ksr-tag] Activate _dd.p.ksr tests for all languages [java@brian.marks/add-ksr-tag][dotnet@brian.marks/add-ksr-tag][ruby@brian.marks/add-ksr-tag][nodejs@brian.marks/add-ksr-tag][cpp@brian.marks/fix-ksr-formatting][rust@brian.marks/add-ksr-tag][golang@brian.marks/fix-ksr-default] Mar 11, 2026
@bm1549 bm1549 force-pushed the brian.marks/activate-ksr-generation-test branch from edd74ed to e0c7ff5 Compare March 11, 2026 03:04
@bm1549 bm1549 changed the base branch from main to brian.marks/multi-branch-override March 11, 2026 03:04
bm1549 and others added 3 commits March 10, 2026 23:25
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add test for ksr NOT set during default sampling (no rules configured)
- Add test for ksr overwritten by local sampling rule when upstream ksr exists
- Add 0.5 sample rate parametrize case to verify no trailing zeros
- Add missing_feature entries in PHP manifest for ksr generation tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…re comments

PHP implements ksr but doesn't support branch overrides in system-tests CI.
Keep the original test activated (it passes against released PHP once merged),
and mark new edge case tests as missing_feature due to branch override limitation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bm1549 bm1549 force-pushed the brian.marks/activate-ksr-generation-test branch from e0c7ff5 to 87b1d29 Compare March 11, 2026 03:25
bm1549 and others added 6 commits March 10, 2026 23:53
- trace_sampling_rule: create 3 independent root spans instead of
  parent-child chain, since children share the same trace
- not_set_for_default: allow ksr to be "1" or absent, since tracers
  differ in whether the default agent rate triggers ksr
- overwritten_by_local_sampling: renamed to propagated_from_upstream,
  expect upstream ksr to be propagated unchanged (sampling decisions
  are made at the head of the trace)
- Updated php.yml manifest for the renamed test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Creating multiple independent root spans caused issues: with sampling
rates < 1.0, not all traces are guaranteed to be received, and some
tracers batch/merge trace chunks differently.

Simplified to a single span per test case since we only need to verify
the _dd.p.ksr value format, not multi-trace behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sub-1.0 sampling rates cause some tracers to drop the trace entirely
(Knuth formula decision), making the test non-deterministic. Only use
rate 1.0 for the generation test. Format verification for other rates
is already covered by the distributed tracing extraction tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Bump version thresholds to versions higher than current releases
since ksr hasn't been released yet. The "easy win activation script"
set these too low, causing prod parametric tests to fail.

- ruby: 2.27.0 → 2.29.0 (latest release: 2.28.0)
- dotnet: 3.36.0 → 3.39.0 (latest release: 3.38.0)
- cpp: 2.0.0 → 2.1.0 (latest release: 2.0.0)
- golang: 2.5.0 → 2.9.0 (latest release: ~2.7.0)
- java: 1.58.2 → 1.61.0 (latest release: 1.60.1)
- php: added missing_feature for trace_sampling_rule test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Node.js (>=5.89.0) and Rust (>=0.1.0) were missing version-gated
entries, causing prod parametric tests to fail for these languages
since they don't yet implement the ksr feature on released versions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Node.js 5.89.0, Ruby 2.29.0, and .NET 3.39.0 were released without
KSR support, so prod parametric tests were activating and failing.
Bumped to >=5.90.0, >=2.30.0, >=3.40.0 respectively.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant