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 | get currentRootSpan(): types.Span;
|
35 | /** Sets the current root span. */
|
36 | set currentRootSpan(root: types.Span);
|
37 | /** Sets the current root span. */
|
38 | setCurrentRootSpan(root: types.Span): void;
|
39 | /**
|
40 | * Starts a root span.
|
41 | * @param options A TraceOptions object to start a root span.
|
42 | * @param fn A callback function to run after starting a root span.
|
43 | */
|
44 | startRootSpan<T>(options: types.TraceOptions, fn: (root: types.Span) => T): T;
|
45 | /** Notifies listeners of the span start. */
|
46 | onStartSpan(span: types.Span): void;
|
47 | /** Notifies listeners of the span end. */
|
48 | onEndSpan(span: types.Span): void;
|
49 | /** Clears the current root span. */
|
50 | clearCurrentTrace(): void;
|
51 | /**
|
52 | * Starts a span.
|
53 | * @param [options] A SpanOptions object to start a child span.
|
54 | */
|
55 | startChildSpan(options?: types.SpanOptions): types.Span;
|
56 | /**
|
57 | * Binds the trace context to the given function.
|
58 | * This is necessary in order to create child spans correctly in functions
|
59 | * that are called asynchronously (for example, in a network response
|
60 | * handler).
|
61 | * @param fn A function to which to bind the trace context.
|
62 | */
|
63 | wrap<T>(fn: types.Func<T>): types.Func<T>;
|
64 | /**
|
65 | * Binds the trace context to the given event emitter.
|
66 | * This is necessary in order to create child spans correctly in event
|
67 | * handlers.
|
68 | * @param emitter An event emitter whose handlers should have
|
69 | * the trace context binded to them.
|
70 | */
|
71 | wrapEmitter(emitter: NodeJS.EventEmitter): void;
|
72 | }
|