Skip to content

chore(sampling): track knuth sampling in distributed trace#3954

Merged
dd-mergequeue[bot] merged 5 commits into
mainfrom
rachel.yang/knuth-sample-tag
Sep 11, 2025
Merged

chore(sampling): track knuth sampling in distributed trace#3954
dd-mergequeue[bot] merged 5 commits into
mainfrom
rachel.yang/knuth-sample-tag

Conversation

@rachelyangdog

Copy link
Copy Markdown
Contributor

What does this PR do?

  • adds a new tag _dd.p.ksr

Motivation

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • 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.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running ./scripts/lint.sh locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@rachelyangdog
rachelyangdog requested a review from a team as a code owner September 8, 2025 21:35
@rachelyangdog
rachelyangdog marked this pull request as draft September 8, 2025 21:35
@pr-commenter

pr-commenter Bot commented Sep 8, 2025

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2025-09-11 14:43:56

Comparing candidate commit 1ec7deb in PR branch rachel.yang/knuth-sample-tag with baseline commit e7e5c7f in branch main.

Found 0 performance improvements and 5 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics.

scenario:BenchmarkOTelApiWithCustomTags/datadog_otel_api-24

  • 🟥 allocated_mem [+67 bytes; +76 bytes] or [+2.030%; +2.305%]
  • 🟥 allocations [+2; +2] or [+7.143%; +7.143%]
  • 🟥 execution_time [+281.389ns; +337.411ns] or [+5.981%; +7.172%]

scenario:BenchmarkOTelApiWithCustomTags/otel_api-24

  • 🟥 allocations [+2; +2] or [+4.651%; +4.651%]
  • 🟥 execution_time [+180.256ns; +253.744ns] or [+2.454%; +3.454%]

@rachelyangdog rachelyangdog changed the title WIP: chore(sampling): track knuth sampling in distributed trace chore(sampling): track knuth sampling in distributed trace Sep 9, 2025
@rachelyangdog
rachelyangdog marked this pull request as ready for review September 9, 2025 15:26
@darccio

darccio commented Sep 9, 2025

Copy link
Copy Markdown
Member

I imagine that those 2 new allocations are coming from the formatting function, right? Have we confirmed that?

@rachelyangdog

Copy link
Copy Markdown
Contributor Author

@darccio Yes, I think the issue is that we're calling the formatting function on every span that goes through sampling, even when the rate might be the same (like 1.0 or 0.0).

@genesor genesor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@rachelyangdog

Copy link
Copy Markdown
Contributor Author

/merge

@dd-devflow-routing-codex

dd-devflow-routing-codex Bot commented Sep 11, 2025

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2025-09-11 15:01:45 UTC ℹ️ Start processing command /merge


2025-09-11 15:02:09 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 15m (p90).


2025-09-11 15:15:49 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue
dd-mergequeue Bot merged commit 94e5988 into main Sep 11, 2025
244 checks passed
@dd-mergequeue
dd-mergequeue Bot deleted the rachel.yang/knuth-sample-tag branch September 11, 2025 15:15
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