Skip to content

fix: Enable disabling OTEL#14

Merged
phvalguima merged 1 commit intomainfrom
silence_otel
Mar 11, 2026
Merged

fix: Enable disabling OTEL#14
phvalguima merged 1 commit intomainfrom
silence_otel

Conversation

@frac
Copy link
Copy Markdown
Collaborator

@frac frac commented Mar 11, 2026

Problem:
When the otel collector is off the output of it goes into the console out. This makes harder to debug other parts as it is very noisy

Solution
This pull request introduces a mechanism to conditionally disable OpenTelemetry (OTel) instrumentation based on an environment variable. The main change is the addition of a utility function that disables OTel features if requested, and its invocation at application startup.

OpenTelemetry disablement:

  • Added a new function disableOtelIfRequested in src/lib/otel.ts that disables tracing, metrics, and diagnostic logging when the OTEL_DISABLED environment variable is set to "true" or "1".
  • Invoked disableOtelIfRequested at the top of src/index.ts to ensure OTel is disabled before the server starts, if requested.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 11, 2026

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a startup hook to optionally disable OpenTelemetry (OTel) tracing/metrics/diagnostic logging via an environment variable, to reduce noisy console output when an OTel collector isn’t available.

Changes:

  • Added disableOtelIfRequested() helper to disable tracing, metrics, and OTel diag logging when OTEL_DISABLED is set.
  • Invoked the helper from the application entrypoint at startup.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/lib/otel.ts Introduces env-controlled OTel disablement helper (trace/metrics disable + diag logger suppression).
src/index.ts Calls the helper during startup to attempt to disable OTel before server initialization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@phvalguima phvalguima merged commit 5290006 into main Mar 11, 2026
9 checks passed
@phvalguima phvalguima deleted the silence_otel branch March 11, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants