Skip to content

Commit e34f867

Browse files
authored
feat(otel): support diagnostics debugging (renovatebot#41362)
1 parent 388e4f1 commit e34f867

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docs/usage/opentelemetry.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ Renovate does not currently support logging in an OTLP format.
8484
To help you debug, you can print the telemetry to the console.
8585
Use the environment variable `RENOVATE_TRACING_CONSOLE_EXPORTER`.
8686

87+
You can also set `OTEL_LOG_LEVEL` to control the log level of OpenTelemetry's internal [diagnostics](https://opentelemetry.io/docs/languages/js/getting-started/nodejs/#troubleshooting), which can be helpful for debugging.
88+
8789
## Help wanted
8890

8991
We're continually looking to improve Renovate's instrumentation, and are aware there may be gaps in instrumentation.

lib/instrumentation/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ export function init(): void {
6060
return;
6161
}
6262

63+
// v8 ignore if -- TODO add tests
64+
if (process.env.OTEL_LOG_LEVEL) {
65+
api.diag.setLogger(
66+
new api.DiagConsoleLogger(),
67+
api.DiagLogLevel[
68+
process.env.OTEL_LOG_LEVEL.toUpperCase() as keyof typeof api.DiagLogLevel
69+
],
70+
);
71+
}
72+
6373
const spanProcessors: SpanProcessor[] = [];
6474
// add processors
6575
if (isTraceDebuggingEnabled()) {

0 commit comments

Comments
 (0)