UNPKG

1.38 kBTypeScriptView Raw
1import { Context, Link, Sampler, SamplingResult, SpanAttributes, SpanKind } from '@opentelemetry/api';
2/**
3 * A composite sampler that either respects the parent span's sampling decision
4 * or delegates to `delegateSampler` for root spans.
5 */
6export declare class ParentBasedSampler implements Sampler {
7 private _root;
8 private _remoteParentSampled;
9 private _remoteParentNotSampled;
10 private _localParentSampled;
11 private _localParentNotSampled;
12 constructor(config: ParentBasedSamplerConfig);
13 shouldSample(context: Context, traceId: string, spanName: string, spanKind: SpanKind, attributes: SpanAttributes, links: Link[]): SamplingResult;
14 toString(): string;
15}
16interface ParentBasedSamplerConfig {
17 /** Sampler called for spans with no parent */
18 root: Sampler;
19 /** Sampler called for spans with a remote parent which was sampled. Default AlwaysOn */
20 remoteParentSampled?: Sampler;
21 /** Sampler called for spans with a remote parent which was not sampled. Default AlwaysOff */
22 remoteParentNotSampled?: Sampler;
23 /** Sampler called for spans with a local parent which was sampled. Default AlwaysOn */
24 localParentSampled?: Sampler;
25 /** Sampler called for spans with a local parent which was not sampled. Default AlwaysOff */
26 localParentNotSampled?: Sampler;
27}
28export {};
29//# sourceMappingURL=ParentBasedSampler.d.ts.map
\No newline at end of file