1 | import { Primitive } from './misc';
|
2 | import { Transaction } from './transaction';
|
3 | /** Interface holding all properties that can be set on a Span on creation. */
|
4 | export interface SpanContext {
|
5 | /**
|
6 | * Description of the Span.
|
7 | */
|
8 | description?: string;
|
9 | /**
|
10 | * Operation of the Span.
|
11 | */
|
12 | op?: string;
|
13 | /**
|
14 | * Completion status of the Span.
|
15 | * See: {@sentry/tracing SpanStatus} for possible values
|
16 | */
|
17 | status?: string;
|
18 | /**
|
19 | * Parent Span ID
|
20 | */
|
21 | parentSpanId?: string;
|
22 | /**
|
23 | * Was this span chosen to be sent as part of the sample?
|
24 | */
|
25 | sampled?: boolean;
|
26 | /**
|
27 | * Span ID
|
28 | */
|
29 | spanId?: string;
|
30 | /**
|
31 | * Trace ID
|
32 | */
|
33 | traceId?: string;
|
34 | /**
|
35 | * Tags of the Span.
|
36 | */
|
37 | tags?: {
|
38 | [key: string]: Primitive;
|
39 | };
|
40 | /**
|
41 | * Data of the Span.
|
42 | */
|
43 | data?: {
|
44 | [key: string]: any;
|
45 | };
|
46 | /**
|
47 | * Timestamp in seconds (epoch time) indicating when the span started.
|
48 | */
|
49 | startTimestamp?: number;
|
50 | /**
|
51 | * Timestamp in seconds (epoch time) indicating when the span ended.
|
52 | */
|
53 | endTimestamp?: number;
|
54 | }
|
55 | /** Span holding trace_id, span_id */
|
56 | export interface Span extends SpanContext {
|
57 | /**
|
58 | * @inheritDoc
|
59 | */
|
60 | spanId: string;
|
61 | /**
|
62 | * @inheritDoc
|
63 | */
|
64 | traceId: string;
|
65 | /**
|
66 | * @inheritDoc
|
67 | */
|
68 | startTimestamp: number;
|
69 | /**
|
70 | * @inheritDoc
|
71 | */
|
72 | tags: {
|
73 | [key: string]: Primitive;
|
74 | };
|
75 | /**
|
76 | * @inheritDoc
|
77 | */
|
78 | data: {
|
79 | [key: string]: any;
|
80 | };
|
81 | /**
|
82 | * The transaction containing this span
|
83 | */
|
84 | transaction?: Transaction;
|
85 | /**
|
86 | * Sets the finish timestamp on the current span.
|
87 | * @param endTimestamp Takes an endTimestamp if the end should not be the time when you call this function.
|
88 | */
|
89 | finish(endTimestamp?: number): void;
|
90 | /**
|
91 | * Sets the tag attribute on the current span.
|
92 | *
|
93 | * Can also be used to unset a tag, by passing `undefined`.
|
94 | *
|
95 | * @param key Tag key
|
96 | * @param value Tag value
|
97 | */
|
98 | setTag(key: string, value: Primitive): this;
|
99 | /**
|
100 | * Sets the data attribute on the current span
|
101 | * @param key Data key
|
102 | * @param value Data value
|
103 | */
|
104 | setData(key: string, value: any): this;
|
105 | /**
|
106 | * Sets the status attribute on the current span
|
107 | * See: {@sentry/tracing SpanStatus} for possible values
|
108 | * @param status http code used to set the status
|
109 | */
|
110 | setStatus(status: string): this;
|
111 | /**
|
112 | * Sets the status attribute on the current span based on the http code
|
113 | * @param httpStatus http code used to set the status
|
114 | */
|
115 | setHttpStatus(httpStatus: number): this;
|
116 | /**
|
117 | * Use {@link startChild}
|
118 | * @deprecated
|
119 | */
|
120 | child(spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'spanId' | 'sampled' | 'traceId' | 'parentSpanId'>>): Span;
|
121 | /**
|
122 | * Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
|
123 | * Also the `sampled` decision will be inherited.
|
124 | */
|
125 | startChild(spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'spanId' | 'sampled' | 'traceId' | 'parentSpanId'>>): Span;
|
126 | /**
|
127 | * Determines whether span was successful (HTTP200)
|
128 | */
|
129 | isSuccess(): boolean;
|
130 | /** Return a traceparent compatible header string */
|
131 | toTraceparent(): string;
|
132 | /** Returns the current span properties as a `SpanContext` */
|
133 | toContext(): SpanContext;
|
134 | /** Updates the current span with a new `SpanContext` */
|
135 | updateWithContext(spanContext: SpanContext): this;
|
136 | /** Convert the object to JSON for w. spans array info only */
|
137 | getTraceContext(): {
|
138 | data?: {
|
139 | [key: string]: any;
|
140 | };
|
141 | description?: string;
|
142 | op?: string;
|
143 | parent_span_id?: string;
|
144 | span_id: string;
|
145 | status?: string;
|
146 | tags?: {
|
147 | [key: string]: Primitive;
|
148 | };
|
149 | trace_id: string;
|
150 | };
|
151 | /** Convert the object to JSON */
|
152 | toJSON(): {
|
153 | data?: {
|
154 | [key: string]: any;
|
155 | };
|
156 | description?: string;
|
157 | op?: string;
|
158 | parent_span_id?: string;
|
159 | span_id: string;
|
160 | start_timestamp: number;
|
161 | status?: string;
|
162 | tags?: {
|
163 | [key: string]: Primitive;
|
164 | };
|
165 | timestamp?: number;
|
166 | trace_id: string;
|
167 | };
|
168 | }
|
169 | //# sourceMappingURL=span.d.ts.map |
\ | No newline at end of file |