Package: effect
Module: Effect
Returns the tracing span annotations currently carried in the effect context.
Details
These annotations are applied to spans created inside the context, such as
spans created by withSpan, useSpan, or makeSpan.
Example (Providing span annotations)
import { Effect } from "effect"
const program = Effect.gen(function*() {
// Add some annotations to the current span
yield* Effect.annotateCurrentSpan("userId", "123")
yield* Effect.annotateCurrentSpan("operation", "data-processing")
// Retrieve all annotations
const annotations = yield* Effect.spanAnnotations
console.log("Current span annotations:", annotations)
return annotations
})
Effect.runPromise(program).then(console.log)
// Output: Current span annotations: { userId: "123", operation: "data-processing" }
Signature
declare const spanAnnotations: Effect<Readonly<Record<string, unknown>>, never, never>
Since v2.0.0