effect-io-ai

Package: effect
Module: Effect

Effect.fiberId

Accesses the current fiber id executing the effect.

Example (Accessing the current fiber id)

import { Effect } from "effect"

const program = Effect.log("event").pipe(
  // Read the current span with the fiber id for tagging.
  Effect.andThen(Effect.all([Effect.currentSpan, Effect.fiberId])),
  Effect.withSpan("A"),
  Effect.map(([span, fiberId]) => ({
    spanName: span.name,
    fiberId
  }))
)

Signature

declare const fiberId: Effect<number, never, never>

Source

Since v2.0.0