feat(telemetry): add sampler config for OpenTelemetry tracing#8529
Open
codefromthecrypt wants to merge 3 commits intoenvoyproxy:mainfrom
Open
feat(telemetry): add sampler config for OpenTelemetry tracing#8529codefromthecrypt wants to merge 3 commits intoenvoyproxy:mainfrom
codefromthecrypt wants to merge 3 commits intoenvoyproxy:mainfrom
Conversation
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
5a69009 to
2ab02c0
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8529 +/- ##
==========================================
- Coverage 74.38% 74.37% -0.02%
==========================================
Files 243 243
Lines 38164 38238 +74
==========================================
+ Hits 28390 28441 +51
- Misses 7789 7806 +17
- Partials 1985 1991 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
zirain
reviewed
Mar 16, 2026
2ab02c0 to
89f877c
Compare
| // SamplingPercentage controls the percentage of traces to sample. | ||
| // Defaults to 100% when not set. | ||
| // +optional | ||
| SamplingPercentage *gwapiv1.Fraction `json:"samplingPercentage,omitempty"` |
Contributor
Author
There was a problem hiding this comment.
this name and type doesn't match otel, but it does match envoy. good enough as we need to map otel env externally anyway now
89f877c to
eff97db
Compare
eff97db to
c1b867c
Compare
zhaohuabing
reviewed
Mar 17, 2026
zhaohuabing
reviewed
Mar 17, 2026
zhaohuabing
reviewed
Mar 17, 2026
zhaohuabing
reviewed
Mar 17, 2026
internal/xds/translator/testdata/in/xds-ir/tracing-otel-sampler.yaml
Outdated
Show resolved
Hide resolved
c1b867c to
77ca8cf
Compare
zhaohuabing
reviewed
Mar 19, 2026
zhaohuabing
reviewed
Mar 19, 2026
Member
|
Two more nits - sorry I didn't mention them in the previous comment. Otherwise LGTM! |
77ca8cf to
e6eb61d
Compare
zirain
previously approved these changes
Mar 19, 2026
e6eb61d to
c740cdf
Compare
Contributor
Author
|
/retest |
2371ec8 to
d22468c
Compare
Add OTelSampler to OpenTelemetryTracingProvider, supporting the standard OTEL sampler types. The type field maps to OTEL_TRACES_SAMPLER, with CEL validation ensuring samplingPercentage is only set for ratio-based types: - AlwaysOn, AlwaysOff, ParentBasedAlwaysOn, ParentBasedAlwaysOff: no additional config - TraceIdRatioBased, ParentBasedTraceIdRatioBased: optional samplingPercentage (gwapiv1.Fraction, defaults to 100%) samplingPercentage uses Envoy native FractionalPercent arg type for parity. This does not support automatic coercion of the OTEL_TRACES_SAMPLER_ARG env var value, but maintains value consistency with the sampler name. When a sampler is configured, HCM RandomSampling is set to 100% so the sampler alone decides whether to record spans. Fixes envoyproxy#8476 Signed-off-by: Adrian Cole <adrian@tetrate.io>
d22468c to
fc4af84
Compare
Contributor
Author
|
hey folks.. could this be the day sampling is merged? 🚢 |
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.
What type of PR is this?
feat(telemetry): add new feature
What this PR does / why we need it:
Adds
samplertoOpenTelemetryTracingProvider, supporting the standard OTEL sampler types as a discriminated union:sampler.typeAlwaysOnAlwaysOffTraceIdRatioBasedsamplingPercentage(default 100%)ParentBasedAlwaysOnParentBasedAlwaysOffParentBasedTraceIdRatioBasedsamplingPercentage(default 100%)Example (respect parent, drop all root spans):
Notes
samplingPercentageuses Envoy's nativeFractionalPercentarg type for parity, even though SDKs are not uniform in the parameter name for TraceIdRatioBased. This does not support automatic coercion of theOTEL_TRACES_SAMPLER_ARGenv var value, but maintains value consistency with the sampler name.When a sampler is configured, HCM
RandomSamplingis set to 100% so the sampler alone decides whether to record spans. Otherwise, HCM would drop requests before the sampler runs, making configurations likeAlwaysOfforParentBasedbehave incorrectly.Which issue(s) this PR fixes:
Fixes #8476
Release Notes: Yes