Skip to content

Commit

Permalink
fix: set BSP interval to 500ms (signalfx#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
seemk authored and rauno56 committed Jul 18, 2022
1 parent 681cfb2 commit 14325b1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/tracing/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,21 @@ const SpanExporterMap: Record<string, SpanExporterFactory> = {
'otlp-grpc': otlpSpanExporterFactory,
};

// Temporary workaround until https://github.com/open-telemetry/opentelemetry-js/issues/3094 is resolved
function getBatchSpanProcessorConfig() {
// OTel uses its own parsed environment, we can just use the default env if the BSP delay is unset.
if (process.env.OTEL_BSP_SCHEDULE_DELAY !== undefined) {
return undefined;
}

return { scheduledDelayMillis: 500 };
}

export function defaultSpanProcessorFactory(options: Options): SpanProcessor {
return new SplunkBatchSpanProcessor(options.spanExporterFactory(options));
return new SplunkBatchSpanProcessor(
options.spanExporterFactory(options),
getBatchSpanProcessorConfig()
);
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down

0 comments on commit 14325b1

Please sign in to comment.