newrelic 9.0.2 → 9.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEWS.md +6 -0
- package/lib/instrumentation/grpc-js/grpc.js +1 -3
- package/lib/transaction/index.js +36 -33
- package/package.json +1 -1
package/NEWS.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
### v9.0.3 (2022-09-06)
|
|
2
|
+
|
|
3
|
+
* Updated gRPC client instrumenation to respect `grpc.record_errors` when deciding to log errors on gRPC client requests.
|
|
4
|
+
|
|
5
|
+
* Fixed transaction name finalization to properly copy the appropriate transaction name to root segment.
|
|
6
|
+
|
|
1
7
|
### v9.0.2 (2022-08-23)
|
|
2
8
|
|
|
3
9
|
* Added unit test suite for `lib/logger.js`.
|
|
@@ -78,9 +78,7 @@ function wrapStart(shim, original) {
|
|
|
78
78
|
segment.addAttribute('grpc.statusCode', code)
|
|
79
79
|
segment.addAttribute('grpc.statusText', details)
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
// but has specific gRPC configuration to turn off
|
|
83
|
-
if (code !== 0) {
|
|
81
|
+
if (code !== 0 && shim.agent.config.grpc.record_errors) {
|
|
84
82
|
// this is currently just creating an error from the details string
|
|
85
83
|
shim.agent.errors.add(segment.transaction, details)
|
|
86
84
|
}
|
package/lib/transaction/index.js
CHANGED
|
@@ -418,13 +418,7 @@ function finalizeNameFromUri(requestURL, statusCode) {
|
|
|
418
418
|
|
|
419
419
|
this.url = urltils.scrub(requestURL)
|
|
420
420
|
this.statusCode = statusCode
|
|
421
|
-
|
|
422
|
-
// Derive the name from the request URL.
|
|
423
|
-
const partialName = this._partialNameFromUri(requestURL, statusCode)
|
|
424
|
-
this._partialName = partialName.value
|
|
425
|
-
if (partialName.ignore) {
|
|
426
|
-
this.ignore = true
|
|
427
|
-
}
|
|
421
|
+
this.name = this.getFullName()
|
|
428
422
|
|
|
429
423
|
// If a namestate stack exists, copy route parameters over to the trace.
|
|
430
424
|
if (!this.nameState.isEmpty() && this.baseSegment) {
|
|
@@ -448,17 +442,6 @@ function finalizeNameFromUri(requestURL, statusCode) {
|
|
|
448
442
|
}, this)
|
|
449
443
|
}
|
|
450
444
|
|
|
451
|
-
// Apply transaction name normalization rules (sent by server) to full name.
|
|
452
|
-
const fullName = TYPE_METRICS[this.type] + '/' + this._partialName
|
|
453
|
-
const normalized = this.agent.transactionNameNormalizer.normalize(fullName)
|
|
454
|
-
if (normalized.ignore) {
|
|
455
|
-
this.ignore = true
|
|
456
|
-
}
|
|
457
|
-
this.name = normalized.value
|
|
458
|
-
|
|
459
|
-
// 5. transaction segment term normalizer
|
|
460
|
-
this.name = this.agent.txSegmentNormalizer.normalize(this.name).value
|
|
461
|
-
|
|
462
445
|
// Allow the API to explicitly set the ignored status.
|
|
463
446
|
if (this.forceIgnore !== null) {
|
|
464
447
|
this.ignore = this.forceIgnore
|
|
@@ -528,25 +511,22 @@ Transaction.prototype._markAsWeb = function _markAsWeb(rawURL) {
|
|
|
528
511
|
Transaction.prototype.finalizeName = function finalizeName(name) {
|
|
529
512
|
// If no name is given, and this is a web transaction with a url, then
|
|
530
513
|
// finalize the name using the stored url.
|
|
531
|
-
if (name == null && this.
|
|
514
|
+
if (name == null && this.isWeb() && this.url) {
|
|
532
515
|
return this.finalizeNameFromUri(this.url, this.statusCode)
|
|
533
516
|
}
|
|
534
517
|
|
|
535
|
-
this
|
|
536
|
-
|
|
518
|
+
// this may seem out of place but certain API methods
|
|
519
|
+
// set the _partialName directly so use that as a fallback
|
|
520
|
+
this._partialName = name || this._partialName
|
|
521
|
+
|
|
522
|
+
name = this.getFullName()
|
|
523
|
+
|
|
524
|
+
if (!name) {
|
|
537
525
|
logger.debug('No name for transaction %s, not finalizing.', this.id)
|
|
538
526
|
return
|
|
539
527
|
}
|
|
540
528
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
// Transaction normalizers run on the full metric name, not the user facing
|
|
544
|
-
// transaction name.
|
|
545
|
-
const normalized = this.agent.transactionNameNormalizer.normalize(fullName)
|
|
546
|
-
if (normalized.ignore) {
|
|
547
|
-
this.ignore = true
|
|
548
|
-
}
|
|
549
|
-
this.name = normalized.value
|
|
529
|
+
this.name = name
|
|
550
530
|
|
|
551
531
|
if (this.forceIgnore !== null) {
|
|
552
532
|
this.ignore = this.forceIgnore
|
|
@@ -582,17 +562,25 @@ Transaction.prototype.finalizeName = function finalizeName(name) {
|
|
|
582
562
|
*/
|
|
583
563
|
Transaction.prototype.getName = function getName() {
|
|
584
564
|
if (this.isWeb() && this.url) {
|
|
585
|
-
|
|
565
|
+
const finalName = this._partialNameFromUri(this.url, this.statusCode)
|
|
566
|
+
if (finalName.ignore) {
|
|
567
|
+
this.ignore = true
|
|
568
|
+
}
|
|
569
|
+
return finalName.value
|
|
586
570
|
}
|
|
587
571
|
return this._partialName
|
|
588
572
|
}
|
|
589
573
|
|
|
590
574
|
Transaction.prototype.getFullName = function getFullName() {
|
|
591
575
|
let name = null
|
|
576
|
+
// use value from `api.setTransaction`
|
|
592
577
|
if (this.forceName) {
|
|
593
578
|
name = this.forceName
|
|
579
|
+
// use value from previously finalized named
|
|
594
580
|
} else if (this.name) {
|
|
595
581
|
return this.name
|
|
582
|
+
// derive name from uri in web case
|
|
583
|
+
// or just use whatever was this._partialName
|
|
596
584
|
} else {
|
|
597
585
|
name = this.getName()
|
|
598
586
|
}
|
|
@@ -600,8 +588,23 @@ Transaction.prototype.getFullName = function getFullName() {
|
|
|
600
588
|
if (!name) {
|
|
601
589
|
return null
|
|
602
590
|
}
|
|
603
|
-
|
|
604
|
-
|
|
591
|
+
|
|
592
|
+
this._partialName = name
|
|
593
|
+
let fullName = TYPE_METRICS[this.type] + '/' + name
|
|
594
|
+
const normalized = this.agent.transactionNameNormalizer.normalize(fullName)
|
|
595
|
+
if (normalized.ignore) {
|
|
596
|
+
this.ignore = true
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
fullName = normalized.value
|
|
600
|
+
|
|
601
|
+
// apply transaction segment term normalizer
|
|
602
|
+
// only to web transactions
|
|
603
|
+
if (this.isWeb() && this.url) {
|
|
604
|
+
fullName = this.agent.txSegmentNormalizer.normalize(fullName).value
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
return fullName
|
|
605
608
|
}
|
|
606
609
|
|
|
607
610
|
/**
|