UNPKG

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

Version:

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

27 lines (26 loc) 1.72 kB
import { Context, ContextManager, Span, SpanOptions, Tracer } from "@opentelemetry/api"; import { SpanContextSyncBehaviour } from "./types"; /** * EmbraceNativeTracer implements a Tracer over the native Embrace Android and iOS SDKs. * * Communication with the native modules is asynchronous while the @opentelemetry/api interfaces are synchronous so spans * are returned immediately as simple objects that contain an ID for further communication with the native side. * * Since the notion of active context differs on the native side this tracer has its own context manager to handle the * active context on the JS side which can optionally be configured as the global context manager. * * The JS side of this implementation is modelled after [opentelemetry-sdk-trace-base](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-base) */ declare class EmbraceNativeTracer implements Tracer { private readonly name; private readonly version; private readonly schemaUrl; private readonly contextManager; private readonly spanContextSyncBehaviour; constructor(contextManager: ContextManager, spanContextSyncBehaviour: SpanContextSyncBehaviour, name: string, version: string, schemaUrl: string); startSpan(name: string, options?: SpanOptions, context?: Context): Span; startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>; startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, opts: SpanOptions, fn: F): ReturnType<F>; startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, opts: SpanOptions, ctx: Context, fn: F): ReturnType<F>; } export { EmbraceNativeTracer };