Skip to main content Link Search Menu Expand Document (external link)

Tracer overview

Added in v2.0.0


Table of contents


constructors

externalSpan

Signature

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

Added in v2.0.0

make

Signature

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

Added in v2.0.0

tracerWith

Signature

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

Added in v2.0.0

models

ExternalSpan (interface)

Signature

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

Added in v2.0.0

ParentSpan (type alias)

Signature

export type ParentSpan = Span | ExternalSpan

Added in v2.0.0

Span (interface)

Signature

export interface Span {
  readonly _tag: "Span"
  readonly name: string
  readonly spanId: string
  readonly traceId: string
  readonly parent: Option.Option<ParentSpan>
  readonly context: Context.Context<never>
  readonly status: SpanStatus
  readonly attributes: ReadonlyMap<string, unknown>
  readonly links: ReadonlyArray<SpanLink>
  readonly sampled: boolean
  end(endTime: bigint, exit: Exit.Exit<unknown, unknown>): void
  attribute(key: string, value: unknown): void
  event(name: string, startTime: bigint, attributes?: Record<string, unknown>): void
}

Added in v2.0.0

Signature

export interface SpanLink {
  readonly _tag: "SpanLink"
  readonly span: ParentSpan
  readonly attributes: Readonly<Record<string, unknown>>
}

Added in v2.0.0

SpanStatus (type alias)

Signature

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

Added in v2.0.0

tags

ParentSpan

Signature

export declare const ParentSpan: Context.Tag<ParentSpan, ParentSpan>

Added in v2.0.0

Tracer

Signature

export declare const Tracer: Context.Tag<Tracer, Tracer>

Added in v2.0.0

utils

Tracer (interface)

Signature

export interface Tracer {
  readonly [TracerTypeId]: TracerTypeId
  span(
    name: string,
    parent: Option.Option<ParentSpan>,
    context: Context.Context<never>,
    links: ReadonlyArray<SpanLink>,
    startTime: bigint
  ): Span
  context<X>(f: () => X, fiber: Fiber.RuntimeFiber<any, any>): X
}

Added in v2.0.0

TracerTypeId

Signature

export declare const TracerTypeId: typeof TracerTypeId

Added in v2.0.0

TracerTypeId (type alias)

Signature

export type TracerTypeId = typeof TracerTypeId

Added in v2.0.0