Skip to content

fix: enable programmatic config when environment variables are unset #2947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

YangJonghun
Copy link

Which problem is this PR solving?

  • Currently, when OTEL_NODE_ENABLED_INSTRUMENTATIONS is not set, users cannot enable default-excluded instrumentations (like fs) through programmatic configuration.
  • Fixes the issue where getNodeAutoInstrumentations({"@opentelemetry/instrumentation-fs": {enabled: true}}) didn't work when environment variables were not configured.

Short description of the changes

  • Establish clear configuration precedence: Environment variables > programmatic config
  • Fix fs instrumentation enabling: When env vars are unset, allow programmatic config to override default exclusions
  • Follow documented precedence: OTEL_NODE_DISABLED_INSTRUMENTATIONS overrides OTEL_NODE_ENABLED_INSTRUMENTATIONS when both are set, ensuring disabled instrumentations take absolute priority

Configuration Priority (after changes):

  1. OTEL_NODE_DISABLED_INSTRUMENTATIONS - absolute priority
  2. OTEL_NODE_ENABLED_INSTRUMENTATIONS - when set, only enable listed instrumentations
  3. Programmatic config (userConfig.enabled) - when env vars are unset
  4. Default behavior - exclude defaultExcludedInstrumentations unless explicitly enabled

@YangJonghun YangJonghun requested a review from a team as a code owner July 19, 2025 07:03
@YangJonghun YangJonghun changed the title Fix/instrumentation config priority fix(auto-instrumentations-node): enable programmatic config when environment variables are unset Jul 19, 2025
@YangJonghun YangJonghun changed the title fix(auto-instrumentations-node): enable programmatic config when environment variables are unset fix: enable programmatic config when environment variables are unset Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants