Hyperlinkv0.8.0-beta.28

Effect

Effect.withTracerEnabledconsteffect/Effect.ts:7938
(enabled: boolean): <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, R>
<A, E, R>(effect: Effect<A, E, R>, enabled: boolean): Effect<A, E, R>

Enables or disables tracing for spans created by the given effect.

Details

When enabled is false, spans created inside the effect are not registered with the current tracer and do not propagate as normal trace parents.

Example (Enabling or disabling tracing)

import { Effect } from "effect"

Effect.succeed(42).pipe(
  Effect.withSpan("my-span"),
  // the span will not be registered with the tracer
  Effect.withTracerEnabled(false)
)
tracing
Source effect/Effect.ts:79384 lines
export const withTracerEnabled: {
  (enabled: boolean): <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, R>
  <A, E, R>(effect: Effect<A, E, R>, enabled: boolean): Effect<A, E, R>
} = internal.withTracerEnabled