You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: opentelemetry-sdk/src/opentelemetry/sdk/trace/sampling.py
+61-11
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@
64
64
...
65
65
66
66
The tracer sampler can also be configured via environment variables ``OTEL_TRACES_SAMPLER`` and ``OTEL_TRACES_SAMPLER_ARG`` (only if applicable).
67
-
The list of known values for ``OTEL_TRACES_SAMPLER`` are:
67
+
The list of built-in values for ``OTEL_TRACES_SAMPLER`` are:
68
68
69
69
* always_on - Sampler that always samples spans, regardless of the parent span's sampling decision.
70
70
* always_off - Sampler that never samples spans, regardless of the parent span's sampling decision.
@@ -73,7 +73,24 @@
73
73
* parentbased_always_off - Sampler that respects its parent span's sampling decision, but otherwise never samples.
74
74
* parentbased_traceidratio - Sampler that respects its parent span's sampling decision, but otherwise samples probabalistically based on rate.
75
75
76
-
Sampling probability can be set with ``OTEL_TRACES_SAMPLER_ARG`` if the sampler is traceidratio or parentbased_traceidratio, when not provided rate will be set to 1.0 (maximum rate possible).
76
+
In order to configure a custom sampler via environment variables, create an entry point for the custom sampler class under the entry point group, ``opentelemtry_traces_sampler``. Then, set the ``OTEL_TRACES_SAMPLER`` environment variable to the key name of the entry point. For example, set ``OTEL_TRACES_SAMPLER=custom_sampler_name`` and ``OTEL_TRACES_SAMPLER_ARG=0.5`` after creating the following entry point:
Sampling probability can be set with ``OTEL_TRACES_SAMPLER_ARG`` if the sampler is a ``TraceIdRatioBased`` Sampler, such as ``traceidratio`` and ``parentbased_traceidratio``. When not provided rate will be set to 1.0 (maximum rate possible).
77
94
78
95
79
96
Prev example but with environment variables. Please make sure to set the env ``OTEL_TRACES_SAMPLER=traceidratio`` and ``OTEL_TRACES_SAMPLER_ARG=0.001``.
0 commit comments