Skip to content

Commit 3d85fb5

Browse files
feat: Added essential type for partial granularity traces (newrelic#3547)
1 parent 3f03162 commit 3d85fb5

File tree

2 files changed

+276
-119
lines changed

2 files changed

+276
-119
lines changed

lib/spans/span-event.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,17 @@ class SpanEvent {
190190
if (entityRelationshipAttrs.length > 0) {
191191
return { attributes, customAttributes, dropSpan: false }
192192
}
193+
} else if (partialGranularityMode === 'essential') {
194+
const attributesToKeep = {}
195+
for (const item in attributes) {
196+
if (entityRelationshipAttrs.includes(item) || item.startsWith('error.')) {
197+
attributesToKeep[item] = attributes[item]
198+
}
199+
}
200+
201+
if (Object.keys(attributesToKeep).length > 0) {
202+
return { attributes: attributesToKeep, customAttributes: {}, dropSpan: false }
203+
}
193204
}
194205

195206
return { dropSpan: true }

0 commit comments

Comments
 (0)