Skip to content

chore: Added supportability metrics to OTEL metrics API #3164

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

Merged
merged 1 commit into from
Jun 23, 2025

Conversation

jsumners-nr
Copy link
Contributor

This PR resolves #3161.

Copy link

codecov bot commented Jun 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.59%. Comparing base (2c79a31) to head (4860cc9).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3164      +/-   ##
==========================================
- Coverage   97.62%   97.59%   -0.04%     
==========================================
  Files         339      339              
  Lines       50987    51018      +31     
==========================================
+ Hits        49777    49791      +14     
- Misses       1210     1227      +17     
Flag Coverage Δ
integration-tests-cjs-18.x 73.93% <100.00%> (+0.01%) ⬆️
integration-tests-cjs-20.x 73.92% <100.00%> (?)
integration-tests-cjs-22.x 73.95% <100.00%> (+0.01%) ⬆️
integration-tests-esm-18.x 49.65% <0.00%> (-0.04%) ⬇️
integration-tests-esm-20.x 49.66% <0.00%> (?)
integration-tests-esm-22.x 49.72% <0.00%> (-0.04%) ⬇️
unit-tests-18.x 88.35% <9.67%> (-0.05%) ⬇️
unit-tests-20.x 88.35% <9.67%> (?)
unit-tests-22.x 88.35% <9.67%> (?)
versioned-tests-18.x 80.00% <0.00%> (-0.22%) ⬇️
versioned-tests-20.x 80.11% <0.00%> (-0.22%) ⬇️
versioned-tests-22.x 80.12% <0.00%> (-0.22%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@jsumners-nr jsumners-nr marked this pull request as ready for review June 18, 2025 13:01
@@ -44,6 +44,37 @@ function bootstrapOtelMetrics(agent) {
resource
})

const getMeter = provider.getMeter
provider.getMeter = function nrGetMeter(...args) {
Copy link
Member

Choose a reason for hiding this comment

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

Any reason not to use shim or shimmer to wrap function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reading through (lib/shimmer.js).wrapMethod, I can see that it would be possible to use it here. But if feels rather "overkill"-ish and more designed for instrumenting the wrapped things than what this wrapping is doing. Here, we are merely augmenting the existing functionality by recording metrics.

But I'm also seeing that lib/shimmer.js relies on our otel setup code:

const { setupOtel, teardownOtel } = require('./otel/setup')

The actual usage has no impact on wrapMethod, but it would introduce a weird circular dependency.

Ultimately, I don't think this simple case requires all of the plumbing that comes with our shimmer wrapping tool. Do you agree?

Copy link
Member

Choose a reason for hiding this comment

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

It's probably fine. We can always change later. Don't forget to add these metrics to angler

@jsumners-nr jsumners-nr merged commit 5312db0 into newrelic:main Jun 23, 2025
26 of 27 checks passed
@github-project-automation github-project-automation bot moved this from Needs PR Review to Done: Issues recently completed in Node.js Engineering Board Jun 23, 2025
@jsumners-nr jsumners-nr deleted the issue-3161 branch June 23, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done: Issues recently completed
Development

Successfully merging this pull request may close these issues.

Add supportability metric for OTEL metrics API usage
3 participants