effect-io-ai

Package: effect
Module: Effect

Effect.currentSpan

Returns the currently active local tracing span.

Details

The effect fails with NoSuchElementError when there is no active local Span.

Example (Reading the current span)

import { Effect } from "effect"

const program = Effect.gen(function*() {
  const span = yield* Effect.currentSpan
  yield* Effect.log(`Current span: ${span}`)
  return "done"
})

const traced = Effect.withSpan(program, "my-span")

Signature

declare const currentSpan: Effect<Span, Cause.NoSuchElementError, never>

Source

Since v2.0.0