Hyperlinkv0.8.0-beta.28

Tracer

Tracer.externalSpanconsteffect/Tracer.ts:447
(options: {
  readonly spanId: string
  readonly traceId: string
  readonly sampled?: boolean | undefined
  readonly annotations?: Context.Context<never> | undefined
}): ExternalSpan

Creates an ExternalSpan from trace and span identifiers, defaulting sampled to true and annotations to an empty context when they are not provided.

Example (Creating an external span)

import { Effect, Tracer } from "effect"

// Create an external span from another tracing system
const span = Tracer.externalSpan({
  spanId: "span-abc-123",
  traceId: "trace-xyz-789",
  sampled: true
})

// Use the external span as a parent
const program = Effect.succeed("Hello").pipe(
  Effect.withSpan("child-operation", { parent: span })
)
constructors
Source effect/Tracer.ts:44714 lines
export const externalSpan = (
  options: {
    readonly spanId: string
    readonly traceId: string
    readonly sampled?: boolean | undefined
    readonly annotations?: Context.Context<never> | undefined
  }
): ExternalSpan => ({
  _tag: "ExternalSpan",
  spanId: options.spanId,
  traceId: options.traceId,
  sampled: options.sampled ?? true,
  annotations: options.annotations ?? Context.empty()
})
Referenced by 2 symbols