|
24 | 24 | %% For examples of configuring samplers or implementing your own sampler,
|
25 | 25 | %% see <a href="https://opentelemetry.io/docs/languages/erlang/sampling/">the OpenTelemetry
|
26 | 26 | %% Erlang documentation</a>.
|
| 27 | +%% |
| 28 | +%% <h3>Configuration</h3> |
| 29 | +%% |
| 30 | +%% To configure sampling for the `opentelemetry' application, see |
| 31 | +%% <a href="https://hexdocs.pm/opentelemetry/readme.html#samplers">the documentation</a>. |
27 | 32 | %% @end
|
28 | 33 | %%%-------------------------------------------------------------------------
|
29 | 34 | -module(otel_sampler).
|
|
81 | 86 | %% A built-in sampler.
|
82 | 87 |
|
83 | 88 | -type sampler_spec() :: builtin_sampler() | {module(), sampler_opts()}.
|
| 89 | +%% Specification to create a sampler. |
84 | 90 |
|
85 | 91 | -type sampling_decision() :: ?DROP | ?RECORD_ONLY | ?RECORD_AND_SAMPLE.
|
86 | 92 | %% The decision that a sampler can make on a given span.
|
|
90 | 96 | opentelemetry:attributes_map(),
|
91 | 97 | opentelemetry:tracestate() | otel_tracestate:members()
|
92 | 98 | }.
|
| 99 | +%% The result of a sampling decision. |
93 | 100 |
|
94 | 101 | -opaque t() :: {module(), description(), sampler_opts()}.
|
95 | 102 | %% A sampler.
|
96 | 103 |
|
97 |
| -%% @private |
98 |
| --spec new(sampler_spec()) -> t(). |
| 104 | +%% @doc Returns a sampler based on the given specification. |
| 105 | +-spec new(SamplerSpec :: sampler_spec()) -> t(). |
99 | 106 | new(always_on) ->
|
100 | 107 | new({otel_sampler_always_on, #{}});
|
101 | 108 | new(always_off) ->
|
@@ -128,6 +135,6 @@ should_sample({Sampler, _, Config}, Ctx, TraceId, Links, SpanName, Kind, Attribu
|
128 | 135 | Result
|
129 | 136 | end.
|
130 | 137 |
|
131 |
| -%% @private |
| 138 | +%% @doc Returns the description of the given sampler. |
132 | 139 | -spec description(t()) -> description().
|
133 |
| -description({_, Description, _}) -> Description. |
| 140 | +description(_Sampler = {_, Description, _}) -> Description. |
0 commit comments