Skip to content

Tracer

18 exports Added in v2.0.0 Source

Annotations

Signature

declare const DisablePropagation: Reference<DisablePropagation, boolean>;

DisablePropagation interface

Added in v3.12.0 Source

Signature

interface DisablePropagation {
  readonly _: typeof _;
}

Constructors

externalSpan

Added in v2.0.0 Source

Signature

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

make

Added in v2.0.0 Source

Signature

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

tracerWith

Added in v2.0.0 Source

Signature

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

Models

AnySpan type

Added in v2.0.0 Source

Signature

type AnySpan = Span | ExternalSpan;

ExternalSpan interface

Added in v2.0.0 Source

Signature

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

Span interface

Added in v2.0.0 Source

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;
}

SpanKind type

Added in v3.1.0 Source

Signature

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

SpanOptions interface

Added in v3.1.0 Source

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;
}

SpanStatus type

Added in v2.0.0 Source

Signature

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

Other

Tracer interface

Added in v2.0.0 Source

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;
}

TracerTypeId

Added in v2.0.0 Source

Signature

declare const TracerTypeId: unique symbol;

TracerTypeId type

Added in v2.0.0 Source

Signature

type TracerTypeId = typeof TracerTypeId;

Tags

ParentSpan

Added in v2.0.0 Source

Signature

declare const ParentSpan: Tag<ParentSpan, AnySpan>;

ParentSpan interface

Added in v2.0.0 Source

Signature

interface ParentSpan {
  readonly _: typeof _;
}

Tracer

Added in v2.0.0 Source

Signature

declare const Tracer: Tag<Tracer, Tracer>;