Skip to content

Commit 8c57230

Browse files
authored
chore: Added span id to all debug/trace level logs in span.applyPartialTraceRules (#3766)
1 parent 5196318 commit 8c57230

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/spans/span-event.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,50 +328,50 @@ class SpanEvent {
328328

329329
if (isEntry) {
330330
this.addIntrinsicAttribute('nr.pg', true)
331-
logger.trace('Span %s is an entry point, keeping span unchanged.', this.intrinsics.name)
331+
logger.trace('Span %s(%s) is an entry point, keeping span unchanged.', this.intrinsics.name, this.id)
332332
return this
333333
}
334334

335335
if (this.isLlmSpan) {
336-
logger.trace('Span %s is an LLM span, keeping span unchanged.', this.intrinsics.name)
336+
logger.trace('Span %s(%s) is an LLM span, keeping span unchanged.', this.intrinsics.name, this.id)
337337
return this
338338
}
339339

340340
if (!this.isExitSpan) {
341-
logger.trace('Span %s is not an exit span and trace is partial granularity type: %s.', this.intrinsics.name, partialTrace.type)
341+
logger.trace('Span %s(%s) is not an exit span and trace is partial granularity type: %s.', this.intrinsics.name, this.id, partialTrace.type)
342342
return null
343343
}
344344

345345
// partial granularity type rules layer on top of each other.
346346
// running all logic assumes `compact` type
347347
// it will return modified span once specific checks are done for a given type
348348
if (!this.hasEntityRelationshipAttrs) {
349-
logger.trace('Span %s does not contain any entity relationship attributes %j and trace is partial granularity type: %s, dropping span.', this.intrinsics.name, this.attributes, partialTrace.type)
349+
logger.trace('Span %s(%s) does not contain any entity relationship attributes %j and trace is partial granularity type: %s, dropping span.', this.intrinsics.name, this.id, this.attributes, partialTrace.type)
350350
return null
351351
}
352352

353353
if (partialTrace.type === PARTIAL_TYPES.REDUCED) {
354-
logger.trace('Span %s contains entity relationship attributes and trace is partial granularity type: %s, keeping span unchanged.', this.intrinsics.name, partialTrace.type)
354+
logger.trace('Span %s(%s) contains entity relationship attributes and trace is partial granularity type: %s, keeping span unchanged.', this.intrinsics.name, this.id, partialTrace.type)
355355
return this
356356
}
357357

358358
this.attributes = this.filteredAttrs
359359
this.customAttributes = Object.create(null)
360360

361361
if (partialTrace.type === PARTIAL_TYPES.ESSENTIAL) {
362-
logger.trace('Span %s contains entity relationship attributes and trace is partial granularity type: %s, only keeping entity relationship attributes and removing custom attributes.', this.intrinsics.name, partialTrace.type)
362+
logger.trace('Span %s(%s) contains entity relationship attributes and trace is partial granularity type: %s, only keeping entity relationship attributes and removing custom attributes.', this.intrinsics.name, this.id, partialTrace.type)
363363
return this
364364
}
365365

366366
const entityGroup = this.getEntityGroup(partialTrace)
367367
if (entityGroup) {
368368
entityGroup.push(this)
369-
logger.trace('Span %s has the same entity relationship attributes and trace is partial type %s, dropping span.', this.intrinsics.name, partialTrace.type)
369+
logger.trace('Span %s(%s) has the same entity relationship attributes and trace is partial type %s, dropping span.', this.intrinsics.name, this.id, partialTrace.type)
370370
return null
371371
}
372372

373373
partialTrace.compactSpanGroups[this.id] = [this]
374-
logger.trace('Span %s has unique entity relationship attributes %j and trace is partial type: %s, keeping span.', this.intrinsics.name, this.filteredAttrs, partialTrace.type)
374+
logger.trace('Span %s(%s) has unique entity relationship attributes %j and trace is partial type: %s, keeping span.', this.intrinsics.name, this.id, this.filteredAttrs, partialTrace.type)
375375
return this
376376
}
377377

0 commit comments

Comments
 (0)