effect-io-ai

Package: effect
Module: Effect

Effect.annotateCurrentSpan

Adds an annotation to the current span if available.

Example (Annotating the current span)

import { Effect } from "effect"

const program = Effect.gen(function*() {
  yield* Effect.annotateCurrentSpan("userId", "123")
  yield* Effect.annotateCurrentSpan({
    operation: "user-lookup",
    timestamp: Date.now()
  })
  yield* Effect.log("User lookup completed")
  return "success"
})

const traced = Effect.withSpan(program, "user-operation")

Signature

declare const annotateCurrentSpan: { (key: string, value: unknown): Effect<void>; (values: Record<string, unknown>): Effect<void>; }

Source

Since v2.0.0