Skip to content
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

refactor(instr-undici): avoid use of deprecated APIs for diagnostic channels #2457

Merged

Conversation

david-luna
Copy link
Contributor

Which problem is this PR solving?

undici instrumentation is used deprecated APIs to subscribe to and unsubscribe from diagnostic channels. Eventually these APIs will be removed and the instrumentation won't work with newer versions of Node.js. I've considered to classify it as a fix but the deprecated APIs are still present so I think refactor is better.

Short description of the changes

  • use new diagnostics_channel.subscribe(name, handler) and diagnostics_channel.unsubscribe(name, handler) APIs if available and fallback to diagnostics_channel.channel(name) if not

NOTE: this PR supersedes #2407

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.07%. Comparing base (dfb2dff) to head (ffa450a).
Report is 254 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2457      +/-   ##
==========================================
+ Coverage   90.97%   97.07%   +6.09%     
==========================================
  Files         146        8     -138     
  Lines        7492      410    -7082     
  Branches     1502       67    -1435     
==========================================
- Hits         6816      398    -6418     
+ Misses        676       12     -664     

see 138 files with indirect coverage changes

@david-luna david-luna changed the title reafactor(instr-undici): avoid use of deprecated APIs for diagnostic channels refactor(instr-undici): avoid use of deprecated APIs for diagnostic channels Sep 30, 2024
plugins/node/instrumentation-undici/src/internal-types.ts Outdated Show resolved Hide resolved
plugins/node/instrumentation-undici/src/undici.ts Outdated Show resolved Hide resolved
plugins/node/instrumentation-undici/src/undici.ts Outdated Show resolved Hide resolved
plugins/node/instrumentation-undici/src/undici.ts Outdated Show resolved Hide resolved
plugins/node/instrumentation-undici/src/undici.ts Outdated Show resolved Hide resolved
@david-luna david-luna requested a review from trentm October 4, 2024 11:28
@david-luna
Copy link
Contributor Author

@trentm thanks for the review. I've applied your suggestions myself so it's only necessary your approval (not sure of the approve settings in this repo)

@david-luna david-luna merged commit 23aae01 into open-telemetry:main Oct 9, 2024
15 checks passed
@david-luna david-luna deleted the dluna/undici-diag-channel-fix branch October 9, 2024 16:18
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.

2 participants