UNPKG

1.05 kBTypeScriptView Raw
1import { Context } from '@opentelemetry/api';
2import { ReadableSpan } from './export/ReadableSpan';
3import { Span } from './Span';
4/**
5 * SpanProcessor is the interface Tracer SDK uses to allow synchronous hooks
6 * for when a {@link Span} is started or when a {@link Span} is ended.
7 */
8export interface SpanProcessor {
9 /**
10 * Forces to export all finished spans
11 */
12 forceFlush(): Promise<void>;
13 /**
14 * Called when a {@link Span} is started, if the `span.isRecording()`
15 * returns true.
16 * @param span the Span that just started.
17 */
18 onStart(span: Span, parentContext: Context): void;
19 /**
20 * Called when a {@link ReadableSpan} is ended, if the `span.isRecording()`
21 * returns true.
22 * @param span the Span that just ended.
23 */
24 onEnd(span: ReadableSpan): void;
25 /**
26 * Shuts down the processor. Called when SDK is shut down. This is an
27 * opportunity for processor to do any cleanup required.
28 */
29 shutdown(): Promise<void>;
30}
31//# sourceMappingURL=SpanProcessor.d.ts.map
\No newline at end of file