Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

Tracer

17 exports Since v1.0.0 Source

Accessors

Get the current OpenTelemetry span.

Works with both the official OpenTelemetry API (via Tracer.layer, NodeSdk.layer, etc.) and the lightweight OTLP module (OtlpTracer.layer).

When using OTLP, the returned span is a wrapper that conforms to the OpenTelemetry Span interface.

Signature

declare const currentOtelSpan: Effect<Otel.Span, NoSuchElementException>

Constructors

Since v1.0.0

Signature

declare const make: Effect<EffectTracer, never, OtelTracer>

Signature

declare const makeExternalSpan: (options: {
readonly spanId: string;
readonly traceFlags?: number;
readonly traceId: string;
readonly traceState?: string | Otel.TraceState;
}) => ExternalSpan

Layers

Since v1.0.0

Signature

declare const layer: Layer<OtelTracer, never, Resource | OtelTracerProvider>

Signature

declare const layerGlobal: Layer<OtelTracer, never, Resource>

Signature

declare const layerGlobalTracer: Layer<OtelTracer, never, Resource>

Signature

declare const layerTracer: Layer<OtelTracer, never, Resource | OtelTracerProvider>

Signature

declare const layerWithoutOtelTracer: Layer<never, never, OtelTracer>

Propagation

Set the effect's parent span from the given opentelemetry SpanContext.

This is handy when you set up OpenTelemetry outside of Effect and want to attach to a parent span.

Signature

declare const withSpanContext: {
(spanContext: SpanContext): <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, Exclude<R, ParentSpan>>;
<A, E, R>(effect: Effect<A, E, R>, spanContext: SpanContext): Effect<A, E, Exclude<R, ParentSpan>>;
}

Tags

Signature

declare const OtelTraceFlags: Tag<OtelTraceFlags, TraceFlags>
Since v1.0.0

Signature

interface OtelTraceFlags {
readonly _: typeof _;
}

Signature

declare const OtelTracer: Tag<OtelTracer, Tracer>

OtelTracer

interface
Since v1.0.0

Signature

interface OtelTracer {
readonly _: typeof _;
}

Signature

declare const OtelTracerProvider: Tag<OtelTracerProvider, TracerProvider>
Since v1.0.0

Signature

interface OtelTracerProvider {
readonly _: typeof _;
}

Signature

declare const OtelTraceState: Tag<OtelTraceState, TraceState>
Since v1.0.0

Signature

interface OtelTraceState {
readonly _: typeof _;
}