(span: Span | null, callback: (scope: Scope) => T)
| 259 | * @returns the value returned from the provided callback function. |
| 260 | */ |
| 261 | export function withActiveSpan<T>(span: Span | null, callback: (scope: Scope) => T): T { |
| 262 | const acs = getAcs(); |
| 263 | if (acs.withActiveSpan) { |
| 264 | return acs.withActiveSpan(span, callback); |
| 265 | } |
| 266 | |
| 267 | return withScope(scope => { |
| 268 | _setSpanForScope(scope, span || undefined); |
| 269 | return callback(scope); |
| 270 | }); |
| 271 | } |
| 272 | |
| 273 | /** Suppress tracing in the given callback, ensuring no spans are generated inside of it. */ |
| 274 | export function suppressTracing<T>(callback: () => T): T { |
no test coverage detected