@@ -1372,6 +1372,17 @@ export const withRuntimeFlags = dual<
1372
1372
return effect
1373
1373
} )
1374
1374
1375
+ /** @internal */
1376
+ export const withTracerEnabled = dual <
1377
+ ( enabled : boolean ) => < A , E , R > ( effect : Effect . Effect < A , E , R > ) => Effect . Effect < A , E , R > ,
1378
+ < A , E , R > ( effect : Effect . Effect < A , E , R > , enabled : boolean ) => Effect . Effect < A , E , R >
1379
+ > ( 2 , ( effect , enabled ) =>
1380
+ fiberRefLocally (
1381
+ effect ,
1382
+ currentTracerEnabled ,
1383
+ enabled
1384
+ ) )
1385
+
1375
1386
/** @internal */
1376
1387
export const withTracerTiming = dual <
1377
1388
( enabled : boolean ) => < A , E , R > ( effect : Effect . Effect < A , E , R > ) => Effect . Effect < A , E , R > ,
@@ -2015,6 +2026,12 @@ export const currentInterruptedCause: FiberRef.FiberRef<Cause.Cause<never>> = gl
2015
2026
} )
2016
2027
)
2017
2028
2029
+ /** @internal */
2030
+ export const currentTracerEnabled : FiberRef . FiberRef < boolean > = globalValue (
2031
+ Symbol . for ( "effect/FiberRef/currentTracerEnabled" ) ,
2032
+ ( ) => fiberRefUnsafeMake ( true )
2033
+ )
2034
+
2018
2035
/** @internal */
2019
2036
export const currentTracerTimingEnabled : FiberRef . FiberRef < boolean > = globalValue (
2020
2037
Symbol . for ( "effect/FiberRef/currentTracerTiming" ) ,
@@ -3073,3 +3090,25 @@ export const currentSpanFromFiber = <A, E>(fiber: Fiber.RuntimeFiber<A, E>): Opt
3073
3090
| undefined
3074
3091
return span !== undefined && span . _tag === "Span" ? Option . some ( span ) : Option . none ( )
3075
3092
}
3093
+
3094
+ /** @internal */
3095
+ export const noopSpan : Tracer . Span = globalValue ( "effect/Tracer/noopSpan" , ( ) => ( {
3096
+ _tag : "Span" ,
3097
+ spanId : "noop" ,
3098
+ traceId : "noop" ,
3099
+ name : "noop" ,
3100
+ sampled : false ,
3101
+ parent : Option . none ( ) ,
3102
+ context : Context . empty ( ) ,
3103
+ status : {
3104
+ _tag : "Ended" ,
3105
+ startTime : BigInt ( 0 ) ,
3106
+ endTime : BigInt ( 0 ) ,
3107
+ exit : exitUnit
3108
+ } ,
3109
+ attributes : new Map ( ) ,
3110
+ links : [ ] ,
3111
+ attribute ( ) { } ,
3112
+ event ( ) { } ,
3113
+ end ( ) { }
3114
+ } ) )
0 commit comments