-
Notifications
You must be signed in to change notification settings - Fork 420
feat: Added partial granularity tracking metrics #3566
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
svetlanabrennan
merged 8 commits into
newrelic:main
from
svetlanabrennan:tracing-metrics
Dec 8, 2025
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a1dd5c1
add metrics for partial instrumented and kept
svetlanabrennan 76777c1
move up instrumented metrics
svetlanabrennan 925dd11
add unit tests for metrics
svetlanabrennan a35e38d
Merge branch 'main' into tracing-metrics
svetlanabrennan a4615b7
fix tests after main merge
svetlanabrennan 404d1c5
remove unneeded span event aggregator in tests
svetlanabrennan a48a15e
move metrics to be recorded for partial trace only and add test for it
svetlanabrennan f727285
move full granularity test to another existing file
svetlanabrennan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * Copyright 2025 New Relic Corporation. All rights reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| 'use strict' | ||
| const assert = require('node:assert') | ||
| const test = require('node:test') | ||
| 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) => { | ||
| t.beforeEach((ctx) => { | ||
| const agent = helper.loadMockedAgent({ | ||
| distributed_tracing: { | ||
| enabled: true, | ||
| sampler: { | ||
| full_granularity: { | ||
| enabled: true | ||
| }, | ||
| partial_granularity: { | ||
| enabled: false, | ||
| } | ||
| } | ||
| } | ||
| }) | ||
| ctx.nr = { agent } | ||
| }) | ||
|
|
||
| t.afterEach((ctx) => { | ||
| helper.unloadAgent(ctx.nr.agent) | ||
| }) | ||
|
|
||
| await t.test('should not record partial granularity metrics when not part of partialTrace', (t, end) => { | ||
| const { agent } = t.nr | ||
| helper.runInTransaction(agent, (transaction) => { | ||
| const segment = transaction.trace.add('Datastore/operation/Redis/SET') | ||
| const span = SpanEvent.fromSegment({ segment, transaction, inProcessSpans: true }) | ||
| assert.ok(span) | ||
| transaction.end() | ||
| const unscopedMetrics = agent.metrics._metrics.unscoped | ||
| assert.equal(unscopedMetrics['Supportability/DistributedTrace/PartialGranularity/reduced/Span/Instrumented'], undefined) | ||
| assert.equal(unscopedMetrics['Supportability/DistributedTrace/PartialGranularity/reduced/Span/Kept'], undefined) | ||
| assert.equal(unscopedMetrics['Supportability/DistributedTrace/PartialGranularity/essential/Span/Instrumented'], undefined) | ||
| assert.equal(unscopedMetrics['Supportability/DistributedTrace/PartialGranularity/essential/Span/Kept'], undefined) | ||
| end() | ||
| }) | ||
| }) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 thisThere was a problem hiding this comment.
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.