Skip to content

Comments

[dynamic-control] Add trace sampling-rate implementer#2634

Open
jackshirazi wants to merge 9 commits intoopen-telemetry:mainfrom
jackshirazi:policy6
Open

[dynamic-control] Add trace sampling-rate implementer#2634
jackshirazi wants to merge 9 commits intoopen-telemetry:mainfrom
jackshirazi:policy6

Conversation

@jackshirazi
Copy link
Contributor

Per #2546

A basic trace sampling-rate implementer which simplistically applies changes to the sample rate

A full working implementation of the open-telemetry/opentelemetry-specification#4738 is here in this branch

Note the final dynamic-control sampling management needs to be more sophisticated, to dynamically handle route exclusion/inclusions as well as sampling rate and needs to use the recently added composable samplers (by default), but that's all for later addition

Copilot AI review requested due to automatic review settings February 16, 2026 21:06
@jackshirazi jackshirazi requested a review from a team as a code owner February 16, 2026 21:06
Copy link
Contributor

Copilot AI left a comment

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 adds a trace sampling-rate policy implementer for the dynamic-control module, enabling runtime changes to trace sampling rates through the Telemetry Policy framework. This is part of a larger effort to implement experimental Telemetry Policy support (issue #2546) based on the draft OpenTelemetry specification.

Changes:

  • Introduces the PolicyImplementer interface for applying validated telemetry policies to runtime components
  • Implements TraceSamplingRatePolicyImplementer to dynamically update trace sampling rates via a DelegatingSampler
  • Adds comprehensive unit tests for the implementer covering various scenarios including null specs, probability application, policy filtering, and conflict resolution

Reviewed changes

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

File Description
PolicyImplementer.java New interface defining the contract for policy implementers with clear documentation of responsibilities and lifecycle
TraceSamplingRatePolicyImplementer.java Implementation that translates trace-sampling policies into sampler configuration changes using the OpenTelemetry SDK
TraceSamplingRatePolicyImplementerTest.java Comprehensive unit tests covering core functionality including edge cases and policy precedence rules

jackshirazi and others added 5 commits February 17, 2026 09:39
…/policy/TraceSamplingRatePolicyImplementer.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…/policy/TraceSamplingRatePolicyImplementerTest.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
new TraceSamplingRatePolicyImplementer(delegatingSampler);

implementer.onPoliciesChanged(
Collections.singletonList(new TelemetryPolicy("trace-sampling", null)));
Copy link
Member

Choose a reason for hiding this comment

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

could do a static import for all of these usages. we recently added this to spotless in instrumentation so i imagine we'll do something similar here soon too

Suggested change
Collections.singletonList(new TelemetryPolicy("trace-sampling", null)));
singletonList(new TelemetryPolicy("trace-sampling", null)));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good suggestion, thanks. done now

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.

3 participants