UNPKG

2.97 kBTypeScriptView Raw
1import type { SentrySpanArguments, Span, SpanAttributeValue, SpanAttributes, SpanContextData, SpanJSON, SpanStatus, SpanTimeInput, TimedEvent } from '@sentry/types';
2/**
3 * Span contains all data about a span
4 */
5export declare class SentrySpan implements Span {
6 protected _traceId: string;
7 protected _spanId: string;
8 protected _parentSpanId?: string | undefined;
9 protected _sampled: boolean | undefined;
10 protected _name?: string | undefined;
11 protected _attributes: SpanAttributes;
12 /** Epoch timestamp in seconds when the span started. */
13 protected _startTime: number;
14 /** Epoch timestamp in seconds when the span ended. */
15 protected _endTime?: number | undefined;
16 /** Internal keeper of the status */
17 protected _status?: SpanStatus;
18 /** The timed events added to this span. */
19 protected _events: TimedEvent[];
20 /** if true, treat span as a standalone span (not part of a transaction) */
21 private _isStandaloneSpan?;
22 /**
23 * You should never call the constructor manually, always use `Sentry.startSpan()`
24 * or other span methods.
25 * @internal
26 * @hideconstructor
27 * @hidden
28 */
29 constructor(spanContext?: SentrySpanArguments);
30 /** @inheritdoc */
31 spanContext(): SpanContextData;
32 /** @inheritdoc */
33 setAttribute(key: string, value: SpanAttributeValue | undefined): void;
34 /** @inheritdoc */
35 setAttributes(attributes: SpanAttributes): void;
36 /**
37 * This should generally not be used,
38 * but we need it for browser tracing where we want to adjust the start time afterwards.
39 * USE THIS WITH CAUTION!
40 *
41 * @hidden
42 * @internal
43 */
44 updateStartTime(timeInput: SpanTimeInput): void;
45 /**
46 * @inheritDoc
47 */
48 setStatus(value: SpanStatus): this;
49 /**
50 * @inheritDoc
51 */
52 updateName(name: string): this;
53 /** @inheritdoc */
54 end(endTimestamp?: SpanTimeInput): void;
55 /**
56 * Get JSON representation of this span.
57 *
58 * @hidden
59 * @internal This method is purely for internal purposes and should not be used outside
60 * of SDK code. If you need to get a JSON representation of a span,
61 * use `spanToJSON(span)` instead.
62 */
63 getSpanJSON(): SpanJSON;
64 /** @inheritdoc */
65 isRecording(): boolean;
66 /**
67 * @inheritdoc
68 */
69 addEvent(name: string, attributesOrStartTime?: SpanAttributes | SpanTimeInput, startTime?: SpanTimeInput): this;
70 /**
71 * This method should generally not be used,
72 * but for now we need a way to publicly check if the `_isStandaloneSpan` flag is set.
73 * USE THIS WITH CAUTION!
74 * @internal
75 * @hidden
76 * @experimental
77 */
78 isStandaloneSpan(): boolean;
79 /** Emit `spanEnd` when the span is ended. */
80 private _onSpanEnded;
81 /**
82 * Finish the transaction & prepare the event to send to Sentry.
83 */
84 private _convertSpanToTransaction;
85}
86//# sourceMappingURL=sentrySpan.d.ts.map
\No newline at end of file