UNPKG

1.56 kBTypeScriptView Raw
1import { Context } from '../context/types';
2import { SpanAttributes } from './attributes';
3import { Link } from './link';
4import { SamplingResult } from './SamplingResult';
5import { SpanKind } from './span_kind';
6/**
7 * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.
8 * This interface represent a sampler. Sampling is a mechanism to control the
9 * noise and overhead introduced by OpenTelemetry by reducing the number of
10 * samples of traces collected and sent to the backend.
11 */
12export interface Sampler {
13 /**
14 * Checks whether span needs to be created and tracked.
15 *
16 * @param context Parent Context which may contain a span.
17 * @param traceId of the span to be created. It can be different from the
18 * traceId in the {@link SpanContext}. Typically in situations when the
19 * span to be created starts a new trace.
20 * @param spanName of the span to be created.
21 * @param spanKind of the span to be created.
22 * @param attributes Initial set of SpanAttributes for the Span being constructed.
23 * @param links Collection of links that will be associated with the Span to
24 * be created. Typically useful for batch operations.
25 * @returns a {@link SamplingResult}.
26 */
27 shouldSample(context: Context, traceId: string, spanName: string, spanKind: SpanKind, attributes: SpanAttributes, links: Link[]): SamplingResult;
28 /** Returns the sampler name or short description with the configuration. */
29 toString(): string;
30}
31//# sourceMappingURL=Sampler.d.ts.map
\No newline at end of file