-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OTEL_SAMPLING_PROBABILITY env variable definition #1117
Add OTEL_SAMPLING_PROBABILITY env variable definition #1117
Conversation
7ee9068
to
e1c3ef4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that was quick, @tigrannajaryan 🙂
da29e94
to
863b4b4
Compare
@@ -9,6 +9,7 @@ The goal of this specification is to unify the environment variable names betwee | |||
| OTEL_RESOURCE_ATTRIBUTES | Key-value pairs to be used as resource attributes | | See [Resource SDK](./resource/sdk.md#specifying-resource-information-via-an-environment-variable) for more details. | | |||
| OTEL_LOG_LEVEL | Log level used by the SDK logger | "info" | | | |||
| OTEL_PROPAGATORS | Propagators to be used as a comma separated list | "tracecontext,baggage" | Values MUST be deduplicated in order to register a `Propagator` only once. Unrecognized values MUST generate a warning and be gracefully ignored. | | |||
| OTEL_SAMPLING_PROBABILITY| Sampling probability, a number in the [0..1] range, e.g. 0.25| 1 | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does setting this env var imply setting a ParentOrElse
sampler with an underlying TraceIdRatioBased
sampler? Or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll let language maintainers tell what is needed here, I don't know how sampling in SDKs works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should do what I suggested, but I'd love other opinions. And, we should definitely document what's expected. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkwatson can you please suggest the exact edit to use on this line? I think it will fit best in the Notes column.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OTEL_TRACEID_RATIO_(BASED_)SAMPLER_PROBABILITY
is quite a bulky term but would probably be the most expressive one.
In the notes column, we could link to /~https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#traceidratiobased.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arminru would you still expect that the TraceIdRatioBased
sampler would be wrapped with a ParentOrElse
with that name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkwatson I would not expect that variable to affect which samplers are set up in which arrangement but if a TraceIdRatioBased
was set up automatically based on other configuration, this would be the probability it would use. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that, it seems strange to have an env-var to control one facet of a sampler, but no environment variable to actual specify a sampler!
I think we should hold off on this addition until we have a way to specify a sampler via env vars, so that this env var makes sense in that context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to add metrics and logs sampling later, should we name this OTEL_TRACE_SAMPLING_PROBABILITY
?
@jkwatson Makes sense. I think we ought to add an Opinions? |
that makes sense to me, yes. |
@carlosalberto opened #1136 for adding |
#1136 has been merged. @tigrannajaryan please rebase we can try to wrap this up 😉 |
863b4b4
to
d8f89fa
Compare
Done. |
It looks we should go with @jmacd's suggestion and rename this to |
@open-telemetry/specs-approvers Please review. |
d8f89fa
to
d779518
Compare
Renamed to OTEL_TRACE_SAMPLING_PROBABILITY. |
d779518
to
30769ff
Compare
@@ -9,7 +9,8 @@ The goal of this specification is to unify the environment variable names betwee | |||
| OTEL_RESOURCE_ATTRIBUTES | Key-value pairs to be used as resource attributes | | See [Resource SDK](./resource/sdk.md#specifying-resource-information-via-an-environment-variable) for more details. | | |||
| OTEL_LOG_LEVEL | Log level used by the SDK logger | "info" | | | |||
| OTEL_PROPAGATORS | Propagators to be used as a comma separated list | "tracecontext,baggage" | Values MUST be deduplicated in order to register a `Propagator` only once. Unrecognized values MUST generate a warning and be gracefully ignored. | | |||
| OTEL_TRACE_SAMPLER | Sampler to be used for traces | "parentbased_always_on" | See [Sampling](./trace/sdk.md#sampling) | | |||
| OTEL_TRACE_SAMPLER | Sampler to be used for traces | "parentbased_always_on" | See [Sampling](./trace/sdk.md#sampling) | | |||
| OTEL_TRACE_SAMPLING_PROBABILITY| Sampling probability, a number in the [0..1] range, e.g. 0.25| 1 | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what the default value means here, as discussed in #985. Is this the default to be used if sampler is traceidratio
?
@@ -9,7 +9,8 @@ The goal of this specification is to unify the environment variable names betwee | |||
| OTEL_RESOURCE_ATTRIBUTES | Key-value pairs to be used as resource attributes | | See [Resource SDK](./resource/sdk.md#specifying-resource-information-via-an-environment-variable) for more details. | | |||
| OTEL_LOG_LEVEL | Log level used by the SDK logger | "info" | | | |||
| OTEL_PROPAGATORS | Propagators to be used as a comma separated list | "tracecontext,baggage" | Values MUST be deduplicated in order to register a `Propagator` only once. Unrecognized values MUST generate a warning and be gracefully ignored. | | |||
| OTEL_TRACE_SAMPLER | Sampler to be used for traces | "parentbased_always_on" | See [Sampling](./trace/sdk.md#sampling) | | |||
| OTEL_TRACE_SAMPLER | Sampler to be used for traces | "parentbased_always_on" | See [Sampling](./trace/sdk.md#sampling) | | |||
| OTEL_TRACE_SAMPLING_PROBABILITY| Sampling probability, a number in the [0..1] range, e.g. 0.25| 1 | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have two variables we need to document what happens when e.g. OTEL_TRACE_SAMPLING_PROBABILITY is set but OTEL_TRACE_SAMPLER is not set (should the documented default parentbased_always_on be used or should it "smartly" use traceidratio? Or if it is explicitly set to something else than traceidratio or parentbased_traceidratio.
Alternatively, we might consider having only one variable with a bit more complex values like OTEL_TRACE_SAMPLER=traceidratio?ratio=0.25
(I imagine using querystring syntax would be useful here since many languages support parsing that out of the box).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we say OTEL_TRACE_SAMPLING_PROBABILITY
is evaluated only if OTEL_TRACE_SAMPLER
is set to traceidratio
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or parentbased_traceidratio
.
What if the tracer is configured in code? Should it somehow pick up the value? I guess not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Oberon00 If I understood correctly, this is a value used mostly for auto-instrumentation, at least for now (similar to OTEL_PROPAGATORS
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that is the intention, it should be documented. I would not be surprised if some SDKs respond to these environment variables out of the box.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Oberon00 If I understood correctly, this is a value used mostly for auto-instrumentation, at least for now (similar to
OTEL_PROPAGATORS
).
This was not mentioned anywhere that this is only for auto-instrumentation. I was planning to make SDK (.NET), respond to these env variables by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understood correctly, this is a value used mostly for auto-instrumentation, at least for now (similar to OTEL_PROPAGATORS).
This is functionality that auto-instrumentation can use, I agree, but it's functionality that I want for manual instrumentation too. I think of making every SDK implement these variables for configuring manual instrumentation is a post-GA item, something covered by the so-called "distros" or "launchers" that give you an easy way to install the SDK configured by the environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the tracer is configured in code? Should it somehow pick up the value? I guess not.
The convention in the Jaeger SDKs is:
- there is a Configuration struct
- it is used to construct the tracer
- it can be populated programmatically (default values result in default behavior), in some cases from config files
- it does not take env vars into account by default. To enable configuration via env vars, one must invoke
cfg = cfg.FromEnv()
explicitly on an existing config object, e.g. after setting the default parameters programmatically.
One downside of this configuration mechanism is that it must accounts for a number of optional features and, as a result, forces all dependencies to be included. E.g. in Java we have several modules (core, thrift, zipkin, etc.), and a top-level client
module that implements the configuration and depends on all of the other modules (whether you end up using them or not).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think of making every SDK implement these variables for configuring manual instrumentation is a post-GA item,
Sounds good to me. For now the only components required to support this would be auto-instrumentation components.
@@ -9,7 +9,8 @@ The goal of this specification is to unify the environment variable names betwee | |||
| OTEL_RESOURCE_ATTRIBUTES | Key-value pairs to be used as resource attributes | | See [Resource SDK](./resource/sdk.md#specifying-resource-information-via-an-environment-variable) for more details. | | |||
| OTEL_LOG_LEVEL | Log level used by the SDK logger | "info" | | | |||
| OTEL_PROPAGATORS | Propagators to be used as a comma separated list | "tracecontext,baggage" | Values MUST be deduplicated in order to register a `Propagator` only once. Unrecognized values MUST generate a warning and be gracefully ignored. | | |||
| OTEL_TRACE_SAMPLER | Sampler to be used for traces | "parentbased_always_on" | See [Sampling](./trace/sdk.md#sampling) | | |||
| OTEL_TRACE_SAMPLER | Sampler to be used for traces | "parentbased_always_on" | See [Sampling](./trace/sdk.md#sampling) | | |||
| OTEL_TRACE_SAMPLING_PROBABILITY| Sampling probability, a number in the [0..1] range, e.g. 0.25| 1 | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name should be
| OTEL_TRACE_SAMPLING_PROBABILITY| Sampling probability, a number in the [0..1] range, e.g. 0.25| 1 | | | |
| OTEL_TRACE_SAMPLER_TRACEIDRATIO_RATIO| Sampling ratio (probability), a number in the [0..1] range, e.g. 0.25| 1 | | |
to match the name traceidratio
that is used below for OTEL_TRACE_SAMPLER
and to have some logical hierarchy that is easy to understand and extensible if we add configuration for other samplers.
The current name has no obvious connection to traceidratio
, which I would find very confusing as a new user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I support this renaming. The intention for this environment variable is to configure only the traceidratio sampler, as I see it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Closed in favor of #1190 |
Fixes #1105