UNPKG

1.63 kBTypeScriptView Raw
1import type { Span, SpanJSON, SpanTimeInput, TraceContext } from '@sentry/types';
2export declare const TRACE_FLAG_NONE = 0;
3export declare const TRACE_FLAG_SAMPLED = 1;
4/**
5 * Convert a span to a trace context, which can be sent as the `trace` context in an event.
6 */
7export declare function spanToTraceContext(span: Span): TraceContext;
8/**
9 * Convert a Span to a Sentry trace header.
10 */
11export declare function spanToTraceHeader(span: Span): string;
12/**
13 * Convert a span time input intp a timestamp in seconds.
14 */
15export declare function spanTimeInputToSeconds(input: SpanTimeInput | undefined): number;
16/**
17 * Convert a span to a JSON representation.
18 * Note that all fields returned here are optional and need to be guarded against.
19 *
20 * Note: Because of this, we currently have a circular type dependency (which we opted out of in package.json).
21 * This is not avoidable as we need `spanToJSON` in `spanUtils.ts`, which in turn is needed by `span.ts` for backwards compatibility.
22 * And `spanToJSON` needs the Span class from `span.ts` to check here.
23 * TODO v8: When we remove the deprecated stuff from `span.ts`, we can remove the circular dependency again.
24 */
25export declare function spanToJSON(span: Span): Partial<SpanJSON>;
26/**
27 * Returns true if a span is sampled.
28 * In most cases, you should just use `span.isRecording()` instead.
29 * However, this has a slightly different semantic, as it also returns false if the span is finished.
30 * So in the case where this distinction is important, use this method.
31 */
32export declare function spanIsSampled(span: Span): boolean;
33//# sourceMappingURL=spanUtils.d.ts.map
\No newline at end of file