1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import { CoreTracerBase } from './tracer-base';
|
18 | import * as types from './types';
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | export declare class CoreTracer extends CoreTracerBase implements types.Tracer {
|
29 |
|
30 | private contextManager;
|
31 |
|
32 | constructor();
|
33 | /** Gets the current root span. */
|
34 | /** Sets the current root span. */
|
35 | currentRootSpan: types.Span;
|
36 | /** Sets the current root span. */
|
37 | setCurrentRootSpan(root: types.Span): void;
|
38 | /**
|
39 | * Starts a root span.
|
40 | * @param options A TraceOptions object to start a root span.
|
41 | * @param fn A callback function to run after starting a root span.
|
42 | */
|
43 | startRootSpan<T>(options: types.TraceOptions, fn: (root: types.Span) => T): T;
|
44 | /** Notifies listeners of the span start. */
|
45 | onStartSpan(span: types.Span): void;
|
46 | /** Notifies listeners of the span end. */
|
47 | onEndSpan(span: types.Span): void;
|
48 | /** Clears the current root span. */
|
49 | clearCurrentTrace(): void;
|
50 | /**
|
51 | * Starts a span.
|
52 | * @param [options] A SpanOptions object to start a child span.
|
53 | */
|
54 | startChildSpan(options?: types.SpanOptions): types.Span;
|
55 | /**
|
56 | * Binds the trace context to the given function.
|
57 | * This is necessary in order to create child spans correctly in functions
|
58 | * that are called asynchronously (for example, in a network response
|
59 | * handler).
|
60 | * @param fn A function to which to bind the trace context.
|
61 | */
|
62 | wrap<T>(fn: types.Func<T>): types.Func<T>;
|
63 | /**
|
64 | * Binds the trace context to the given event emitter.
|
65 | * This is necessary in order to create child spans correctly in event
|
66 | * handlers.
|
67 | * @param emitter An event emitter whose handlers should have
|
68 | * the trace context binded to them.
|
69 | */
|
70 | wrapEmitter(emitter: NodeJS.EventEmitter): void;
|
71 | }
|