(options: Tracer.SpanOptions | undefined)
| 118 | |
| 119 | /** @internal */ |
| 120 | export const addSpanStackTrace = (options: Tracer.SpanOptions | undefined): Tracer.SpanOptions => { |
| 121 | if (options?.captureStackTrace === false) { |
| 122 | return options |
| 123 | } else if (options?.captureStackTrace !== undefined && typeof options.captureStackTrace !== "boolean") { |
| 124 | return options |
| 125 | } |
| 126 | const limit = getStackTraceLimit() |
| 127 | setStackTraceLimit(3) |
| 128 | const traceError = new Error() |
| 129 | setStackTraceLimit(limit) |
| 130 | let cache: false | string = false |
| 131 | return { |
| 132 | ...options, |
| 133 | captureStackTrace: () => { |
| 134 | if (cache !== false) { |
| 135 | return cache |
| 136 | } |
| 137 | if (traceError.stack !== undefined) { |
| 138 | const stack = traceError.stack.split("\n") |
| 139 | if (stack[3] !== undefined) { |
| 140 | cache = stack[3].trim() |
| 141 | return cache |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | /** @internal */ |
| 149 | export const DisablePropagation = Context.Reference<Tracer.DisablePropagation>()("effect/Tracer/DisablePropagation", { |
nothing calls this directly
no test coverage detected