newrelic 12.0.0 → 12.1.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,84 +1,134 @@
1
- ### v12.0.0 (2024-07-31)
2
- #### ⚠ BREAKING CHANGES
3
-
4
- * Dropped support for Node.js 16
5
- * Removed legacy context manager
6
- * Removed support for `redis` < 2.6.0
7
- * Removed instrumentation for `director`
8
- * Updated `mongodb` instrumentation to drop support for versions 2 and 3
9
-
10
- #### Features
11
-
12
- * Dropped support for Node.js 16 ([#2394](https://github.com/newrelic/node-newrelic/pull/2394)) ([1870010](https://github.com/newrelic/node-newrelic/commit/1870010a1d7dc417fc03ae526a9709e382b3fe1f))
13
- * Removed legacy context manager ([#2404](https://github.com/newrelic/node-newrelic/pull/2404)) ([321244c](https://github.com/newrelic/node-newrelic/commit/321244c357bc5dd9b4aeefc308cda5e80b8012b0))
14
- * Removed support for `redis` < 2.6.0 ([#2405](https://github.com/newrelic/node-newrelic/pull/2405)) ([e2c0a31](https://github.com/newrelic/node-newrelic/commit/e2c0a31b5230e0ffbdc3d4567619190570b7167c))
15
- * Removed instrumentation for `director` ([#2402](https://github.com/newrelic/node-newrelic/pull/2402)) ([1b355e7](https://github.com/newrelic/node-newrelic/commit/1b355e733aef0e14c5f4cb2899642a3d5b6f18ce))
16
- * Added `server.address` to amqplib spans ([#2406](https://github.com/newrelic/node-newrelic/pull/2406)) ([09636a4](https://github.com/newrelic/node-newrelic/commit/09636a4ce90969e7aea229ef008bd35f57e09217))
17
- * Updated `mongodb` instrumentation to drop support for versions 2 and 3 ([#2398](https://github.com/newrelic/node-newrelic/pull/2398)) ([a0ae32a](https://github.com/newrelic/node-newrelic/commit/a0ae32a6a61112e0473d477075543485d02313cf))
18
- * Migrated instrumentation for `next` into agent ([#2409](https://github.com/newrelic/node-newrelic/pull/2409)) ([b55d8e1](https://github.com/newr elic/node-newrelic/commit/b55d8e1ca09e6055ea09f4fcd773a05245e7203f))
19
- * You no longer need to load Next.js instrumentation via `@newrelic/next`.
20
- * Instead you must load the agent via `NODE_OPTIONS='-r newrelic' next start`
21
-
22
- #### Documentation
23
-
24
- * Updated compatibility report ([#2401](https://github.com/newrelic/node-newrelic/pull/2401)) ([a53085d](https://github.com/newrelic/node-newrelic/commit/a53085ddce2f2d7a4c9288fbf63fbf82436fb15f))
25
-
26
- #### Miscellaneous chores
27
-
28
- * Added test configs for defined targets in the aws test suite ([#2403](https://github.com/newrelic/node-newrelic/pull/2403)) ([cf514d9](https://github.com/newrelic/node-newrelic/commit/cf514d97b82889b14a342cbded630bae73992c35))
29
- * Added producer and consumer metrics to kafkajs instrumentation ([#2407](https://github.com/newrelic/node-newrelic/pull/2407)) ([41c1cc6](https://github.com/newrelic/node-newrelic/commit/41c1cc6d9815a1b89a7ab043b5da5f032969a87e))
30
- * Switched to using Node built-in test runner ([#2387](https://github.com/newrelic/node-newrelic/pull/2387)) ([b9f64b7](https://github.com/newrelic/node-newrelic/commit/b9f64b76b8777fc790a4694a95318f401a56abdd))
31
- * Updated `@newrelic/native-metrics` to 11.0.0 ([#2412](https://github.com/newrelic/node-newrelic/pull/2412)) ([aef69e2](https://github.com/newrelic/node-newrelic/commit/aef69e28cc3ead2079cfc0bdf9bde74129a3711f))
32
- * Updated dashboard links in developer-setup.md ([#2397](https://github.com/newrelic/node-newrelic/pull/2397)) ([16866da](https://github.com/newrelic/node-newrelic/commit/16866da381366ad848ea06be44fd838d57c9fb67))
33
- * Verified MySQL host:port metric is recorded ([#2400](https://github.com/newrelic/node-newrelic/pull/2400)) ([74176f7](https://github.com/newrelic/node-newrelic/commit/74176f77f70247a3cf65b1b49c5414279b4eeca6))
34
-
35
- #### Tests
36
-
37
- * Removed mongodb-esm tests as they are not atomic and conflicting with mongodb tests in CI ([#2416](https://github.com/newrelic/node-newrelic/pull/2416)) ([e587b9d](https://github.com/newrelic/node-newrelic/commit/e587b9dcb795cca3c29c6e0da18770401c3085a0))
38
- * Updated minimum version of lesser used versions of 3rd party libraries ([#2399](https://github.com/newrelic/node-newrelic/pull/2399)) ([ef8c006](https://github.com/newrelic/node-newrelic/commit/ef8c00674c22b4794c6cee823d46ad9db7d67fed))
39
-
40
- ### v11.23.2 (2024-07-22)
41
-
42
- #### Features
43
-
44
- * Added support for `fs.glob` in Node 22+ ([#2369](https://github.com/newrelic/node-newrelic/pull/2369)) ([1791a4e](https://github.com/newrelic/node-newrelic/commit/1791a4ef4a31e36757c47a9947ef8840fdd995c2))
45
-
46
- #### Bug fixes
47
-
48
- * Updated aws-sdk v3 instrumentation to load custom middleware last to properly get the external http span to add `aws.*` attributes ([#2382](https://github.com/newrelic/node-newrelic/pull/2382)) ([751801b](https://github.com/newrelic/node-newrelic/commit/751801be814343c9ddcee3dd7e83f87a1c6786d4))
49
- * Updated cassandra-driver instrumentation to properly trace promise based executions ([#2351](https://github.com/newrelic/node-newrelic/pull/2351)) ([bab9a8b](https://github.com/newrelic/node-newrelic/commit/bab9a8bab4ab6af8efa70d8559bdcc7ca6f5df32))
50
-
51
- #### Documentation
52
-
53
- * Removed examples/api/ ([#2381](https://github.com/newrelic/node-newrelic/pull/2381)) ([fb964de](https://github.com/newrelic/node-newrelic/commit/fb964de863f8989161f9a780f9eddc6e3ec91138))
54
- * Removed out of date `ROADMAP_Node.md` from root of project ([#2367](https://github.com/newrelic/node-newrelic/pull/2367)) ([4be870c](https://github.com/newrelic/node-newrelic/commit/4be870c758d9b931866ef3e6781d01bf176671a9))
55
- * Updated compatibility report ([#2345](https://github.com/newrelic/node-newrelic/pull/2345)) ([f08adc3](https://github.com/newrelic/node-newrelic/commit/f08adc3a30bdf3e5d23bd00efeb3b16ac06cd3e5))
56
-
57
- #### Miscellaneous chores
58
-
59
- * Always upload status logs in compatibility report CI ([#2341](https://github.com/newrelic/node-newrelic/pull/2341)) ([b3f1ee3](https://github.com/newrelic/node-newrelic/commit/b3f1ee3fe40c38c7484661dfb2e599df4f31003e))
60
-
61
- #### Tests
62
-
63
- * Removed `server.start` in grpc tests as it is deprecated and no longer needed ([#2372](https://github.com/newrelic/node-newrelic/pull/2372)) ([d212b15](https://github.com/newrelic/node-newrelic/commit/d212b15c929ebca22881f3d41a8d7f99033847a8))
64
- * Updated benchmark test results to output result files ([#2350](https://github.com/newrelic/node-newrelic/pull/2350)) ([1b51a68](https://github.com/newrelic/node-newrelic/commit/1b51a68200dae14b865a6db06d62655a25a62c2d))
65
-
66
- #### Continuous integration
67
-
68
- * Added benchmark test GitHub Action ([#2366](https://github.com/newrelic/node-newrelic/pull/2366)) ([afd3ab4](https://github.com/newrelic/node-newrelic/commit/afd3ab48611ec8409be1472ebbc63db24cff8e73))
69
- * Increased the limit of installs from 2 to a bigger number for versioned tests ([#2346](https://github.com/newrelic/node-newrelic/pull/2346)) ([f85a385](https://github.com/newrelic/node-newrelic/commit/f85a38524f1d41e82b2c5085c41d79d1263b63c3))
70
- * Updated `bin/create-docs-pr` to create an empty array if changelog.json is missing security ([#2348](https://github.com/newrelic/node-newrelic/pull/2348)) ([7d5368c](https://github.com/newrelic/node-newrelic/commit/7d5368ce873affbf2593bd6b1cc32259da852e1d))
71
-
72
- ### v11.23.1 (2024-07-11)
73
-
74
- #### Bug fixes
75
-
76
- * Updated redis v4 instrumentation to work with transactions(multi/exec) ([#2343](https://github.com/newrelic/node-newrelic/pull/2343)) ([39eb842](https://github.com/newrelic/node-newrelic/commit/39eb8421b84f7fe298acf5c9c89de31ee0cc2604))
77
-
78
- #### Documentation
79
-
80
- * Updated compatibility report ([#2342](https://github.com/newrelic/node-newrelic/pull/2342)) ([5c9e3e6](https://github.com/newrelic/node-newrelic/commit/5c9e3e6bfa8a388c7dd071ecb0231b069f065645))
81
-
1
+ ### v12.1.1 (2024-08-15)
2
+
3
+ #### Bug fixes
4
+
5
+ * Updated `amqplib` instrumentation to properly parse host/port from connect ([#2461](https://github.com/newrelic/node-newrelic/pull/2461)) ([91636a8](https://github.com/newrelic/node-newrelic/commit/91636a8e9702ba4ad1bf9b3941432ea65a3920fe))
6
+ * Updated `redis` instrumentation to parse host/port when a url is not provided ([#2463](https://github.com/newrelic/node-newrelic/pull/2463)) ([2b67623](https://github.com/newrelic/node-newrelic/commit/2b67623afef5fb132105c7f5b1d72e23b6d56dc1))
7
+ * Updated the `kafkajs` node metrics to remove `/Named` from the name ([#2458](https://github.com/newrelic/node-newrelic/pull/2458)) ([37ce113](https://github.com/newrelic/node-newrelic/commit/37ce1137a91c2efa85541cf6ec252a759e5f48ea))
8
+
9
+ #### Code refactoring
10
+
11
+ * Updated pino instrumentation to separate the wrapping of asJson into its own function ([#2464](https://github.com/newrelic/node-newrelic/pull/2464)) ([81fdde1](https://github.com/newrelic/node-newrelic/commit/81fdde1e35b5643ff141db1309ca58d7f6176cd5))
12
+
13
+ #### Documentation
14
+
15
+ * Updated compatibility report ([#2460](https://github.com/newrelic/node-newrelic/pull/2460)) ([a4570e9](https://github.com/newrelic/node-newrelic/commit/a4570e93298d10f4464570b75867634b95a61e89))
16
+
17
+ #### Miscellaneous chores
18
+
19
+ * Removed limit on superagent versioned testing ([#2456](https://github.com/newrelic/node-newrelic/pull/2456)) ([b4b6a6b](https://github.com/newrelic/node-newrelic/commit/b4b6a6b2eca8bd47d17f8b265344b4596c8226b3))
20
+
21
+ ### v12.1.0 (2024-08-12)
22
+
23
+ #### Bug fixes
24
+
25
+ * Pick log message from merging object in Pino instrumentation ([#2421](https://github.com/newrelic/node-newrelic/pull/2421)) ([599072b](https://github.com/newrelic/node-newrelic/commit/599072b43b77a8c11c9ef414b08dfe6e04bca9d2))
26
+ * Added TLS verification for Redis ([#2446](https://github.com/newrelic/node-newrelic/pull/2446)) ([9a16b70](https://github.com/newrelic/node-newrelic/commit/9a16b7016a943a0c2817ab2151eaa81f5ea19760))
27
+
28
+
29
+ #### Documentation
30
+
31
+ * Updated compatibility report ([#2440](https://github.com/newrelic/node-newrelic/pull/2440)) ([32abe5f](https://github.com/newrelic/node-newrelic/commit/32abe5f90d93d470737986b3bfe6c797915c4215))
32
+ * Updated examples to properly use specs ([#2422](https://github.com/newrelic/node-newrelic/pull/2422)) ([f7e8c58](https://github.com/newrelic/node-newrelic/commit/f7e8c5831305ac0bcb2c906ec176863552a083c4))
33
+ * Fixed typo in doc header ([#2433](https://github.com/newrelic/node-newrelic/pull/2433)) ([9726e23](https://github.com/newrelic/node-newrelic/commit/9726e231fe631623f882df38344df4db9ce67b70))
34
+
35
+ #### Miscellaneous chores
36
+
37
+ * Added entity relationship attributes to SQS segments ([#2436](https://github.com/newrelic/node-newrelic/pull/2436)) ([578aead](https://github.com/newrelic/node-newrelic/commit/578aead8c0b2d18dced4eaca54b19c769f398868))
38
+ * Converted agent unit tests to node:test ([#2414](https://github.com/newrelic/node-newrelic/pull/2414)) ([b32f793](https://github.com/newrelic/node-newrelic/commit/b32f7934fec5dc9e7b29dee5d1994ab180bb0c37))
39
+ * Fixed mongodb-esm tests in combination with security agent ([#2444](https://github.com/newrelic/node-newrelic/pull/2444)) ([5d617de](https://github.com/newrelic/node-newrelic/commit/5d617de99bc89b678b8c11aaebcad5dcacf0b5c3))
40
+ * Limited superagent tests to avoid new breaking release ([#2439](https://github.com/newrelic/node-newrelic/pull/2439)) ([f1dd8e7](https://github.com/newrelic/node-newrelic/commit/f1dd8e73b8329a075667f6696d2a27bc749e4e7a))
41
+ * Removed promise resolvers from callback based agent unit tests ([#2450](https://github.com/newrelic/node-newrelic/pull/2450)) ([3766895](https://github.com/newrelic/node-newrelic/commit/3766895cd7cc8145ba8eef6d49330e0d354158a1))
42
+
43
+
44
+ #### Tests
45
+
46
+ * Moved pkgVersion to collection-common to avoid a conflict with ESM tests ([#2438](https://github.com/newrelic/node-newrelic/pull/2438)) ([7260fa3](https://github.com/newrelic/node-newrelic/commit/7260fa36372877bb6f60637f8255312fcf207a0a))
47
+ * Restored mongodb-esm tests ([#2434](https://github.com/newrelic/node-newrelic/pull/2434)) ([67a12e3](https://github.com/newrelic/node-newrelic/commit/67a12e32c6deef0c7f8397ac75c369f3371519e8))
48
+ * Updated custom test reporter to only log failed tests when there are failures ([#2425](https://github.com/newrelic/node-newrelic/pull/2425)) ([baa37ec](https://github.com/newrelic/node-newrelic/commit/baa37ece0d027ca6d57fd5b52ceedfaa97ecbfaa))
49
+ * Updated tls redis tests to work with older versions of redis v4 ([#2454](https://github.com/newrelic/node-newrelic/pull/2454)) ([ffd9b17](https://github.com/newrelic/node-newrelic/commit/ffd9b177e85ed73963f88767e9d3e20c57ea372d))
50
+
51
+ ### v12.0.0 (2024-07-31)
52
+ #### ⚠ BREAKING CHANGES
53
+
54
+ * Dropped support for Node.js 16
55
+ * Removed legacy context manager
56
+ * Removed support for `redis` < 2.6.0
57
+ * Removed instrumentation for `director`
58
+ * Updated `mongodb` instrumentation to drop support for versions 2 and 3
59
+
60
+ #### Features
61
+
62
+ * Dropped support for Node.js 16 ([#2394](https://github.com/newrelic/node-newrelic/pull/2394)) ([1870010](https://github.com/newrelic/node-newrelic/commit/1870010a1d7dc417fc03ae526a9709e382b3fe1f))
63
+ * Removed legacy context manager ([#2404](https://github.com/newrelic/node-newrelic/pull/2404)) ([321244c](https://github.com/newrelic/node-newrelic/commit/321244c357bc5dd9b4aeefc308cda5e80b8012b0))
64
+ * Removed support for `redis` < 2.6.0 ([#2405](https://github.com/newrelic/node-newrelic/pull/2405)) ([e2c0a31](https://github.com/newrelic/node-newrelic/commit/e2c0a31b5230e0ffbdc3d4567619190570b7167c))
65
+ * Removed instrumentation for `director` ([#2402](https://github.com/newrelic/node-newrelic/pull/2402)) ([1b355e7](https://github.com/newrelic/node-newrelic/commit/1b355e733aef0e14c5f4cb2899642a3d5b6f18ce))
66
+ * Added `server.address` to amqplib spans ([#2406](https://github.com/newrelic/node-newrelic/pull/2406)) ([09636a4](https://github.com/newrelic/node-newrelic/commit/09636a4ce90969e7aea229ef008bd35f57e09217))
67
+ * Updated `mongodb` instrumentation to drop support for versions 2 and 3 ([#2398](https://github.com/newrelic/node-newrelic/pull/2398)) ([a0ae32a](https://github.com/newrelic/node-newrelic/commit/a0ae32a6a61112e0473d477075543485d02313cf))
68
+ * Migrated instrumentation for `next` into agent ([#2409](https://github.com/newrelic/node-newrelic/pull/2409)) ([b55d8e1](https://github.com/newr elic/node-newrelic/commit/b55d8e1ca09e6055ea09f4fcd773a05245e7203f))
69
+ * You no longer need to load Next.js instrumentation via `@newrelic/next`.
70
+ * Instead you must load the agent via `NODE_OPTIONS='-r newrelic' next start`
71
+
72
+ #### Documentation
73
+
74
+ * Updated compatibility report ([#2401](https://github.com/newrelic/node-newrelic/pull/2401)) ([a53085d](https://github.com/newrelic/node-newrelic/commit/a53085ddce2f2d7a4c9288fbf63fbf82436fb15f))
75
+
76
+ #### Miscellaneous chores
77
+
78
+ * Added test configs for defined targets in the aws test suite ([#2403](https://github.com/newrelic/node-newrelic/pull/2403)) ([cf514d9](https://github.com/newrelic/node-newrelic/commit/cf514d97b82889b14a342cbded630bae73992c35))
79
+ * Added producer and consumer metrics to kafkajs instrumentation ([#2407](https://github.com/newrelic/node-newrelic/pull/2407)) ([41c1cc6](https://github.com/newrelic/node-newrelic/commit/41c1cc6d9815a1b89a7ab043b5da5f032969a87e))
80
+ * Switched to using Node built-in test runner ([#2387](https://github.com/newrelic/node-newrelic/pull/2387)) ([b9f64b7](https://github.com/newrelic/node-newrelic/commit/b9f64b76b8777fc790a4694a95318f401a56abdd))
81
+ * Updated `@newrelic/native-metrics` to 11.0.0 ([#2412](https://github.com/newrelic/node-newrelic/pull/2412)) ([aef69e2](https://github.com/newrelic/node-newrelic/commit/aef69e28cc3ead2079cfc0bdf9bde74129a3711f))
82
+ * Updated dashboard links in developer-setup.md ([#2397](https://github.com/newrelic/node-newrelic/pull/2397)) ([16866da](https://github.com/newrelic/node-newrelic/commit/16866da381366ad848ea06be44fd838d57c9fb67))
83
+ * Verified MySQL host:port metric is recorded ([#2400](https://github.com/newrelic/node-newrelic/pull/2400)) ([74176f7](https://github.com/newrelic/node-newrelic/commit/74176f77f70247a3cf65b1b49c5414279b4eeca6))
84
+
85
+ #### Tests
86
+
87
+ * Removed mongodb-esm tests as they are not atomic and conflicting with mongodb tests in CI ([#2416](https://github.com/newrelic/node-newrelic/pull/2416)) ([e587b9d](https://github.com/newrelic/node-newrelic/commit/e587b9dcb795cca3c29c6e0da18770401c3085a0))
88
+ * Updated minimum version of lesser used versions of 3rd party libraries ([#2399](https://github.com/newrelic/node-newrelic/pull/2399)) ([ef8c006](https://github.com/newrelic/node-newrelic/commit/ef8c00674c22b4794c6cee823d46ad9db7d67fed))
89
+
90
+ ### v11.23.2 (2024-07-22)
91
+
92
+ #### Features
93
+
94
+ * Added support for `fs.glob` in Node 22+ ([#2369](https://github.com/newrelic/node-newrelic/pull/2369)) ([1791a4e](https://github.com/newrelic/node-newrelic/commit/1791a4ef4a31e36757c47a9947ef8840fdd995c2))
95
+
96
+ #### Bug fixes
97
+
98
+ * Updated aws-sdk v3 instrumentation to load custom middleware last to properly get the external http span to add `aws.*` attributes ([#2382](https://github.com/newrelic/node-newrelic/pull/2382)) ([751801b](https://github.com/newrelic/node-newrelic/commit/751801be814343c9ddcee3dd7e83f87a1c6786d4))
99
+ * Updated cassandra-driver instrumentation to properly trace promise based executions ([#2351](https://github.com/newrelic/node-newrelic/pull/2351)) ([bab9a8b](https://github.com/newrelic/node-newrelic/commit/bab9a8bab4ab6af8efa70d8559bdcc7ca6f5df32))
100
+
101
+ #### Documentation
102
+
103
+ * Removed examples/api/ ([#2381](https://github.com/newrelic/node-newrelic/pull/2381)) ([fb964de](https://github.com/newrelic/node-newrelic/commit/fb964de863f8989161f9a780f9eddc6e3ec91138))
104
+ * Removed out of date `ROADMAP_Node.md` from root of project ([#2367](https://github.com/newrelic/node-newrelic/pull/2367)) ([4be870c](https://github.com/newrelic/node-newrelic/commit/4be870c758d9b931866ef3e6781d01bf176671a9))
105
+ * Updated compatibility report ([#2345](https://github.com/newrelic/node-newrelic/pull/2345)) ([f08adc3](https://github.com/newrelic/node-newrelic/commit/f08adc3a30bdf3e5d23bd00efeb3b16ac06cd3e5))
106
+
107
+ #### Miscellaneous chores
108
+
109
+ * Always upload status logs in compatibility report CI ([#2341](https://github.com/newrelic/node-newrelic/pull/2341)) ([b3f1ee3](https://github.com/newrelic/node-newrelic/commit/b3f1ee3fe40c38c7484661dfb2e599df4f31003e))
110
+
111
+ #### Tests
112
+
113
+ * Removed `server.start` in grpc tests as it is deprecated and no longer needed ([#2372](https://github.com/newrelic/node-newrelic/pull/2372)) ([d212b15](https://github.com/newrelic/node-newrelic/commit/d212b15c929ebca22881f3d41a8d7f99033847a8))
114
+ * Updated benchmark test results to output result files ([#2350](https://github.com/newrelic/node-newrelic/pull/2350)) ([1b51a68](https://github.com/newrelic/node-newrelic/commit/1b51a68200dae14b865a6db06d62655a25a62c2d))
115
+
116
+ #### Continuous integration
117
+
118
+ * Added benchmark test GitHub Action ([#2366](https://github.com/newrelic/node-newrelic/pull/2366)) ([afd3ab4](https://github.com/newrelic/node-newrelic/commit/afd3ab48611ec8409be1472ebbc63db24cff8e73))
119
+ * Increased the limit of installs from 2 to a bigger number for versioned tests ([#2346](https://github.com/newrelic/node-newrelic/pull/2346)) ([f85a385](https://github.com/newrelic/node-newrelic/commit/f85a38524f1d41e82b2c5085c41d79d1263b63c3))
120
+ * Updated `bin/create-docs-pr` to create an empty array if changelog.json is missing security ([#2348](https://github.com/newrelic/node-newrelic/pull/2348)) ([7d5368c](https://github.com/newrelic/node-newrelic/commit/7d5368ce873affbf2593bd6b1cc32259da852e1d))
121
+
122
+ ### v11.23.1 (2024-07-11)
123
+
124
+ #### Bug fixes
125
+
126
+ * Updated redis v4 instrumentation to work with transactions(multi/exec) ([#2343](https://github.com/newrelic/node-newrelic/pull/2343)) ([39eb842](https://github.com/newrelic/node-newrelic/commit/39eb8421b84f7fe298acf5c9c89de31ee0cc2604))
127
+
128
+ #### Documentation
129
+
130
+ * Updated compatibility report ([#2342](https://github.com/newrelic/node-newrelic/pull/2342)) ([5c9e3e6](https://github.com/newrelic/node-newrelic/commit/5c9e3e6bfa8a388c7dd071ecb0231b069f065645))
131
+
82
132
  ### v11.23.0 (2024-07-10)
83
133
 
84
134
  #### Features
@@ -71,6 +71,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
71
71
  * [proxyquire](#proxyquire)
72
72
  * [rfdc](#rfdc)
73
73
  * [rimraf](#rimraf)
74
+ * [self-cert](#self-cert)
74
75
  * [should](#should)
75
76
  * [sinon](#sinon)
76
77
  * [superagent](#superagent)
@@ -4023,6 +4024,22 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4023
4024
 
4024
4025
  ```
4025
4026
 
4027
+ ### self-cert
4028
+
4029
+ This product includes source derived from [self-cert](https://github.com/jsumners/self-cert) ([v2.0.0](https://github.com/jsumners/self-cert/tree/v2.0.0)), distributed under the [MIT License](https://github.com/jsumners/self-cert/blob/v2.0.0/Readme.md):
4030
+
4031
+ ```
4032
+ MIT License
4033
+
4034
+ Copyright (c) <year> <copyright holders>
4035
+
4036
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4037
+
4038
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
4039
+
4040
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4041
+ ```
4042
+
4026
4043
  ### should
4027
4044
 
4028
4045
  This product includes source derived from [should](https://github.com/shouldjs/should.js) ([v13.2.3](https://github.com/shouldjs/should.js/tree/v13.2.3)), distributed under the [MIT License](https://github.com/shouldjs/should.js/blob/v13.2.3/LICENSE):
@@ -4053,7 +4070,7 @@ THE SOFTWARE.
4053
4070
 
4054
4071
  ### sinon
4055
4072
 
4056
- This product includes source derived from [sinon](https://github.com/sinonjs/sinon) ([v4.5.0](https://github.com/sinonjs/sinon/tree/v4.5.0)), distributed under the [BSD-3-Clause License](https://github.com/sinonjs/sinon/blob/v4.5.0/LICENSE):
4073
+ This product includes source derived from [sinon](https://github.com/sinonjs/sinon) ([v5.1.1](https://github.com/sinonjs/sinon/tree/v5.1.1)), distributed under the [BSD-3-Clause License](https://github.com/sinonjs/sinon/blob/v5.1.1/LICENSE):
4057
4074
 
4058
4075
  ```
4059
4076
  (The BSD License)
@@ -93,7 +93,7 @@ function getRedisParams(clientOpts) {
93
93
  // see: https://github.com/redis/node-redis/blob/5576a0db492cda2cd88e09881bc330aa956dd0f5/packages/client/lib/client/index.ts#L160
94
94
  if (clientOpts?.url) {
95
95
  const parsedURL = new URL(clientOpts.url)
96
- clientOpts.socket = { host: parsedURL.hostname }
96
+ clientOpts.socket = Object.assign({}, clientOpts.socket, { host: parsedURL.hostname })
97
97
  if (parsedURL.port) {
98
98
  clientOpts.socket.port = parsedURL.port
99
99
  }
@@ -104,8 +104,9 @@ function getRedisParams(clientOpts) {
104
104
  }
105
105
 
106
106
  return new DatastoreParameters({
107
- host: clientOpts?.socket?.host || 'localhost',
108
- port_path_or_id: clientOpts?.socket?.path || clientOpts?.socket?.port || '6379',
107
+ host: clientOpts?.host || clientOpts?.socket?.host || 'localhost',
108
+ port_path_or_id:
109
+ clientOpts?.port || clientOpts?.socket?.path || clientOpts?.socket?.port || '6379',
109
110
  database_name: clientOpts?.database || 0
110
111
  })
111
112
  }
@@ -9,10 +9,10 @@ const {
9
9
  OperationSpec,
10
10
  params: { DatastoreParameters }
11
11
  } = require('../../shim/specs')
12
- const url = require('url')
13
12
  const wrapModel = require('./channel-model')
14
- const { setCallback } = require('./utils')
13
+ const { setCallback, parseConnectionArgs } = require('./utils')
15
14
  const wrapChannel = require('./channel')
15
+ const { amqpConnection } = require('../../symbols')
16
16
 
17
17
  module.exports.instrumentPromiseAPI = instrumentChannelAPI
18
18
  module.exports.instrumentCallbackAPI = instrumentCallbackAPI
@@ -73,31 +73,52 @@ function instrumentAMQP(shim, amqp, promiseMode) {
73
73
  /**
74
74
  *
75
75
  * Instruments the connect method
76
+ * We have to both wrap and record because
77
+ * we need the host/port for all subsequent calls on the model/channel
78
+ * but record only completes in an active transaction
76
79
  *
77
80
  * @param {Shim} shim instance of shim
78
81
  * @param {object} amqp amqplib object
79
82
  * @param {boolean} promiseMode is this promise based?
80
83
  */
81
84
  function wrapConnect(shim, amqp, promiseMode) {
82
- shim.record(amqp, 'connect', function recordConnect(shim, connect, name, args) {
83
- let [connArgs] = args
84
- const params = new DatastoreParameters()
85
+ shim.wrap(amqp, 'connect', function wrapConnect(shim, connect) {
86
+ return function wrappedConnect() {
87
+ const args = shim.argsToArray.apply(shim, arguments)
88
+ const [connArgs] = args
89
+ const params = parseConnectionArgs({ shim, connArgs })
90
+ const cb = args[args.length - 1]
91
+ if (!promiseMode) {
92
+ args[args.length - 1] = function wrappedCallback() {
93
+ const cbArgs = shim.argsToArray.apply(shim, arguments)
94
+ const [, c] = cbArgs
95
+ c.connection[amqpConnection] = params
96
+ return cb.apply(this, cbArgs)
97
+ }
98
+ }
85
99
 
86
- if (shim.isString(connArgs)) {
87
- connArgs = url.parse(connArgs)
88
- params.host = connArgs.hostname
89
- if (connArgs.port) {
90
- params.port = connArgs.port
100
+ const result = connect.apply(this, args)
101
+ if (promiseMode) {
102
+ return result.then((c) => {
103
+ c.connection[amqpConnection] = params
104
+ return c
105
+ })
91
106
  }
107
+ return result
92
108
  }
109
+ })
93
110
 
111
+ shim.record(amqp, 'connect', function recordConnect(shim, connect, name, args) {
112
+ const [connArgs] = args
113
+ const params = parseConnectionArgs({ shim, connArgs })
94
114
  return new OperationSpec({
95
115
  name: 'amqplib.connect',
96
116
  callback: setCallback(shim, promiseMode),
97
117
  promise: promiseMode,
98
- parameters: params,
99
- stream: null,
100
- recorder: null
118
+ parameters: new DatastoreParameters({
119
+ host: params.host,
120
+ port_path_or_id: params.port
121
+ })
101
122
  })
102
123
  })
103
124
  }
@@ -5,6 +5,7 @@
5
5
 
6
6
  'use strict'
7
7
  const { MessageSpec, MessageSubscribeSpec, RecorderSpec } = require('../../shim/specs')
8
+ const { amqpConnection } = require('../../symbols')
8
9
  const CHANNEL_METHODS = [
9
10
  'close',
10
11
  'open',
@@ -22,13 +23,7 @@ const CHANNEL_METHODS = [
22
23
  'prefetch',
23
24
  'recover'
24
25
  ]
25
- const {
26
- describeMessage,
27
- setCallback,
28
- parseConnect,
29
- getParametersFromMessage,
30
- TEMP_RE
31
- } = require('./utils')
26
+ const { describeMessage, setCallback, getParametersFromMessage, TEMP_RE } = require('./utils')
32
27
 
33
28
  /**
34
29
  *
@@ -89,7 +84,7 @@ function recordPurge({ shim, proto, promiseMode }) {
89
84
 
90
85
  function recordGet({ shim, proto, promiseMode }) {
91
86
  shim.recordConsume(proto, 'get', function wrapGet() {
92
- const { host, port } = parseConnect(this?.connection?.stream)
87
+ const { host, port } = this?.connection?.[amqpConnection] || {}
93
88
  return new MessageSpec({
94
89
  destinationName: shim.FIRST,
95
90
  callback: setCallback(shim, promiseMode),
@@ -115,7 +110,7 @@ function recordGet({ shim, proto, promiseMode }) {
115
110
 
116
111
  function recordConsume({ shim, proto, promiseMode }) {
117
112
  shim.recordSubscribedConsume(proto, 'consume', function consume() {
118
- const { host, port } = parseConnect(this?.connection?.stream)
113
+ const { host, port } = this?.connection?.[amqpConnection] || {}
119
114
  return new MessageSubscribeSpec({
120
115
  name: 'amqplib.Channel#consume',
121
116
  queue: shim.FIRST,
@@ -5,7 +5,8 @@
5
5
 
6
6
  'use strict'
7
7
  const { MessageSpec } = require('../../shim/specs')
8
- const { parseConnect, getParameters, TEMP_RE } = require('./utils')
8
+ const { amqpConnection } = require('../../symbols')
9
+ const { getParameters, TEMP_RE } = require('./utils')
9
10
 
10
11
  /**
11
12
  *
@@ -47,24 +48,26 @@ module.exports = function wrapChannel(shim) {
47
48
  }
48
49
  })
49
50
 
50
- shim.recordProduce(proto, 'sendMessage', function recordSendMessage(shim, fn, n, args) {
51
- const fields = args[0]
52
- if (!fields) {
53
- return null
54
- }
55
- const isDefault = fields.exchange === ''
56
- let exchange = 'Default'
57
- if (!isDefault) {
58
- exchange = TEMP_RE.test(fields.exchange) ? null : fields.exchange
59
- }
60
- const { host, port } = parseConnect(this?.connection?.stream)
51
+ shim.recordProduce(proto, 'sendMessage', recordSendMessage)
52
+ }
53
+
54
+ function recordSendMessage(shim, fn, n, args) {
55
+ const fields = args[0]
56
+ if (!fields) {
57
+ return null
58
+ }
59
+ const isDefault = fields.exchange === ''
60
+ let exchange = 'Default'
61
+ if (!isDefault) {
62
+ exchange = TEMP_RE.test(fields.exchange) ? null : fields.exchange
63
+ }
64
+ const { host, port } = this?.connection?.[amqpConnection] || {}
61
65
 
62
- return new MessageSpec({
63
- destinationName: exchange,
64
- destinationType: shim.EXCHANGE,
65
- routingKey: fields.routingKey,
66
- headers: fields.headers,
67
- parameters: getParameters({ parameters: Object.create(null), fields, host, port })
68
- })
66
+ return new MessageSpec({
67
+ destinationName: exchange,
68
+ destinationType: shim.EXCHANGE,
69
+ routingKey: fields.routingKey,
70
+ headers: fields.headers,
71
+ parameters: getParameters({ parameters: Object.create(null), fields, host, port })
69
72
  })
70
73
  }
@@ -8,7 +8,6 @@ const {
8
8
  MessageSpec,
9
9
  params: { QueueMessageParameters }
10
10
  } = require('../../shim/specs')
11
- const { amqpConnection } = require('../../symbols')
12
11
  const TEMP_RE = /^amq\./
13
12
 
14
13
  /**
@@ -100,25 +99,6 @@ function getParametersFromMessage({ message, host, port }) {
100
99
  return parameters
101
100
  }
102
101
 
103
- /**
104
- * Extracts the host/port from the amqp socket connection.
105
- * Stores on connection as symbol to only parse once.
106
- *
107
- * @param {Socket} socket amqp connection
108
- * @returns {object} {host, port } of connection
109
- */
110
- function parseConnect(socket) {
111
- if (socket[amqpConnection]) {
112
- return socket[amqpConnection]
113
- }
114
- const host = ['127.0.0.1', '::1', '[::1]'].includes(socket?.remoteAddress)
115
- ? 'localhost'
116
- : socket?.remoteAddress
117
- const port = socket?.remotePort
118
- socket[amqpConnection] = { host, port }
119
- return { host, port }
120
- }
121
-
122
102
  /**
123
103
  * Helper to set the appropriate value of the callback property
124
104
  * in the spec. If it's a promise set to null otherwise set it to `shim.LAST`
@@ -131,11 +111,33 @@ function setCallback(shim, promiseMode) {
131
111
  return promiseMode ? null : shim.LAST
132
112
  }
133
113
 
114
+ /**
115
+ * Parses the connection args to return host/port
116
+ *
117
+ * @param {string|object} connArgs connection arguments
118
+ * @returns {object} {host, port }
119
+ */
120
+ function parseConnectionArgs({ shim, connArgs }) {
121
+ const params = {}
122
+ if (shim.isString(connArgs)) {
123
+ connArgs = new URL(connArgs)
124
+ params.host = connArgs.hostname
125
+ if (connArgs.port) {
126
+ params.port = parseInt(connArgs.port, 10)
127
+ }
128
+ } else {
129
+ params.port = connArgs.port || (connArgs.protocol === 'amqp' ? 5672 : 5671)
130
+ params.host = connArgs.hostname
131
+ }
132
+
133
+ return params
134
+ }
135
+
134
136
  module.exports = {
135
137
  describeMessage,
136
138
  getParameters,
137
139
  getParametersFromMessage,
138
- parseConnect,
140
+ parseConnectionArgs,
139
141
  setCallback,
140
142
  TEMP_RE
141
143
  }
@@ -50,10 +50,26 @@ function getSqsSpec(shim, original, name, args) {
50
50
  callback: shim.LAST,
51
51
  destinationName: grabLastUrlSegment(QueueUrl),
52
52
  destinationType: shim.QUEUE,
53
- opaque: true
53
+ opaque: true,
54
+ after({ segment }) {
55
+ const { region, accountId, queue } = urlComponents(QueueUrl)
56
+ segment.addAttribute('messaging.system', 'aws_sqs')
57
+ segment.addAttribute('cloud.region', region)
58
+ segment.addAttribute('cloud.account.id', accountId)
59
+ segment.addAttribute('messaging.destination.name', queue)
60
+ }
54
61
  })
55
62
  }
56
63
 
64
+ const urlReg = /\/\/sqs\.(?<region>[\w-]+)\.amazonaws\.com(:\d+)?\/(?<accountId>\d+)\/(?<queue>.+)$/
65
+ function urlComponents(queueUrl) {
66
+ const matches = urlReg.exec(queueUrl)
67
+ if (matches?.groups) {
68
+ return matches.groups
69
+ }
70
+ return { region: undefined, accountId: undefined, queue: undefined }
71
+ }
72
+
57
73
  module.exports.sqsMiddlewareConfig = {
58
74
  middleware: sqsMiddleware,
59
75
  init(shim) {
@@ -11,7 +11,7 @@ function recordLinkingMetrics({ agent, brokers, topic, producer = true }) {
11
11
  const kind = producer === true ? 'Produce' : 'Consume'
12
12
  for (const broker of brokers) {
13
13
  agent.metrics
14
- .getOrCreateMetric(`MessageBroker/Kafka/Nodes/${broker}/${kind}/Named/${topic}`)
14
+ .getOrCreateMetric(`MessageBroker/Kafka/Nodes/${broker}/${kind}/${topic}`)
15
15
  .incrementCallCount()
16
16
  }
17
17
  }
@@ -34,7 +34,20 @@ module.exports = function instrument(shim, tools) {
34
34
  const metrics = agent.metrics
35
35
  createModuleUsageMetric('pino', metrics)
36
36
 
37
+ wrapAsJson({ shim, tools })
38
+ }
39
+
40
+ /**
41
+ * Wraps `asJson` to properly decorate and forward logs
42
+ *
43
+ * @param {object} params to function
44
+ * @param {Shim} params.shim instance of shim
45
+ * @param {object} params.tools exported `pino/lib/tools`
46
+ */
47
+ function wrapAsJson({ shim, tools }) {
37
48
  const symbols = shim.require('./lib/symbols')
49
+ const { agent } = shim
50
+ const { config, metrics } = agent
38
51
 
39
52
  shim.wrap(tools, 'asJson', function wrapJson(shim, asJson) {
40
53
  /**
@@ -50,13 +63,21 @@ module.exports = function instrument(shim, tools) {
50
63
  return function wrappedAsJson() {
51
64
  const args = shim.argsToArray.apply(shim, arguments)
52
65
  const level = this?.levels?.labels?.[args[2]]
66
+ // Pino log methods accept a singular object (a merging object) that can
67
+ // have a `msg` property for the log message. In such cases, we need to
68
+ // update that log property instead of the second parameter.
69
+ const useMergeObj = args[1] === undefined && Object.hasOwn(args[0], 'msg')
53
70
 
54
71
  if (isMetricsEnabled(config)) {
55
72
  incrementLoggingLinesMetrics(level, metrics)
56
73
  }
57
74
 
58
75
  if (isLocalDecoratingEnabled(config)) {
59
- args[1] += agent.getNRLinkingMetadata()
76
+ if (useMergeObj === true) {
77
+ args[0].msg += agent.getNRLinkingMetadata()
78
+ } else {
79
+ args[1] += agent.getNRLinkingMetadata()
80
+ }
60
81
  }
61
82
 
62
83
  /**
@@ -69,7 +90,7 @@ module.exports = function instrument(shim, tools) {
69
90
  if (isLogForwardingEnabled(config, agent)) {
70
91
  const chindings = this[symbols.chindingsSym]
71
92
  const formatLogLine = reformatLogLine({
72
- msg: args[1],
93
+ msg: useMergeObj === true ? args[0].msg : args[1],
73
94
  logLine,
74
95
  agent,
75
96
  chindings,
@@ -89,16 +110,14 @@ module.exports = function instrument(shim, tools) {
89
110
  * reformats error and assigns NR context data
90
111
  * to log line
91
112
  *
92
- * @param logLine.logLine
93
- * @param {object} logLine log line
94
- * @param {object} metadata NR context data
95
- * @param {string} chindings serialized string of all common log line data
96
- * @param logLine.args
97
- * @param logLine.agent
98
- * @param logLine.chindings
99
- * @param logLine.msg
100
- * @param logLine.level
101
- * @param logLine.logger
113
+ * @param {object} params to function
114
+ * @param {object} params.logLine log line
115
+ * @param {string} params.msg message of log line
116
+ * @param {object} params.agent instance of agent
117
+ * @param {string} params.chindings serialized string of all common log line data
118
+ * @param {string} params.level log level
119
+ * @param {object} params.logger instance of agent logger
120
+ * @returns {function} wrapped log formatter function
102
121
  */
103
122
  function reformatLogLine({ logLine, msg, agent, chindings = '', level, logger }) {
104
123
  const metadata = agent.getLinkingMetadata()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "12.0.0",
3
+ "version": "12.1.1",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [
@@ -256,8 +256,9 @@
256
256
  "proxyquire": "^1.8.0",
257
257
  "rfdc": "^1.3.1",
258
258
  "rimraf": "^2.6.3",
259
+ "self-cert": "^2.0.0",
259
260
  "should": "*",
260
- "sinon": "^4.5.0",
261
+ "sinon": "^5.1.1",
261
262
  "superagent": "^9.0.1",
262
263
  "tap": "^16.3.4",
263
264
  "temp": "^0.8.1"