newrelic 12.18.0 → 12.18.1
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
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
### v12.18.1 (2025-04-29)
|
|
2
|
+
|
|
3
|
+
#### Bug fixes
|
|
4
|
+
|
|
5
|
+
* Only add `newrelic` header to outgoing headers if has a value ([#3052](https://github.com/newrelic/node-newrelic/pull/3052)) ([6ef0a90](https://github.com/newrelic/node-newrelic/commit/6ef0a904291fb4efc6d6f111b3ec93aac720c3ad))
|
|
6
|
+
|
|
7
|
+
#### Code refactoring
|
|
8
|
+
|
|
9
|
+
* Added defensive code when calculating exclusive time on a segment where it cannot locate the segment in the transaction trace tree ([#3051](https://github.com/newrelic/node-newrelic/pull/3051)) ([b4aa25e](https://github.com/newrelic/node-newrelic/commit/b4aa25e2df861dab732bb812bffe961c0cc3da36))
|
|
10
|
+
* Updated how otel bridge trace propagator assigns traceparent/tracestate headers ([#3046](https://github.com/newrelic/node-newrelic/pull/3046)) ([6e317b8](https://github.com/newrelic/node-newrelic/commit/6e317b889c68a2e0e69b1d4d2fa9fe2846a0e94f))
|
|
11
|
+
|
|
12
|
+
#### Documentation
|
|
13
|
+
|
|
14
|
+
* Updated compatibility report ([#3054](https://github.com/newrelic/node-newrelic/pull/3054)) ([#3050](https://github.com/newrelic/node-newrelic/pull/3050)) ([#3026](https://github.com/newrelic/node-newrelic/pull/3026))
|
|
15
|
+
|
|
16
|
+
#### Tests
|
|
17
|
+
|
|
18
|
+
* Skipped regressions in pg-native versioned tests ([#3053](https://github.com/newrelic/node-newrelic/pull/3053)) ([6ce3670](https://github.com/newrelic/node-newrelic/commit/6ce36706adc2e17a80b759b51c23807d617ad04f))
|
|
19
|
+
* Updated elasticsearch image for versioned tests ([#3038](https://github.com/newrelic/node-newrelic/pull/3038)) ([3d73f9f](https://github.com/newrelic/node-newrelic/commit/3d73f9faffd45d2d1465210d168822494439c577))
|
|
20
|
+
|
|
1
21
|
### v12.18.0 (2025-04-14)
|
|
2
22
|
|
|
3
23
|
#### Features
|
|
@@ -69,7 +69,7 @@ module.exports = class NewRelicTracePropagator {
|
|
|
69
69
|
!isSpanContextValid(spanContext)
|
|
70
70
|
) { return }
|
|
71
71
|
|
|
72
|
-
context?.transaction?.insertDistributedTraceHeaders(carrier, spanContext)
|
|
72
|
+
context?.transaction?.insertDistributedTraceHeaders(carrier, setter, spanContext)
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
extract(context, carrier, getter) {
|
package/lib/transaction/index.js
CHANGED
|
@@ -906,10 +906,11 @@ function acceptDistributedTraceHeaders(transportType, headers) {
|
|
|
906
906
|
* Inserts distributed trace headers into the provided headers map.
|
|
907
907
|
*
|
|
908
908
|
* @param {object} headers
|
|
909
|
+
* @param {object} setter - otel bridge setter to assign headers
|
|
909
910
|
* @param {object} spanContext otel span context
|
|
910
911
|
*/
|
|
911
912
|
Transaction.prototype.insertDistributedTraceHeaders = insertDistributedTraceHeaders
|
|
912
|
-
function insertDistributedTraceHeaders(headers, spanContext) {
|
|
913
|
+
function insertDistributedTraceHeaders(headers, setter, spanContext) {
|
|
913
914
|
if (!headers) {
|
|
914
915
|
logger.trace('insertDistributedTraceHeaders called without headers.')
|
|
915
916
|
return
|
|
@@ -920,7 +921,7 @@ function insertDistributedTraceHeaders(headers, spanContext) {
|
|
|
920
921
|
// Ensure we have priority before generating trace headers.
|
|
921
922
|
this._calculatePriority()
|
|
922
923
|
|
|
923
|
-
this.traceContext.addTraceContextHeaders(headers, spanContext)
|
|
924
|
+
this.traceContext.addTraceContextHeaders(headers, setter, spanContext)
|
|
924
925
|
this.isDistributedTrace = true
|
|
925
926
|
|
|
926
927
|
logger.trace('Added outbound request w3c trace context headers in transaction %s', this.id)
|
|
@@ -932,8 +933,10 @@ function insertDistributedTraceHeaders(headers, spanContext) {
|
|
|
932
933
|
|
|
933
934
|
try {
|
|
934
935
|
const newrelicFormatData = this._createDistributedTracePayload().httpSafe()
|
|
935
|
-
|
|
936
|
-
|
|
936
|
+
if (newrelicFormatData) {
|
|
937
|
+
headers[NEWRELIC_TRACE_HEADER] = newrelicFormatData
|
|
938
|
+
logger.trace('Added outbound request distributed tracing headers in transaction %s', this.id)
|
|
939
|
+
}
|
|
937
940
|
} catch (error) {
|
|
938
941
|
logger.trace(error, 'Failed to create distributed trace payload')
|
|
939
942
|
}
|
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
class ExclusiveCalculator {
|
|
9
9
|
constructor(root, trace) {
|
|
10
|
-
|
|
10
|
+
const node = trace.getNode(root.id)
|
|
11
|
+
// could not find segment in trace, typically because context propagation is broken
|
|
12
|
+
// add some defensive and essentially set the exclusive time to the segment duration
|
|
13
|
+
this.node = node ?? { children: [], segment: root }
|
|
11
14
|
// use a second stack to do a post-order traversal
|
|
12
15
|
this.parentStack = []
|
|
13
16
|
}
|
|
@@ -134,21 +134,30 @@ class TraceContext {
|
|
|
134
134
|
* Takes a headers object and modifies it in place by adding Trace Context headers
|
|
135
135
|
*
|
|
136
136
|
* @param {object} headers - Headers for an HTTP request
|
|
137
|
+
* @param {object} setter - otel bridge setter to assign headers to outgoing payload. Doing this instead of assigning to headers because some libraries have special logic for handling outgoing headers(gcp-pubsub)
|
|
137
138
|
* @param {object} spanContext if passed in, it'll use this to construct traceparent/tracestate. only used in otel bridge mode.
|
|
138
139
|
*/
|
|
139
|
-
addTraceContextHeaders(headers, spanContext) {
|
|
140
|
+
addTraceContextHeaders(headers, setter, spanContext) {
|
|
140
141
|
if (!headers) {
|
|
141
142
|
return
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
const traceParent = this.createTraceparent(spanContext)
|
|
145
|
-
|
|
146
|
+
if (setter) {
|
|
147
|
+
setter.set(headers, TRACE_CONTEXT_PARENT_HEADER, traceParent)
|
|
148
|
+
} else {
|
|
149
|
+
headers[TRACE_CONTEXT_PARENT_HEADER] = traceParent
|
|
150
|
+
}
|
|
146
151
|
|
|
147
152
|
logger.trace('traceparent added with %s', traceParent)
|
|
148
153
|
|
|
149
154
|
const tracestate = this.createTracestate(spanContext)
|
|
150
155
|
if (tracestate) {
|
|
151
|
-
|
|
156
|
+
if (setter) {
|
|
157
|
+
setter.set(headers, TRACE_CONTEXT_STATE_HEADER, tracestate)
|
|
158
|
+
} else {
|
|
159
|
+
headers[TRACE_CONTEXT_STATE_HEADER] = tracestate
|
|
160
|
+
}
|
|
152
161
|
logger.trace('tracestate added with %s', tracestate)
|
|
153
162
|
}
|
|
154
163
|
|