@embrace-io/react-native-tracer-provider
Version:
A React Native for the Embrace SDK that conforms to the OpenTelemetry TracerProvider interface
43 lines (42 loc) • 2.07 kB
TypeScript
import { Link } from "@opentelemetry/api/build/src/trace/link";
import { Attributes, AttributeValue, Exception, Span, SpanContext, SpanStatus, TimeInput } from "@opentelemetry/api";
import { SpanContextSyncBehaviour } from "./types";
declare class EmbraceNativeSpan implements Span {
private readonly tracerName;
private readonly tracerVersion;
private readonly tracerSchemaUrl;
private readonly createdIndex;
private readonly spanContextSyncBehaviour;
private recording;
private savedSpanContext;
private creating;
constructor(tracerName: string, tracerVersion: string, tracerSchemaUrl: string, spanContextSyncBehaviour: SpanContextSyncBehaviour);
nativeID(): string;
creatingNativeSide(creating: Promise<SpanContext>): void;
isReadonly(): boolean;
/**
* The fact that native module calls are asynchronous and the @opentelemetry/api is synchronous doesn't matter for
* most methods as they are generally fire and forget. Getting spanContext is an exception since this could be asked
* for immediately after having started a span and if the value is not yet ready on the native side we will either:
* - return a blank span context
* - throw an error
*
* Behaviour can be configured on the EmbraceNativeTracerProvider by supplying spanContextSyncBehaviour
*/
spanContext(): SpanContext;
/**
* spanContextAsync provides an async alternative to spanContext by wrapping the response in a promise
*/
spanContextAsync(): Promise<SpanContext>;
setAttribute(key: string, value: AttributeValue): this;
setAttributes(attributes: Attributes): this;
addEvent(name: string, attributesOrStartTime?: Attributes | TimeInput, timeStamp?: TimeInput): this;
addLink(link: Link): this;
addLinks(links: Link[]): this;
setStatus(status: SpanStatus): this;
updateName(name: string): this;
end(endTime?: TimeInput): void;
isRecording(): boolean;
recordException(exception: Exception, time?: TimeInput): void;
}
export { EmbraceNativeSpan };