Get the context from a span.
The span to get the context from
Get the current session information.
Get the OpenTelemetry LDTracer backing this SDK.
Returns a standard OpenTelemetry Tracer (startSpan,
startActiveSpan) plus LDTracer.withSpan for async-safe nested
spans in React Native. Use this to follow the official OpenTelemetry JS
documentation or integrate a third-party library that expects a Tracer.
The tracer is wired to the same exporter/sampler as the rest of the SDK.
Before the SDK finishes initializing (or when disableTraces is set) this
returns a no-op tracer, so it is always safe to call. disableTraces affects
only public custom tracing APIs; SDK auto-instrumentation is unaffected.
Check if the observability client is initialized.
Parse headers to extract request context.
The headers to parse
Record an error with optional context.
The error to record
Optionalattributes: AttributesOptional additionalattributes
Optionaloptions: { span: Span }Optional span options
Record a log message.
The log message
The log level
Optionalattributes: AttributesOptional additional attributes
Record an up/down counter metric.
The up/down counter metric to record
Run a function with header context.
The span name
The headers
The callback function
Optionaloptions: SpanOptionsOptional span options
Start a new span without making it active.
The span name
Optionaloptions: SpanOptionsOptional span options
Optionalctx: ContextStart a span with header context.
The span name
The headers
Optionaloptions: SpanOptionsOptional span options
Stop the observability client.
Record a custom track event as a track span.
Mirrors the iOS and Android LDObserve.track(...) API (and LDClient.track):
emits a span named track carrying the event key, an optional numeric
value for LaunchDarkly numeric custom metrics, and any properties as
additional span attributes.
properties is a plain dictionary (like the native [String: Any] /
Map<String, Any?> surfaces): nested objects are flattened with
dot-separated keys (e.g. user.id), arrays of objects with indexed dotted
keys (e.g. products.0.price), and homogeneous scalar arrays become array
attributes. null / undefined values are skipped.
The key for the event.
Optionalproperties: TrackPropertiesOptional data associated with the event; flattened and attached as span attributes.
OptionalmetricValue: numberOptional numeric value used by LaunchDarkly experimentation for numeric custom metrics.
Start a span, run fn within it, and end the span automatically.
This is an ergonomic wrapper over startSpan designed for React
Native, where the active context is tracked only synchronously and is lost
across each await. The SpanScope passed to fn exposes a
SpanScope.child method that parents child spans off the captured
context, so the hierarchy is preserved across awaits and even under
concurrent (Promise.all) work — without manually threading context.
The span's status is set to OK on success, or ERROR (with the error
recorded) if fn throws or returns a rejecting promise. If fn returns a
promise, the span ends when it settles and the promise is returned.
The span name
The callback to run within the span's scope
Optionaloptions: WithSpanOptionsOptional span options, including an explicit parent
Flush all pending telemetry data.