Skip to content

Commit aa450a6

Browse files
committed
always ensure valid values for exportIntervalMillis and exportTimeoutMillis.
1 parent 82a6a23 commit aa450a6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/core/src/v3/otel/tracingSDK.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,15 @@ export class TracingSDK {
301301
const bufferingExporter = new BufferingMetricExporter(rawMetricExporter, exportIntervalMs);
302302
const metricExporter = new TaskContextMetricExporter(bufferingExporter);
303303

304+
const exportTimeoutMillis = parseInt(
305+
getEnvVar("TRIGGER_OTEL_METRICS_EXPORT_TIMEOUT_MILLIS") ?? "30000"
306+
);
307+
304308
const metricReaders: MetricReader[] = [
305309
new PeriodicExportingMetricReader({
306310
exporter: metricExporter,
307-
exportIntervalMillis: collectionIntervalMs,
308-
exportTimeoutMillis: parseInt(
309-
getEnvVar("TRIGGER_OTEL_METRICS_EXPORT_TIMEOUT_MILLIS") ?? "30000"
310-
),
311+
exportIntervalMillis: Math.max(collectionIntervalMs, exportTimeoutMillis),
312+
exportTimeoutMillis,
311313
}),
312314
...(config.metricReaders ?? []),
313315
];

0 commit comments

Comments
 (0)