UNPKG

693 BTypeScriptView Raw
1import { SpanId } from './shared';
2export declare enum SpanStatus {
3 Started = 0,
4 Stopped = 1
5}
6export declare class Span {
7 name: string;
8 id: SpanId;
9 parentId?: SpanId;
10 duration: number | null;
11 attrs: {
12 [key: string]: any;
13 };
14 status: SpanStatus;
15 _start: bigint;
16 constructor(name: string, parentId?: SpanId, attrs?: Object);
17 stop(): void;
18 traceChild(name: string, attrs?: Object): Span;
19 setAttribute(key: string, value: any): void;
20 traceFn(fn: any): any;
21 traceAsyncFn<T>(fn: () => T | Promise<T>): Promise<T>;
22}
23export declare const trace: (name: string, parentId?: string | undefined, attrs?: Object | undefined) => Span;