Hyperlinkv0.8.0-beta.28

Effect

Effect.annotateCurrentSpanconsteffect/Effect.ts:8036
(key: string, value: unknown): Effect<void>
(values: Record<string, unknown>): Effect<void>

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")
tracing
Source effect/Effect.ts:80364 lines
export const annotateCurrentSpan: {
  (key: string, value: unknown): Effect<void>
  (values: Record<string, unknown>): Effect<void>
} = internal.annotateCurrentSpan