()
| 44 | } |
| 45 | |
| 46 | export function getSpanProcessor(): SentrySpanProcessor | undefined { |
| 47 | const client = getClient<NodeClient>(); |
| 48 | if (!client?.traceProvider) { |
| 49 | return undefined; |
| 50 | } |
| 51 | |
| 52 | const provider = getProvider(client.traceProvider); |
| 53 | if (!provider) { |
| 54 | return undefined; |
| 55 | } |
| 56 | |
| 57 | // Access the span processors from the provider via _activeSpanProcessor |
| 58 | const multiSpanProcessor = provider?.['_activeSpanProcessor'] as |
| 59 | | (SpanProcessor & { _spanProcessors?: SpanProcessor[] }) |
| 60 | | undefined; |
| 61 | |
| 62 | const spanProcessor = multiSpanProcessor?.['_spanProcessors']?.find( |
| 63 | (spanProcessor: SpanProcessor) => spanProcessor instanceof SentrySpanProcessor, |
| 64 | ); |
| 65 | |
| 66 | return spanProcessor; |
| 67 | } |
| 68 | |
| 69 | export function getProvider(_provider?: BasicTracerProvider): BasicTracerProvider | undefined { |
| 70 | let provider = _provider || getClient<NodeClient>()?.traceProvider || trace.getTracerProvider(); |
no test coverage detected