Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/usage/opentelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ Renovate does not currently support logging in an OTLP format.
To help you debug, you can print the telemetry to the console.
Use the environment variable `RENOVATE_TRACING_CONSOLE_EXPORTER`.

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.

## Help wanted

We're continually looking to improve Renovate's instrumentation, and are aware there may be gaps in instrumentation.
Expand Down
10 changes: 10 additions & 0 deletions lib/instrumentation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ export function init(): void {
return;
}

// v8 ignore if -- TODO add tests
if (process.env.OTEL_LOG_LEVEL) {
api.diag.setLogger(
new api.DiagConsoleLogger(),
api.DiagLogLevel[
process.env.OTEL_LOG_LEVEL.toUpperCase() as keyof typeof api.DiagLogLevel
],
);
}

const spanProcessors: SpanProcessor[] = [];
// add processors
if (isTraceDebuggingEnabled()) {
Expand Down