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

feat: Added instrumentation for fetch. #1776

Merged
merged 2 commits into from
Sep 7, 2023
Merged

Conversation

bizob2828
Copy link
Member

@bizob2828 bizob2828 commented Sep 1, 2023

Description

This moves the registering of undici instrumentation to the core functions. Since this just subscribes to events on the diagnostic channel it doesn't need to get keyed off of when undici is required. You can see in the refactor I changed from doing dc.channel('name').subscribe(<hoook>) in the export to creating channel and saving reference. Then subscribing separately. This suggestion is detailed out here which was fixed in Node.js core here.

Note: I tried updating to do diagnosticsChannel.subscribe(<name>, <hook>) which worked great but caused slowness in tearing down some versioned test suites only in Node 20. Long term this is the ideal approach to subscribing but we'll need to triage this at a later date

Links

Closes #1773

@mrickard mrickard self-assigned this Sep 1, 2023
@codecov
Copy link

codecov bot commented Sep 6, 2023

Codecov Report

Merging #1776 (bb71c58) into main (683b254) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1776   +/-   ##
=======================================
  Coverage   96.83%   96.84%           
=======================================
  Files         198      198           
  Lines       38734    38755   +21     
=======================================
+ Hits        37510    37531   +21     
  Misses       1224     1224           
Flag Coverage Δ
integration-tests-16.x 78.85% <91.42%> (-0.20%) ⬇️
integration-tests-18.x 79.13% <100.00%> (+0.07%) ⬆️
integration-tests-20.x 79.14% <100.00%> (+0.07%) ⬆️
unit-tests-16.x 91.40% <100.00%> (+<0.01%) ⬆️
unit-tests-18.x 91.38% <100.00%> (+<0.01%) ⬆️
unit-tests-20.x 91.38% <100.00%> (+<0.01%) ⬆️
versioned-tests-16.x 75.57% <100.00%> (-0.04%) ⬇️
versioned-tests-18.x 75.57% <100.00%> (-0.03%) ⬇️
versioned-tests-20.x 75.58% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
lib/instrumentations.js 100.00% <ø> (ø)
lib/instrumentation/undici.js 99.16% <100.00%> (+0.05%) ⬆️
lib/shimmer.js 92.35% <100.00%> (+0.09%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@bizob2828 bizob2828 merged commit 980b4dc into newrelic:main Sep 7, 2023
21 checks passed
@github-actions github-actions bot mentioned this pull request Sep 7, 2023
@bizob2828 bizob2828 deleted the fetch branch August 28, 2024 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Instrument native fetch
2 participants