UNPKG

@embrace-io/react-native-tracer-provider

Version:

A React Native for the Embrace SDK that conforms to the OpenTelemetry TracerProvider interface

32 lines (31 loc) 1.33 kB
import { Tracer, Span, SpanOptions, TimeInput, Attributes, SpanStatus } from "@opentelemetry/api"; /** * startView uses the given tracer to create a span that follows Embrace's semantics for representing a view */ declare const startView: (tracer: Tracer, viewName: string) => Span; /** * endAsFailed offers a shortcut for setting the span's status as ERROR and then ending it */ declare const endAsFailed: (span: Span) => void; /** * asParent puts the given span into a context that can then be used as an argument to a tracer's * `startSpan` call, e.g.: `tracer.startSpan("the-child", {}, asParent(parentSpan));` */ declare const asParent: (span: Span) => import("@opentelemetry/api").Context; /** * recordCompletedSpan starts and then immediately stops a span, forwarding on the given options to invocations * of `startSpan`, `addEvent`, `setStatus`, and `end` as appropriate */ type CompletedSpanOptions = SpanOptions & { parent?: Span; events?: { name: string; attributes?: Attributes; timeStamp?: TimeInput; }[]; status?: SpanStatus; endTime?: TimeInput; }; declare const recordCompletedSpan: (tracer: Tracer, name: string, options?: CompletedSpanOptions) => void; export { startView, endAsFailed, asParent, recordCompletedSpan }; export type { CompletedSpanOptions };