Skip to content

Commit c7d1a91

Browse files
Use SimpleSpanProcessor for non-prod environment
1 parent 914a16d commit c7d1a91

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
detectResources,
88
processDetector,
99
} from '@opentelemetry/resources';
10-
import { BatchSpanProcessor, SpanExporter } from '@opentelemetry/tracing';
10+
import { BatchSpanProcessor, SimpleSpanProcessor, SpanExporter } from '@opentelemetry/tracing';
1111
import { JaegerExporter } from '@opentelemetry/exporter-jaeger';
1212
import { ZipkinExporter } from '@opentelemetry/exporter-zipkin';
1313
import debug from 'debug';
@@ -64,7 +64,8 @@ export class OpenTelemetryConfigurator {
6464
this.traceProvider = new NodeTracerProvider(this.nodeTracerConfig);
6565

6666
if (this.traceExporter) {
67-
this.traceProvider.addSpanProcessor(new BatchSpanProcessor(this.traceExporter));
67+
const SpanProcessor = process.env.NODE_ENV === 'production' ? BatchSpanProcessor : SimpleSpanProcessor;
68+
this.traceProvider.addSpanProcessor(new SpanProcessor(this.traceExporter));
6869
}
6970

7071
this.traceProvider.register();

0 commit comments

Comments
 (0)