1 | import { Logger } from '../../common/types';
|
2 | import * as configTypes from '../config/types';
|
3 | import * as types from './types';
|
4 |
|
5 | export declare class Span implements types.Span {
|
6 | protected className: string;
|
7 |
|
8 | private clock;
|
9 |
|
10 | private startedLocal;
|
11 |
|
12 | private endedLocal;
|
13 |
|
14 | private spansLocal;
|
15 |
|
16 | readonly id: string;
|
17 |
|
18 | readonly tracer: types.TracerBase;
|
19 |
|
20 | logger: Logger;
|
21 |
|
22 | attributes: types.Attributes;
|
23 |
|
24 | annotations: types.Annotation[];
|
25 |
|
26 | messageEvents: types.MessageEvent[];
|
27 |
|
28 | links: types.Link[];
|
29 |
|
30 | remoteParent: boolean;
|
31 |
|
32 | root: Span;
|
33 |
|
34 | parentSpan?: Span;
|
35 |
|
36 | name: string;
|
37 |
|
38 | kind: types.SpanKind;
|
39 |
|
40 | status: types.Status;
|
41 |
|
42 | activeTraceParams: configTypes.TraceParams;
|
43 |
|
44 | droppedAttributesCount: number;
|
45 |
|
46 | droppedLinksCount: number;
|
47 |
|
48 | droppedAnnotationsCount: number;
|
49 |
|
50 | droppedMessageEventsCount: number;
|
51 |
|
52 | constructor(tracer: types.TracerBase, parent?: Span);
|
53 | /** Returns whether a span is root or not. */
|
54 | isRootSpan(): boolean;
|
55 | /** Gets the trace ID. */
|
56 | get traceId(): string;
|
57 | /** Gets the trace state */
|
58 | get traceState(): types.TraceState | undefined;
|
59 | /**
|
60 | * Gets the ID of the parent span.
|
61 | * RootSpan doesn't have a parentSpan but it override this method.
|
62 | */
|
63 | get parentSpanId(): string;
|
64 | /** Indicates if span was started. */
|
65 | get started(): boolean;
|
66 | /** Indicates if span was ended. */
|
67 | get ended(): boolean;
|
68 | /**
|
69 | * Gives a timestamp that indicates the span's start time in RFC3339 UTC
|
70 | * "Zulu" format.
|
71 | */
|
72 | get startTime(): Date;
|
73 | /** Recursively gets the descendant spans. */
|
74 | allDescendants(): types.Span[];
|
75 | /** The list of immediate child spans. */
|
76 | get spans(): types.Span[];
|
77 | /** The number of direct children. */
|
78 | get numberOfChildren(): number;
|
79 | /**
|
80 | * Gives a timestamp that indicates the span's end time in RFC3339 UTC
|
81 | * "Zulu" format.
|
82 | */
|
83 | get endTime(): Date;
|
84 | /**
|
85 | * Gets the duration of the clock.
|
86 | */
|
87 | get duration(): number;
|
88 | /** Gives the TraceContext of the span. */
|
89 | get spanContext(): types.SpanContext;
|
90 | /**
|
91 | * Adds an atribute to the span.
|
92 | * @param key Describes the value added.
|
93 | * @param value The result of an operation. If the value is a typeof object
|
94 | * it has to be JSON.stringify-able, cannot contain circular dependencies.
|
95 | */
|
96 | addAttribute(key: string, value: string | number | boolean | object): void;
|
97 | /**
|
98 | * Adds an annotation to the span.
|
99 | * @param description Describes the event.
|
100 | * @param attributes A set of attributes on the annotation.
|
101 | * @param timestamp A time, in milliseconds. Defaults to Date.now()
|
102 | */
|
103 | addAnnotation(description: string, attributes?: types.Attributes, timestamp?: number): void;
|
104 | /**
|
105 | * Adds a link to the span.
|
106 | * @param traceId The trace ID for a trace within a project.
|
107 | * @param spanId The span ID for a span within a trace.
|
108 | * @param type The relationship of the current span relative to the linked.
|
109 | * @param attributes A set of attributes on the link.
|
110 | */
|
111 | addLink(traceId: string, spanId: string, type: types.LinkType, attributes?: types.Attributes): void;
|
112 | /**
|
113 | * Adds a message event to the span.
|
114 | * @param type The type of message event.
|
115 | * @param id An identifier for the message event.
|
116 | * @param timestamp A time in milliseconds. Defaults to Date.now()
|
117 | * @param uncompressedSize The number of uncompressed bytes sent or received
|
118 | * @param compressedSize The number of compressed bytes sent or received. If
|
119 | * zero or undefined, assumed to be the same size as uncompressed.
|
120 | */
|
121 | addMessageEvent(type: types.MessageEventType, id: number, timestamp?: number, uncompressedSize?: number, compressedSize?: number): void;
|
122 | /**
|
123 | * Sets a status to the span.
|
124 | * @param code The canonical status code.
|
125 | * @param message optional A developer-facing error message.
|
126 | */
|
127 | setStatus(code: types.CanonicalCode, message?: string): void;
|
128 | /** Starts the span. */
|
129 | start(): void;
|
130 | /** Ends the span and all of its children, recursively. */
|
131 | end(): void;
|
132 | /** Forces the span to end. */
|
133 | truncate(): void;
|
134 | /**
|
135 | * Starts a new child span.
|
136 | * @param [options] A SpanOptions object to start a child span.
|
137 | */
|
138 | startChildSpan(options?: types.SpanOptions): types.Span;
|
139 | }
|