import { JaegerExporter } from '@opentelemetry/exporter-jaeger' ; import { NodeTracerProvider , NodeTracerConfig , } from '@opentelemetry/sdk-trace-node' ; import { InMemorySpanExporter , SimpleSpanProcessor , } from '@opentelemetry/sdk-trace-base' ; import { getTestMemoryExporter , setTestMemoryExporter , } from './otel-provider-api' ; export const registerInstrumentationTestingProvider = ( config ? ) : NodeTracerProvider => { const otelTestingProvider = new NodeTracerProvider ( config ) ; setTestMemoryExporter ( new InMemorySpanExporter ( ) ) ; otelTestingProvider . addSpanProcessor ( new SimpleSpanProcessor ( getTestMemoryExporter ( ) ! ) ) ; if ( process . env . OTEL_EXPORTER_JAEGER_AGENT_HOST ) { otelTestingProvider . addSpanProcessor ( new SimpleSpanProcessor ( new JaegerExporter ( ) ) ) ; } otelTestingProvider . register ( ) ; return otelTestingProvider ; } ;