Hyperlinkv0.8.0-beta.28

Effect

Effect.makeSpanScopedconsteffect/Effect.ts:8280
(name: string, options?: SpanOptionsNoTrace | undefined): Effect<
  Span,
  never,
  Scope
>

Create a new span for tracing, and automatically close it when the Scope finalizes.

Details

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

Example (Creating a scoped standalone span)

import { Effect } from "effect"

const program = Effect.scoped(
  Effect.gen(function*() {
    const span = yield* Effect.makeSpanScoped("scoped-operation")
    yield* Effect.log("Working...")
    return "done"
    // Span automatically closes when scope ends
  })
)
tracing
Source effect/Effect.ts:82804 lines
export const makeSpanScoped: (
  name: string,
  options?: SpanOptionsNoTrace | undefined
) => Effect<Span, never, Scope> = internal.makeSpanScoped