effect-io-ai

Package: effect
Module: Effect

Effect.withSpanScoped

Wraps the effect with a scoped child span for tracing.

Details

The span is ended when the Scope is finalized.

Example (Creating a scoped child span)

import { Effect } from "effect"

const program = Effect.scoped(
  Effect.gen(function*() {
    const task = Effect.log("Working...")
    yield* Effect.withSpanScoped(task, "scoped-task")
    return "completed"
  })
)

Signature

declare const withSpanScoped: { (name: string, options?: SpanOptions): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, ParentSpan> | Scope>; <A, E, R>(self: Effect<A, E, R>, name: string, options?: SpanOptions): Effect<A, E, Exclude<R, ParentSpan> | Scope>; }

Source

Since v2.0.0