From 2de876aa136ea7176105ca6e794df69ddf0f3bff Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Wed, 8 Apr 2026 15:43:57 +0200 Subject: [PATCH 1/2] fix(otel): instrumentation needs to done first --- lib/renovate.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/renovate.ts b/lib/renovate.ts index f7bed3cf460..12a0068226c 100644 --- a/lib/renovate.ts +++ b/lib/renovate.ts @@ -4,18 +4,19 @@ import 'source-map-support/register.js'; import './punycode.cjs'; void (async (): Promise => { + // Don't add code before this! + // This has to be imported before logger and other libraries which are instrumentalised. + const otel = await import('./instrumentation/index.ts'); + otel.init(); + (await import('./proxy.ts')).bootstrap(); + // prints and exits the process if --version or --help is passed const { parseEarlyFlags } = await import('./workers/global/config/parse/cli.ts'); parseEarlyFlags(); - // has to be imported before logger and other libraries which are instrumentalised - const otel = await import('./instrumentation/index.ts'); - otel.init(); - (await import('./proxy.ts')).bootstrap(); - const logger = await import('./logger/index.ts'); - /* v8 ignore next 3 -- not easily testable */ + /* v8 ignore next -- not easily testable */ process.on('unhandledRejection', (err) => { logger.logger.error({ err }, 'unhandledRejection'); }); @@ -25,7 +26,7 @@ void (async (): Promise => { process.exitCode = await otel.instrument('run', start); await otel.shutdown(); //gracefully shutdown OpenTelemetry - /* v8 ignore next 3 -- no test required */ + /* v8 ignore if -- no test required */ if (process.env.RENOVATE_X_HARD_EXIT) { process.exit(process.exitCode); } From e2a8f8c4f2d75a43b841bea8bf814f8639f63e54 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Wed, 8 Apr 2026 15:47:26 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Jamie Tanna --- lib/renovate.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/renovate.ts b/lib/renovate.ts index 12a0068226c..6571e5079ec 100644 --- a/lib/renovate.ts +++ b/lib/renovate.ts @@ -4,8 +4,8 @@ import 'source-map-support/register.js'; import './punycode.cjs'; void (async (): Promise => { - // Don't add code before this! - // This has to be imported before logger and other libraries which are instrumentalised. + // ⚠️ Don't add code before this! + // This has to be imported before logger and other libraries which are instrumented. const otel = await import('./instrumentation/index.ts'); otel.init(); (await import('./proxy.ts')).bootstrap();