Skip to content

fix(instrumentation-runtime-node): fix .isEnabled() #2946

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 2 commits into
base: main
Choose a base branch
from

Conversation

trentm
Copy link
Contributor

@trentm trentm commented Jul 18, 2025

This instrumentation overrides the enable() and disable() methods. However,
it was not calling super for those, so the private '_enabled' state on
the super class was not getting updated, which broke 'instr.isEnable()'.
It would always return false.

example showing isEnabled() not working

> var mod = require('@opentelemetry/instrumentation-runtime-node')
undefined
> var instr = new mod.RuntimeNodeInstrumentation()
undefined
> instr.isEnabled()
false
> instr.enable()
undefined
> instr.isEnabled()
false

That last .isEnabled() result should be true.

This instrumentation overrides the enable() and disable() methods. However,
it was not calling super for those, so the private '_enabled' state on
the super class was not getting updated, which broke 'instr.isEnable()'.
It would always return false.
@trentm trentm self-assigned this Jul 18, 2025
@trentm trentm requested a review from a team as a code owner July 18, 2025 19:17
@github-actions github-actions bot requested a review from d4nyll July 18, 2025 19:17
Copy link

codecov bot commented Jul 18, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.05%. Comparing base (e9987a7) to head (1dcfe4e).

Files with missing lines Patch % Lines
...nstrumentation-runtime-node/src/instrumentation.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2946      +/-   ##
==========================================
- Coverage   89.06%   89.05%   -0.01%     
==========================================
  Files         188      188              
  Lines        9219     9221       +2     
  Branches     1900     1900              
==========================================
+ Hits         8211     8212       +1     
- Misses       1008     1009       +1     
Files with missing lines Coverage Δ
...nstrumentation-runtime-node/src/instrumentation.ts 87.09% <50.00%> (-2.56%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@david-luna
Copy link
Contributor

Hopefully codecov will be improved when #2866. is merged.

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.

4 participants