[dynamic control] Add trace sampling validation#2604
Merged
trask merged 2 commits intoopen-telemetry:mainfrom Feb 9, 2026
Merged
[dynamic control] Add trace sampling validation#2604trask merged 2 commits intoopen-telemetry:mainfrom
trask merged 2 commits intoopen-telemetry:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds initial support for trace sampling validation in the dynamic-control module, implementing validation for trace sampling policies according to OpenTelemetry specification pull request #4738.
Changes:
- Introduces a
PolicyValidatorinterface for validating telemetry policy configurations - Implements
TraceSamplingValidatorto validate trace sampling policies with probability values between 0.0 and 1.0 - Supports both full JSON format and a simplified "trace-sampling.probability" alias for configuration
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| PolicyValidator.java | Defines the interface for policy validators with JSON and alias validation methods |
| TraceSamplingValidator.java | Implements trace sampling validation with probability range checking |
| } catch (JsonProcessingException e) { | ||
| // Not valid JSON for this validator | ||
| } | ||
| logger.info("Invalid trace-sampling JSON: " + json); |
There was a problem hiding this comment.
Logging the full JSON input at INFO level could expose sensitive data. Consider logging only a sanitized message or moving this to DEBUG level with appropriate sanitization.
| } catch (NumberFormatException e) { | ||
| // invalid | ||
| } | ||
| logger.info("Ignoring invalid trace-sampling.probability value: " + value); |
There was a problem hiding this comment.
Logging the raw input value could expose sensitive data. Consider logging a generic message instead or sanitizing the value before logging.
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/PolicyValidator.java
Outdated
Show resolved
Hide resolved
…/policy/PolicyValidator.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
LikeTheSalad
approved these changes
Feb 4, 2026
trask
approved these changes
Feb 9, 2026
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 9, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
Initial implementation of trace sampling validation per #2546.
A full working implementation of the open-telemetry/opentelemetry-specification#4738 is here in this branch