Skip to content

Conversation

@svetlanabrennan
Copy link
Contributor

@svetlanabrennan svetlanabrennan commented Dec 5, 2025

Description

We need to add Supportability/DistributedTrace/PartialGranularity/<partial granularity type>/Span/Instrumented metric which represents the total number of span events that were instrumented and would have been recorded (if the trace was full granularity) before partial granularity dropped them.

And we need to add Supportability/DistributedTrace/PartialGranularity/<partial granularity type>/Span/Kept metric that represents the total number of span events that were recorded and kept by partial granularity (aka that were not dropped).

How to Test

Run npm run test

Related Issues

Partially closes #3453 (we still need to add compact metrics in a separate PR at a future date).

@svetlanabrennan svetlanabrennan changed the title add metrics for partial instrumented and kept feat: Added partial granularity tracking metrics Dec 5, 2025
@svetlanabrennan svetlanabrennan marked this pull request as ready for review December 5, 2025 21:54
Copy link
Member

@bizob2828 bizob2828 left a comment

Choose a reason for hiding this comment

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

These metrics should only be incremented if the trace is partial

@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.68%. Comparing base (c9d156f) to head (f727285).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3566       +/-   ##
===========================================
+ Coverage   81.27%   97.68%   +16.40%     
===========================================
  Files         417      428       +11     
  Lines       55275    56605     +1330     
  Branches        1        1               
===========================================
+ Hits        44927    55293    +10366     
+ Misses      10348     1312     -9036     
Flag Coverage Δ
integration-tests-cjs-20.x 73.96% <71.42%> (?)
integration-tests-cjs-22.x 74.00% <71.42%> (?)
integration-tests-cjs-24.x 74.74% <71.42%> (?)
integration-tests-esm-20.x 52.62% <42.85%> (?)
integration-tests-esm-22.x 52.67% <42.85%> (?)
integration-tests-esm-24.x 53.86% <42.85%> (?)
unit-tests-20.x 88.71% <100.00%> (?)
unit-tests-22.x 88.74% <100.00%> (?)
unit-tests-24.x 88.75% <100.00%> (?)
versioned-tests-20.x 80.93% <71.42%> (-0.31%) ⬇️
versioned-tests-22.x 80.95% <71.42%> (-0.30%) ⬇️
versioned-tests-24.x 80.88% <71.42%> (-0.30%) ⬇️

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.

Copy link
Member

@bizob2828 bizob2828 left a comment

Choose a reason for hiding this comment

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

one small test change

const helper = require('#testlib/agent_helper.js')
const SpanEvent = require('#agentlib/spans/span-event.js')

test('Partial Granularity metrics with Full Granularity settings', async (t) => {
Copy link
Member

Choose a reason for hiding this comment

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

full granularity tests are in span-events.test.js, we don't need another file for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. I'll move them. Sorry about that.

@svetlanabrennan svetlanabrennan merged commit 061f0fc into newrelic:main Dec 8, 2025
25 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 Dec 8, 2025
@github-actions github-actions bot mentioned this pull request Dec 11, 2025
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 partial granularity tracking metrics

2 participants