UNPKG

@dash0/sdk-web

Version:

Dash0's Web SDK to collect telemetry from end-users' web browsers

15 lines (14 loc) 1.01 kB
import { KeyValue, Span, SpanStatus } from "../../types/otlp"; export type InProgressSpan = Omit<Span, "endTimeUnixNano">; export declare function startSpan(name: string): InProgressSpan; /** * Ends the span by setting status and endTimeUnixNano on it. If the spand was already previously ended, this returns undefined * to prevent the span from being ended multiple times on accident. */ export declare function endSpan(span: InProgressSpan, status: SpanStatus | undefined, durationNano: number | undefined): Span | undefined; /** * Adds an event to a span. Can optionally accept the events timestamp and attributes for the event. * The timestamp needs to be specified as nanoseconds since unix epoch in string format. */ export declare function addSpanEvent(span: InProgressSpan, name: string, attributesOrTs?: string | KeyValue[] | undefined, attributes?: KeyValue[] | undefined): void; export declare function setSpanStatus(span: InProgressSpan, code: SpanStatus["code"], message?: string): void;