effect-io-ai

Package: effect
Module: Effect

Effect.useSpan

Create a new span for tracing, and automatically close it when the effect completes.

Details

The span is not added to the current span stack, so no child spans will be created for it.

Example (Running an effect with a standalone span)

import { Effect } from "effect"

const program = Effect.useSpan(
  "user-operation",
  (span) =>
    Effect.gen(function*() {
      yield* Effect.log("Processing user data")
      return "success"
    })
)

Signature

declare const useSpan: { <A, E, R>(name: string, evaluate: (span: Span) => Effect<A, E, R>): Effect<A, E, R>; <A, E, R>(name: string, options: SpanOptionsNoTrace, evaluate: (span: Span) => Effect<A, E, R>): Effect<A, E, R>; }

Source

Since v2.0.0