Draft
Conversation
Contributor
|
|
|
✨ Fix all issues with BitsAI or with Cursor
|
This was referenced Mar 11, 2026
9 tasks
edd74ed to
e0c7ff5
Compare
e0c7ff5 to
87b1d29
Compare
mabdinur
reviewed
Mar 11, 2026
Contributor
mabdinur
left a comment
There was a problem hiding this comment.
We need to address the dotnet and cpp failures but aside from that the changes look good to me
| } | ||
| ], | ||
| ) | ||
| def test_sampling_knuth_sample_rate_propagated_from_upstream( |
Contributor
There was a problem hiding this comment.
nit: This case is roughly equivalent to test_sampling_extract_knuth_sample_rate_distributed_tracing_datadog. We can update the existing test to set DD_TRACE_SAMPLING_RULES and use a ksr value of _dd.p.ksr and we should get the same test coverage.
bm1549
added a commit
to DataDog/dd-trace-rs
that referenced
this pull request
Mar 19, 2026
# What does this PR do? Adds `_dd.p.ksr` (Knuth Sampling Rate) as a propagated tag set when agent-based or rule-based sampling decisions are made. The tag is stored in span `meta` (string type) with up to 6 significant digits and no trailing zeros. `format_sampling_rate` now returns `Option<String>` and guards against invalid inputs (negative, >1.0, NaN, infinity), returning `None` instead of producing garbage output. # Motivation To enable consistent sampling across tracers and backend retention filters, the backend needs to know the sampling rate applied by the tracer. Without transmitting the tracer's rate via `_dd.p.ksr`, backend resampling cannot correctly compute effective rates in multi-stage sampling scenarios. See RFC: "Transmit Knuth sampling rate to backend" # Additional Notes Key files changed: - `datadog-opentelemetry/src/core/constants.rs` — Added `SAMPLING_KNUTH_RATE_TAG_KEY` constant - `datadog-opentelemetry/src/sampling/datadog_sampler.rs` — Added `format_sampling_rate()` helper (returns `Option<String>`, defensive against invalid rates) and set ksr in agent/rule sampling paths - Updated 2 snapshot JSON files Related PRs across tracers: - Java: DataDog/dd-trace-java#10802 - .NET: DataDog/dd-trace-dotnet#8287 - Ruby: DataDog/dd-trace-rb#5436 - Node.js: DataDog/dd-trace-js#7741 - PHP: DataDog/dd-trace-php#3701 - C++: DataDog/dd-trace-cpp#288 - System tests: DataDog/system-tests#6466 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
bm1549
added a commit
to DataDog/dd-trace-go
that referenced
this pull request
Mar 19, 2026
### What does this PR do? Fixes `_dd.p.ksr` (Knuth Sampling Rate) to only be set on spans when the agent has provided sampling rates via `readRatesJSON()`. Previously, ksr was unconditionally set in `prioritySampler.apply()`, including when the rate was the initial client-side default (1.0) before any agent response arrived. Also refactors `prioritySampler` to consolidate lock acquisitions: extracts `getRateLocked()` so `apply()` acquires `ps.mu.RLock` only once to read both the rate and `agentRatesLoaded`. ### Motivation Cross-language consistency: Python, Java, PHP, and other tracers only set ksr when actual agent rates or sampling rules are applied, not for the default fallback. This aligns Go with that behavior. See RFC: "Transmit Knuth sampling rate to backend" ### Additional Notes - Added `agentRatesLoaded` bool field to `prioritySampler`, set to `true` in `readRatesJSON()` - `apply()` now gates ksr behind `agentRatesLoaded` check - Extracted `getRateLocked()` to avoid double lock acquisition in `apply()` - Rule-based sampling path (`applyTraceRuleSampling` in span.go) unchanged — correctly always sets ksr - Tests added: `ksr-not-set-without-agent-rates` and `ksr-set-after-agent-rates-received` Related PRs across tracers: - Java: DataDog/dd-trace-java#10802 - .NET: DataDog/dd-trace-dotnet#8287 - Ruby: DataDog/dd-trace-rb#5436 - Node.js: DataDog/dd-trace-js#7741 - PHP: DataDog/dd-trace-php#3701 - Rust: DataDog/dd-trace-rs#180 - C++: DataDog/dd-trace-cpp#288 - System tests: DataDog/system-tests#6466 ### Reviewer's Checklist - [x] Changed code has unit tests for its functionality at or near 100% coverage. - [x] [System-Tests](https://github.com/DataDog/system-tests/) covering this feature have been added and enabled with the va.b.c-dev version tag. - [ ] There is a benchmark for any new code, or changes to existing code. - [x] If this interacts with the agent in a new way, a system test has been added. - [x] New code is free of linting errors. You can check this by running `make lint` locally. - [x] New code doesn't break existing tests. You can check this by running `make test` locally. - [ ] Add an appropriate team label so this PR gets put in the right place for the release notes. - [ ] All generated files are up to date. You can check this by running `make generate` locally. - [ ] Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running `make fix-modules` locally. Unsure? Have a question? Request a review! 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Dario Castañé <dario.castane@datadoghq.com> Co-authored-by: Mikayla Toffler <46911781+mtoffl01@users.noreply.github.com>
5 tasks
b2e25c1 to
8822171
Compare
Previously, specifying a tracer branch override in the PR title (e.g. [java@my-branch]) only supported a single override at a time. This change allows multiple overrides like [java@branch1][dotnet@branch2] so that different libraries can each use their own dev branch. The get_target_branch action now outputs a JSON map of library to branch (target-branch-map), and the compute-workflow-parameters workflow extracts the correct branch for each library using Python before passing it to load-binary.sh. Logic is implemented in Python (shell: python) for clarity and robustness. All workflow references updated from target-branch to target-branch-map. Docs updated accordingly. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Add tests for the _dd.p.ksr (Knuth sample rate) tag: - test_sampling_knuth_sample_rate_trace_sampling_rule: verifies ksr is set to "1" when a sampling rule with rate 1.0 is configured - test_sampling_extract_knuth_sample_rate_distributed_tracing_datadog: verifies upstream ksr is extracted from Datadog headers and propagated unchanged, including when local sampling rules are also configured - test_sampling_extract_knuth_sample_rate_distributed_tracing_tracecontext: same for tracecontext (W3C) propagation style - test_sampling_knuth_sample_rate_not_set_for_default: verifies ksr is absent or "1" under default (no explicit rules) sampling Manifests updated with version gates for all languages (feature not yet released): Java >=1.61.0, Python v3.14.0.dev, Node.js >=5.90.0, Go >=2.9.0, Ruby >=2.30.0, C++ >=2.1.0, .NET >=3.40.0, Rust >=0.1.0. PHP manifest uses per-test entries since branch overrides are unsupported. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
8822171 to
612252e
Compare
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Activate
_dd.p.ksr(Knuth sample rate) system tests for all languages. These tests verify that tracers correctly set and propagate_dd.p.ksrin span meta when trace sampling rules are applied.See RFC: "Transmit Knuth sampling rate to backend"
Changes
Commit 1: Support multiple [lang@branch] overrides in PR title
Allow multiple tracer branch overrides like
[java@branch1][dotnet@branch2]in PR titles, so different libraries can each use their own dev branch when running system tests.get_target_branchaction now outputs a JSON map of library → branch (target-branch-map)compute-workflow-parametersworkflow extracts per-library branches using Pythontarget-branchtotarget-branch-mapshell: python) for clarity and robustnessCommit 2: Activate _dd.p.ksr generation tests for all languages
Added tests for the
_dd.p.ksrtag:test_sampling_knuth_sample_rate_trace_sampling_rule— verifies ksr is set to"1"when a sampling rule with rate 1.0 is configuredtest_sampling_extract_knuth_sample_rate_distributed_tracing_datadog— verifies upstream ksr is extracted from Datadog headers and propagated unchanged, including when local sampling rules are also configured (merged from the removedtest_sampling_knuth_sample_rate_propagated_from_upstreamper reviewer feedback)test_sampling_extract_knuth_sample_rate_distributed_tracing_tracecontext— same for tracecontext (W3C) propagation styletest_sampling_knuth_sample_rate_not_set_for_default— verifies ksr is absent or"1"under default (no explicit rules) samplingManifests updated with version gates for all languages (feature not yet released): Java >=1.61.0, Python v3.14.0.dev, Node.js >=5.90.0, Go >=2.9.0, Ruby >=2.30.0, C++ >=2.1.0, .NET >=3.40.0, Rust >=0.1.0. PHP manifest uses per-test entries since branch overrides are unsupported.
Workflow
Related PRs across tracers:
_dd.p.ksrformatting to use 6 significant digits without trailing zeros dd-trace-cpp#288Reviewer checklist
tests/ormanifests/is modified ? I have the approval from R&P teambuild-XXX-imagelabel is present🤖 Generated with Claude Code