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

Tracer

18 exports Since v2.0.0 Source

Annotations

Signature

declare const DisablePropagation: Reference<DisablePropagation, boolean>
Since v3.12.0

Signature

interface DisablePropagation {
readonly _: typeof _;
}

Constructors

Signature

declare const externalSpan: (options: {
readonly context?: Context.Context<never>;
readonly sampled?: boolean;
readonly spanId: string;
readonly traceId: string;
}) => ExternalSpan
Since v2.0.0

Signature

declare const make: (options: Omit<Tracer, typeof TracerTypeId>) => Tracer

Signature

declare const tracerWith: <A, E, R>(f: (tracer: Tracer) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>

Models

Since v2.0.0

Signature

type AnySpan = Span | ExternalSpan

ExternalSpan

interface
Since v2.0.0

Signature

interface ExternalSpan {
readonly _tag: "ExternalSpan";
readonly context: Context<never>;
readonly sampled: boolean;
readonly spanId: string;
readonly traceId: string;
}

Span

interface
Since v2.0.0

Signature

interface Span {
readonly _tag: "Span";
readonly attributes: ReadonlyMap<string, unknown>;
readonly context: Context<never>;
readonly kind: SpanKind;
readonly links: readonly Array<SpanLink>;
readonly name: string;
readonly parent: Option<AnySpan>;
readonly sampled: boolean;
readonly spanId: string;
readonly status: SpanStatus;
readonly traceId: string;
addLinks(links: readonly Array<SpanLink>): void;
attribute(key: string, value: unknown): void;
end(endTime: bigint, exit: Exit<unknown, unknown>): void;
event(name: string, startTime: bigint, attributes?: Record<string, unknown>): void;
}
Since v3.1.0

Signature

type SpanKind = "internal" | "server" | "client" | "producer" | "consumer"

SpanOptions

interface
Since v3.1.0

Signature

interface SpanOptions {
readonly attributes?: Record<string, unknown>;
readonly captureStackTrace?: boolean | LazyArg<string | undefined>;
readonly context?: Context<never>;
readonly kind?: SpanKind;
readonly links?: readonly Array<SpanLink>;
readonly parent?: AnySpan;
readonly root?: boolean;
}
Since v2.0.0

Signature

type SpanStatus = {
_tag: "Started";
startTime: bigint;
} | {
_tag: "Ended";
endTime: bigint;
exit: Exit.Exit<unknown, unknown>;
startTime: bigint;
}

Other

Tracer

interface
Since v2.0.0

Signature

interface Tracer {
readonly [TracerTypeId]: typeof TracerTypeId;
context<X>(f: () => X, fiber: RuntimeFiber<any, any>): X;
span(name: string, parent: Option<AnySpan>, context: Context<never>, links: readonly Array<SpanLink>, startTime: bigint, kind: SpanKind, options?: SpanOptions): Span;
}

Signature

declare const TracerTypeId: unique symbol
Since v2.0.0

Signature

type TracerTypeId = typeof TracerTypeId

Tags

Signature

declare const ParentSpan: Tag<ParentSpan, AnySpan>

ParentSpan

interface
Since v2.0.0

Signature

interface ParentSpan {
readonly _: typeof _;
}
Since v2.0.0

Signature

declare const Tracer: Tag<Tracer, Tracer>