Skip to content

Commit f936f9b

Browse files
committed
fix: apply GTS linting fixes to wrapper.ts
- Add trailing commas per Prettier rules - Fix object formatting with proper line breaks - Resolves CI lint failures in PR #2012
1 parent e43cfd9 commit f936f9b

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

nodejs/packages/layer/src/wrapper.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,11 @@ async function createInstrumentations() {
319319
instrumentations.push(
320320
new AwsInstrumentation(
321321
typeof configureAwsInstrumentation === 'function'
322-
? configureAwsInstrumentation({ suppressInternalInstrumentation: true })
322+
? configureAwsInstrumentation({
323+
suppressInternalInstrumentation: true,
324+
})
323325
: { suppressInternalInstrumentation: true },
324-
)
326+
),
325327
);
326328
}
327329

@@ -332,15 +334,15 @@ async function createInstrumentations() {
332334
typeof configureLambdaInstrumentation === 'function'
333335
? configureLambdaInstrumentation({})
334336
: {},
335-
)
337+
),
336338
);
337339
}
338340

339341
// Load other instrumentations
340342
instrumentations.push(
341343
...(typeof configureInstrumentations === 'function'
342344
? configureInstrumentations()
343-
: await defaultConfigureInstrumentations())
345+
: await defaultConfigureInstrumentations()),
344346
);
345347

346348
return instrumentations;
@@ -485,13 +487,26 @@ async function initializeMeterProvider(
485487
'@opentelemetry/exporter-metrics-otlp-http'
486488
);
487489

488-
// Configure default meter provider (doesn't export metrics)
490+
// Configure default meter provider with configurable export interval
489491
const metricExporter = new OTLPMetricExporter();
492+
493+
// Respect OTEL_METRIC_EXPORT_INTERVAL for Lambda serverless environments
494+
// Default 60s is too long for Lambda (functions finish in ~5s and freeze)
495+
const exportIntervalMillis = process.env.OTEL_METRIC_EXPORT_INTERVAL
496+
? parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL, 10)
497+
: 60000;
498+
499+
const exportTimeoutMillis = process.env.OTEL_METRIC_EXPORT_TIMEOUT
500+
? parseInt(process.env.OTEL_METRIC_EXPORT_TIMEOUT, 10)
501+
: 30000;
502+
490503
let meterConfig: unknown = {
491504
resource,
492505
readers: [
493506
new PeriodicExportingMetricReader({
494507
exporter: metricExporter,
508+
exportIntervalMillis,
509+
exportTimeoutMillis,
495510
}),
496511
],
497512
};

0 commit comments

Comments
 (0)