Skip to content

Commit 5821531

Browse files
committed
Removed documentation of custom sampler feature while circular dependency bug is explored
1 parent 3132a56 commit 5821531

File tree

2 files changed

+4
-34
lines changed

2 files changed

+4
-34
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
- Removed documentation of custom sampler feature while circular dependency bug is explored
11+
([#3014](https://github.com/open-telemetry/opentelemetry-python/pull/3014))
1012
- Add logarithm and exponent mappings
1113
([#2960](https://github.com/open-telemetry/opentelemetry-python/pull/2960))
1214
- Add and use missing metrics environment variables

opentelemetry-sdk/src/opentelemetry/sdk/trace/sampling.py

+2-34
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
...
6565
6666
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 built-in values for ``OTEL_TRACES_SAMPLER`` are:
67+
The list of known values for ``OTEL_TRACES_SAMPLER`` are:
6868
6969
* always_on - Sampler that always samples spans, regardless of the parent span's sampling decision.
7070
* always_off - Sampler that never samples spans, regardless of the parent span's sampling decision.
@@ -73,7 +73,7 @@
7373
* parentbased_always_off - Sampler that respects its parent span's sampling decision, but otherwise never samples.
7474
* parentbased_traceidratio - Sampler that respects its parent span's sampling decision, but otherwise samples probabalistically based on rate.
7575
76-
Sampling probability can be set with ``OTEL_TRACES_SAMPLER_ARG`` if the sampler is traceidratio or parentbased_traceidratio. Rate must be in the range [0.0,1.0]. When not provided rate will be set to 1.0 (maximum rate possible).
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).
7777
7878
Prev example but with environment variables. Please make sure to set the env ``OTEL_TRACES_SAMPLER=traceidratio`` and ``OTEL_TRACES_SAMPLER_ARG=0.001``.
7979
@@ -96,38 +96,6 @@
9696
# created spans will now be sampled by the TraceIdRatioBased sampler with rate 1/1000.
9797
with trace.get_tracer(__name__).start_as_current_span("Test Span"):
9898
...
99-
100-
In order to create a configurable custom sampler, create an entry point for the custom sampler factory method under the entry point group, ``opentelemetry_traces_sampler``. The custom sampler factory
101-
method must be of type ``Callable[[str], Sampler]``, taking a single string argument and returning a Sampler object. The single input will come from the string value of the
102-
``OTEL_TRACES_SAMPLER_ARG`` environment variable. If ``OTEL_TRACES_SAMPLER_ARG`` is not configured, the input will be an empty string. For example:
103-
104-
.. code:: python
105-
106-
setup(
107-
...
108-
entry_points={
109-
...
110-
"opentelemetry_traces_sampler": [
111-
"custom_sampler_name = path.to.sampler.factory.method:CustomSamplerFactory.get_sampler"
112-
]
113-
}
114-
)
115-
# ...
116-
class CustomRatioSampler(Sampler):
117-
def __init__(rate):
118-
# ...
119-
# ...
120-
class CustomSamplerFactory:
121-
@staticmethod
122-
get_sampler(sampler_argument):
123-
try:
124-
rate = float(sampler_argument)
125-
return CustomSampler(rate)
126-
except ValueError: # In case argument is empty string.
127-
return CustomSampler(0.5)
128-
129-
In order to configure you application with a custom sampler's entry point, set the ``OTEL_TRACES_SAMPLER`` environment variable to the key name of the entry point. For example, to configured the
130-
above sampler, set ``OTEL_TRACES_SAMPLER=custom_sampler_name`` and ``OTEL_TRACES_SAMPLER_ARG=0.5``.
13199
"""
132100
import abc
133101
import enum

0 commit comments

Comments
 (0)