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

Tracer overview

Added in v1.0.0


Table of contents


constructors

make

Signature

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

Added in v1.0.0

tracerWith

Signature

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

Added in v1.0.0

models

AttributeValue (type alias)

Signature

export type AttributeValue = string | boolean | number

Added in v1.0.0

ExternalSpan (interface)

Signature

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

Added in v1.0.0

ParentSpan (type alias)

Signature

export type ParentSpan = Span | ExternalSpan

Added in v1.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, AttributeValue>
  readonly links: ReadonlyArray<SpanLink>
  readonly end: (endTime: bigint, exit: Exit.Exit<unknown, unknown>) => void
  readonly attribute: (key: string, value: AttributeValue) => void
  readonly event: (name: string, startTime: bigint, attributes?: Record<string, AttributeValue>) => void
}

Added in v1.0.0

Signature

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

Added in v1.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 v1.0.0

tags

Tracer

Signature

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

Added in v1.0.0

utils

Tracer (interface)

Signature

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

Added in v1.0.0

TracerTypeId

Signature

export declare const TracerTypeId: typeof TracerTypeId

Added in v1.0.0

TracerTypeId (type alias)

Signature

export type TracerTypeId = typeof TracerTypeId

Added in v1.0.0