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
+7-7
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,7 @@
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
+
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).
77
77
78
78
Prev example but with environment variables. Please make sure to set the env ``OTEL_TRACES_SAMPLER=traceidratio`` and ``OTEL_TRACES_SAMPLER_ARG=0.001``.
79
79
@@ -112,16 +112,16 @@
112
112
]
113
113
}
114
114
)
115
-
...
115
+
# ...
116
116
class CustomRatioSampler(Sampler):
117
117
def __init__(rate):
118
-
...
119
-
...
118
+
# ...
119
+
# ...
120
120
class CustomSamplerFactory:
121
121
@staticmethod
122
-
get_sampler(sampler_argument_str):
122
+
get_sampler(sampler_argument):
123
123
try:
124
-
rate = float(sampler_argument_str)
124
+
rate = float(sampler_argument)
125
125
return CustomSampler(rate)
126
126
except ValueError: # In case argument is empty string.
0 commit comments