73 lines
2.4 KiB
TypeScript
73 lines
2.4 KiB
TypeScript
|
/**
|
||
|
* Type of span. Can be used to specify additional relationships between spans
|
||
|
* in addition to a parent/child relationship.
|
||
|
*/
|
||
|
export declare enum SpanKind {
|
||
|
/** Default value. Indicates that the span is used internally. */
|
||
|
INTERNAL = 0,
|
||
|
/**
|
||
|
* Indicates that the span covers server-side handling of an RPC or other
|
||
|
* remote request.
|
||
|
*/
|
||
|
SERVER = 1,
|
||
|
/**
|
||
|
* Indicates that the span covers the client-side wrapper around an RPC or
|
||
|
* other remote request.
|
||
|
*/
|
||
|
CLIENT = 2,
|
||
|
/**
|
||
|
* Indicates that the span describes producer sending a message to a
|
||
|
* broker. Unlike client and server, there is no direct critical path latency
|
||
|
* relationship between producer and consumer spans.
|
||
|
*/
|
||
|
PRODUCER = 3,
|
||
|
/**
|
||
|
* Indicates that the span describes consumer receiving a message from a
|
||
|
* broker. Unlike client and server, there is no direct critical path latency
|
||
|
* relationship between producer and consumer spans.
|
||
|
*/
|
||
|
CONSUMER = 4,
|
||
|
}
|
||
|
export declare type LinkContext = Pick<SpanContext, 'traceId' | 'spanId'>;
|
||
|
export interface Attributes {
|
||
|
[attributeKey: string]: AttributeValue | undefined;
|
||
|
}
|
||
|
export declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
|
||
|
export interface Link {
|
||
|
/** The {@link SpanContext} of a linked span. */
|
||
|
context: LinkContext;
|
||
|
/** A set of {@link Attributes} on the link. */
|
||
|
attributes?: Attributes;
|
||
|
}
|
||
|
export interface SpanContext {
|
||
|
traceId: string;
|
||
|
spanId: string;
|
||
|
traceFlags?: {
|
||
|
toString: () => string;
|
||
|
};
|
||
|
tracestate?: string;
|
||
|
}
|
||
|
export interface Span {
|
||
|
_duration: [number, number];
|
||
|
name: string;
|
||
|
parentSpanId?: string;
|
||
|
status: {
|
||
|
code: number;
|
||
|
message?: string;
|
||
|
};
|
||
|
attributes: Record<string, string>;
|
||
|
kind: SpanKind;
|
||
|
links: Link[];
|
||
|
context: () => SpanContext;
|
||
|
}
|
||
|
export declare class OpenTelemetryScopeManagerWrapper {
|
||
|
private _activeSymbol;
|
||
|
active(): any;
|
||
|
with(span: Span, fn: () => any): any;
|
||
|
bind<T>(target: T): T;
|
||
|
enable(): this;
|
||
|
disable(): this;
|
||
|
private static _spanToContext(span, parentSpanId?, name?);
|
||
|
}
|
||
|
export declare const AsyncScopeManager: OpenTelemetryScopeManagerWrapper;
|