newrelic 12.11.2 → 12.11.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
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
### v12.11.3 (2025-01-29)
|
|
2
|
+
|
|
3
|
+
#### Bug fixes
|
|
4
|
+
|
|
5
|
+
* Fixed issue with `bluebird` and `when` instrumentation where checking active context crashed when transaction prematurely ends ([#2909](https://github.com/newrelic/node-newrelic/pull/2909)) ([4a30d5c](https://github.com/newrelic/node-newrelic/commit/4a30d5c5082e963cca3664f2ed152017f6360d21))
|
|
6
|
+
* Fixed transaction-shim to properly create new transactions when the existing transaction is not active ([#2912](https://github.com/newrelic/node-newrelic/pull/2912)) ([3ad8c59](https://github.com/newrelic/node-newrelic/commit/3ad8c59e15e037a366ddf6803729b61ecfa701f3))
|
|
7
|
+
|
|
8
|
+
#### Documentation
|
|
9
|
+
|
|
10
|
+
* Updated compatibility report ([#2902](https://github.com/newrelic/node-newrelic/pull/2902)) ([cb16516](https://github.com/newrelic/node-newrelic/commit/cb16516e90a3dc2cefb98e6131a7243412aefbfc))
|
|
11
|
+
|
|
12
|
+
#### Miscellaneous chores
|
|
13
|
+
|
|
14
|
+
* Updated lint rule suppression comment ([#2895](https://github.com/newrelic/node-newrelic/pull/2895)) ([559dc98](https://github.com/newrelic/node-newrelic/commit/559dc98e18c8ba8280b73779780f3efc1c946ed7))
|
|
15
|
+
|
|
16
|
+
#### Continuous integration
|
|
17
|
+
|
|
18
|
+
* Move init container release from lambda to GHA ([#2848](https://github.com/newrelic/node-newrelic/pull/2848)) ([8d8608d](https://github.com/newrelic/node-newrelic/commit/8d8608d1089cafaeb8c17354034c96fe1b49597a))
|
|
19
|
+
|
|
1
20
|
### v12.11.2 (2025-01-23)
|
|
2
21
|
|
|
3
22
|
#### Features
|
package/lib/db/utils.js
CHANGED
|
@@ -11,9 +11,9 @@ function extractDatabaseChangeFromUse(sql) {
|
|
|
11
11
|
// The character ranges for this were pulled from
|
|
12
12
|
// http://dev.mysql.com/doc/refman/5.7/en/identifiers.html
|
|
13
13
|
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// eslint-disable-next-line sonarjs/slow-regex
|
|
17
|
-
const match = /^\s*use[^\w`]+([\w
|
|
14
|
+
// The lint rule being suppressed here has been evaluated, and it has been
|
|
15
|
+
// determined that the regular expression is sufficient for our use case.
|
|
16
|
+
// eslint-disable-next-line sonarjs/slow-regex
|
|
17
|
+
const match = /^\s*use[^\w`]+([\w$\u0080-\uFFFF]+|`[^`]+`)[\s;]*$/i.exec(sql)
|
|
18
18
|
return (match && match[1]) || null
|
|
19
19
|
}
|
|
@@ -116,7 +116,8 @@ Contextualizer.prototype = Object.create(null)
|
|
|
116
116
|
Contextualizer.prototype.isActive = function isActive() {
|
|
117
117
|
const segments = this.context.segments
|
|
118
118
|
const segment = segments[this.idx] || segments[this.parentIdx] || segments[0]
|
|
119
|
-
|
|
119
|
+
const transaction = this.getTransaction()
|
|
120
|
+
return segment && transaction?.isActive()
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
/**
|
package/lib/shim/promise-shim.js
CHANGED
|
@@ -121,7 +121,7 @@ class PromiseShim extends Shim {
|
|
|
121
121
|
const transaction = shim.tracer.getTransaction()
|
|
122
122
|
// This extra property is added by `_wrapExecutorContext` in the pre step.
|
|
123
123
|
const executor = args[0]
|
|
124
|
-
const context = executor
|
|
124
|
+
const context = executor?.[symbols.executorContext]
|
|
125
125
|
if (!context || !shim.isFunction(context.executor)) {
|
|
126
126
|
return
|
|
127
127
|
}
|
|
@@ -387,9 +387,7 @@ function _wrapExecutorContext(shim, args) {
|
|
|
387
387
|
function _wrapResolver(context, fn) {
|
|
388
388
|
return function wrappedResolveReject(val) {
|
|
389
389
|
const promise = context.promise
|
|
390
|
-
|
|
391
|
-
promise[symbols.context].getSegment().touch()
|
|
392
|
-
}
|
|
390
|
+
promise?.[symbols.context]?.getSegment()?.touch()
|
|
393
391
|
fn(val)
|
|
394
392
|
}
|
|
395
393
|
}
|
|
@@ -416,7 +414,7 @@ function wrapHandler({ handler, index, argsLength, useAllParams, ctx, shim }) {
|
|
|
416
414
|
}
|
|
417
415
|
|
|
418
416
|
return function __NR_wrappedThenHandler() {
|
|
419
|
-
if (!ctx
|
|
417
|
+
if (!ctx?.handler?.[symbols.context]) {
|
|
420
418
|
return handler.apply(this, arguments)
|
|
421
419
|
}
|
|
422
420
|
|
|
@@ -591,7 +589,8 @@ class Contextualizer {
|
|
|
591
589
|
isActive() {
|
|
592
590
|
const segments = this.context.segments
|
|
593
591
|
const segment = segments[this.idx] || segments[this.parentIdx] || segments[0]
|
|
594
|
-
|
|
592
|
+
const transaction = this.getTransaction()
|
|
593
|
+
return segment && transaction?.isActive()
|
|
595
594
|
}
|
|
596
595
|
|
|
597
596
|
getTransaction() {
|
|
@@ -372,12 +372,13 @@ function _makeNestedTransWrapper(shim, func, name, spec) {
|
|
|
372
372
|
}
|
|
373
373
|
|
|
374
374
|
let context = shim.tracer.getContext()
|
|
375
|
+
let transaction = shim.tracer.getTransaction()
|
|
375
376
|
|
|
376
377
|
// Only create a new transaction if we either do not have a current
|
|
377
378
|
// transaction _or_ the current transaction is not of the type we want.
|
|
378
|
-
if (!
|
|
379
|
+
if (!transaction || spec.type !== transaction?.type) {
|
|
379
380
|
shim.logger.trace('Creating new nested %s transaction for %s', spec.type, name)
|
|
380
|
-
|
|
381
|
+
transaction = new Transaction(shim.agent)
|
|
381
382
|
transaction.type = spec.type
|
|
382
383
|
context = context.enterTransaction(transaction)
|
|
383
384
|
}
|
|
@@ -405,10 +406,11 @@ function _makeNestedTransWrapper(shim, func, name, spec) {
|
|
|
405
406
|
*/
|
|
406
407
|
function _makeTransWrapper(shim, func, name, spec) {
|
|
407
408
|
return function transactionWrapper() {
|
|
408
|
-
// Don't nest transactions, reuse existing ones!
|
|
409
409
|
let context = shim.tracer.getContext()
|
|
410
|
-
|
|
410
|
+
// Don't nest transactions, reuse existing ones!
|
|
411
|
+
const existingTransaction = shim.tracer.getTransaction()
|
|
411
412
|
if (!shim.agent.canCollectData() || existingTransaction) {
|
|
413
|
+
shim.logger.trace('Transaction %s exists, not creating new transaction %s for %s', existingTransaction?.id, spec.type, name)
|
|
412
414
|
return func.apply(this, arguments)
|
|
413
415
|
}
|
|
414
416
|
|