newrelic 11.8.0 → 11.9.0

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,32 +1,59 @@
1
- ### v11.8.0 (2024-01-03)
2
-
3
- #### Features
4
-
5
- * Removed `api.setLlmMetadata` ([#1918](https://github.com/newrelic/node-newrelic/pull/1918)) ([cc4a975](https://github.com/newrelic/node-newrelic/commit/cc4a975a3f020648d183ce620e244ba0a09c286d))
6
- * It will be assigned via `api.addCustomAttribute` with a prefix of `llm.` * The conversation_id will now be assigned from `llm.conversation_id` custom attribute
7
- * Updated SQL obfuscation tokenizer to better handle negative numbers and boolean values.
8
-
9
- #### Bug fixes
10
-
11
- * Ensure opts.headers is defined in http instrumentation ([#1926](https://github.com/newrelic/node-newrelic/pull/1926)) ([7ea31a3](https://github.com/newrelic/node-newrelic/commit/7ea31a3c3ff45567cf102da6bbec4b9e68af9602))
12
-
13
- #### Code refactoring
14
-
15
- * Updated `lib/instrumentation/core/http.js` to reduce the cognitive complexity to an allowable value ([#1922](https://github.com/newrelic/node-newrelic/pull/1922)) ([4c30d97](https://github.com/newrelic/node-newrelic/commit/4c30d977ca74421cfa396c2f86383212e40475e1))
16
- * Updated `lib/shim/promise-shim.js` to reduce the cognitive complexity ([#1924](https://github.com/newrelic/node-newrelic/pull/1924)) ([bd0a5dc](https://github.com/newrelic/node-newrelic/commit/bd0a5dc95c8077794c30c5ebe25f0e153aefb1b4))
17
- * Updated `lib/shim/webframework-shim.js` to reduce the cognitive complexity ([#1927](https://github.com/newrelic/node-newrelic/pull/1927)) ([1ce371e](https://github.com/newrelic/node-newrelic/commit/1ce371e69fd8db7306137c749b9e5486aaacd434))
18
-
19
- #### Miscellaneous chores
20
-
21
- * **deps:** Updated @newrelic/security-agent to v0.6.0 ([#1929](https://github.com/newrelic/node-newrelic/pull/1929)) ([4e09927](https://github.com/newrelic/node-newrelic/commit/4e0992709f8bd07b941a8c7adf0aa51481b0282e))
22
-
23
- #### Tests
24
-
25
- * Refactored tests that were still using the tap mocha shim + chai to now use tap. ([#1919](https://github.com/newrelic/node-newrelic/pull/1919)) ([957529e](https://github.com/newrelic/node-newrelic/commit/957529e901115a16ed31c4663e460e4044d9a09d))
26
- * removed access to deprecated `req._headers` and instead use `req.headers` ([#1923](https://github.com/newrelic/node-newrelic/pull/1923)) ([0ec2f66](https://github.com/newrelic/node-newrelic/commit/0ec2f6669bf90e54af8eddad7b42aa029a7ef517))
27
- * updated the cross agent tests, made updates to tests based on fixture changes ([#1917](https://github.com/newrelic/node-newrelic/pull/1917)) ([2d666b6](https://github.com/newrelic/node-newrelic/commit/2d666b6e47d6ad7ecf14aa832a6ae1fbd15ee973))
28
- * Updated `helper.randomPort` to use `crypto.randomInt` instead of `Math.random` by using crypto lib ([#1921](https://github.com/newrelic/node-newrelic/pull/1921)) ([9003791](https://github.com/newrelic/node-newrelic/commit/9003791e934efb7ab284406735b334bd9ae4872c))
29
-
1
+ ### v11.9.0 (2024-01-10)
2
+
3
+ #### Features
4
+
5
+ * Assign pkgVersion and id of all child shim instances when using shim.makeSpecializedShim with a ConglomerateShim instance ([#1941](https://github.com/newrelic/node-newrelic/pull/1941)) ([d3e393d](https://github.com/newrelic/node-newrelic/commit/d3e393da4ece46853b01f88878d487a1336634bf))
6
+
7
+ #### Bug fixes
8
+
9
+ * Dropped support for ElasticSearch < 7.16.0 ([#1940](https://github.com/newrelic/node-newrelic/pull/1940)) ([e017768](https://github.com/newrelic/node-newrelic/commit/e017768466c9ca80b16cf1b51155801c3ecf0cc4))
10
+ * Previously, New Relic's Node Agent instrumented ElasticSearch as early as v7.13.0, which was susceptible to crashing when using ElasticSearch's `.helper` API. ElasticSearch [fixed this bug in v7.16.0](https://github.com/elastic/elasticsearch-js/pull/1594), so we now support instrumentation from that version onward, and previous versions are noops.
11
+ * Removed extra / in openai framework metric name ([#1938](https://github.com/newrelic/node-newrelic/pull/1938)) ([7f586c3](https://github.com/newrelic/node-newrelic/commit/7f586c36f6fc119f4dac6e075468d90d43ff07fe))
12
+
13
+ #### Security improvements
14
+
15
+ * **deps:** bump follow-redirects from 1.15.2 to 1.15.4 ([#1942](https://github.com/newrelic/node-newrelic/pull/1942)) ([c1b04b6](https://github.com/newrelic/node-newrelic/commit/c1b04b69ce15173c88517b4baf920546e187ba07))
16
+
17
+ #### Miscellaneous chores
18
+
19
+ * Removed assigning unused metadata to LLM events ([#1932](https://github.com/newrelic/node-newrelic/pull/1932)) ([2f67d49](https://github.com/newrelic/node-newrelic/commit/2f67d496557d6192835e4b4b9cced8b7a2d932c0))
20
+
21
+ #### Tests
22
+
23
+ * Fix DNS lookup in remote-method test ([#1937](https://github.com/newrelic/node-newrelic/pull/1937)) ([4da2149](https://github.com/newrelic/node-newrelic/commit/4da2149f3c48137bc3a5005ff12d29b0c8bee1d7))
24
+ * removed console log ([#1939](https://github.com/newrelic/node-newrelic/pull/1939)) ([7d378aa](https://github.com/newrelic/node-newrelic/commit/7d378aa9ba7b0e529dc0da24b2ee767735631b16))
25
+ * updated abort controller test expected error message based on undici version ([#1935](https://github.com/newrelic/node-newrelic/pull/1935)) ([3e79cc7](https://github.com/newrelic/node-newrelic/commit/3e79cc77c8d10f84de71cf9a20c0c4f0642b7450))
26
+ * updated chat-completions tests to properly assert segments ([#1931](https://github.com/newrelic/node-newrelic/pull/1931)) ([10762a7](https://github.com/newrelic/node-newrelic/commit/10762a7c2c884c459af76d1877cd57641e572678))
27
+
28
+ ### v11.8.0 (2024-01-03)
29
+
30
+ #### Features
31
+
32
+ * Removed `api.setLlmMetadata` ([#1918](https://github.com/newrelic/node-newrelic/pull/1918)) ([cc4a975](https://github.com/newrelic/node-newrelic/commit/cc4a975a3f020648d183ce620e244ba0a09c286d))
33
+ * It will be assigned via `api.addCustomAttribute` with a prefix of `llm.` * The conversation_id will now be assigned from `llm.conversation_id` custom attribute
34
+ * Updated SQL obfuscation tokenizer to better handle negative numbers and boolean values.
35
+
36
+ #### Bug fixes
37
+
38
+ * Ensure opts.headers is defined in http instrumentation ([#1926](https://github.com/newrelic/node-newrelic/pull/1926)) ([7ea31a3](https://github.com/newrelic/node-newrelic/commit/7ea31a3c3ff45567cf102da6bbec4b9e68af9602))
39
+
40
+ #### Code refactoring
41
+
42
+ * Updated `lib/instrumentation/core/http.js` to reduce the cognitive complexity to an allowable value ([#1922](https://github.com/newrelic/node-newrelic/pull/1922)) ([4c30d97](https://github.com/newrelic/node-newrelic/commit/4c30d977ca74421cfa396c2f86383212e40475e1))
43
+ * Updated `lib/shim/promise-shim.js` to reduce the cognitive complexity ([#1924](https://github.com/newrelic/node-newrelic/pull/1924)) ([bd0a5dc](https://github.com/newrelic/node-newrelic/commit/bd0a5dc95c8077794c30c5ebe25f0e153aefb1b4))
44
+ * Updated `lib/shim/webframework-shim.js` to reduce the cognitive complexity ([#1927](https://github.com/newrelic/node-newrelic/pull/1927)) ([1ce371e](https://github.com/newrelic/node-newrelic/commit/1ce371e69fd8db7306137c749b9e5486aaacd434))
45
+
46
+ #### Miscellaneous chores
47
+
48
+ * **deps:** Updated @newrelic/security-agent to v0.6.0 ([#1929](https://github.com/newrelic/node-newrelic/pull/1929)) ([4e09927](https://github.com/newrelic/node-newrelic/commit/4e0992709f8bd07b941a8c7adf0aa51481b0282e))
49
+
50
+ #### Tests
51
+
52
+ * Refactored tests that were still using the tap mocha shim + chai to now use tap. ([#1919](https://github.com/newrelic/node-newrelic/pull/1919)) ([957529e](https://github.com/newrelic/node-newrelic/commit/957529e901115a16ed31c4663e460e4044d9a09d))
53
+ * removed access to deprecated `req._headers` and instead use `req.headers` ([#1923](https://github.com/newrelic/node-newrelic/pull/1923)) ([0ec2f66](https://github.com/newrelic/node-newrelic/commit/0ec2f6669bf90e54af8eddad7b42aa029a7ef517))
54
+ * updated the cross agent tests, made updates to tests based on fixture changes ([#1917](https://github.com/newrelic/node-newrelic/pull/1917)) ([2d666b6](https://github.com/newrelic/node-newrelic/commit/2d666b6e47d6ad7ecf14aa832a6ae1fbd15ee973))
55
+ * Updated `helper.randomPort` to use `crypto.randomInt` instead of `Math.random` by using crypto lib ([#1921](https://github.com/newrelic/node-newrelic/pull/1921)) ([9003791](https://github.com/newrelic/node-newrelic/commit/9003791e934efb7ab284406735b334bd9ae4872c))
56
+
30
57
  ### v11.7.0 (2023-12-14)
31
58
 
32
59
  #### Features
@@ -20,10 +20,10 @@ const { isNotEmpty } = require('../../util/objects')
20
20
  */
21
21
  module.exports = function initialize(_agent, elastic, _moduleName, shim) {
22
22
  const pkgVersion = shim.pkgVersion
23
- if (semver.lt(pkgVersion, '7.13.0')) {
23
+ if (semver.lt(pkgVersion, '7.16.0')) {
24
24
  shim &&
25
25
  shim.logger.debug(
26
- `ElasticSearch support is for versions 7.13.0 and above. Not instrumenting ${pkgVersion}.`
26
+ `ElasticSearch support is for versions 7.16.0 and above. Not instrumenting ${pkgVersion}.`
27
27
  )
28
28
  return
29
29
  }
@@ -70,6 +70,7 @@ function queryParser(params) {
70
70
  } else if (Array.isArray(params.bulkBody) && params.bulkBody.length) {
71
71
  queryParam = params.bulkBody
72
72
  }
73
+ // The helper interface provides a simpler API:
73
74
 
74
75
  const query = JSON.stringify(queryParam)
75
76
 
@@ -76,7 +76,6 @@ function decorateSegment({ shim, result, apiKey }) {
76
76
  */
77
77
  function recordEvent({ agent, type, msg }) {
78
78
  agent.metrics.getOrCreateMetric(TRACKING_METRIC).incrementCallCount()
79
- msg = agent?.llm?.metadata ? { ...agent.llm.metadata, ...msg } : msg
80
79
  agent.customEventAggregator.add([{ type, timestamp: Date.now() }, msg])
81
80
  }
82
81
 
@@ -165,7 +165,7 @@ const EXPRESS = {
165
165
  }
166
166
 
167
167
  const AI = {
168
- TRACKING_PREFIX: 'Nodejs/ML/',
168
+ TRACKING_PREFIX: 'Nodejs/ML',
169
169
  EMBEDDING: 'Llm/embedding',
170
170
  COMPLETION: 'Llm/completion'
171
171
  }
@@ -65,7 +65,15 @@ class ConglomerateShim extends Shim {
65
65
  */
66
66
  makeSpecializedShim(type, submodule) {
67
67
  const ShimClass = SHIM_CLASSES[type]
68
- const shim = new ShimClass(this.agent, this.moduleName, this._resolvedName)
68
+ const shim = new ShimClass(
69
+ this.agent,
70
+ this.moduleName,
71
+ this._resolvedName,
72
+ null,
73
+ this.pkgVersion
74
+ )
75
+ // associate the parent shim.id with the new submodule
76
+ shim.id = this.id
69
77
  shim._logger = shim._logger.child({ submodule })
70
78
  return shim
71
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "11.8.0",
3
+ "version": "11.9.0",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [