newrelic 12.20.0 → 12.22.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 +60 -0
- package/THIRD_PARTY_NOTICES.md +54 -6
- package/lib/agent.js +8 -0
- package/lib/collector/facts.js +1 -5
- package/lib/config/default.js +57 -1
- package/lib/config/index.js +49 -26
- package/lib/feature_flags.js +10 -10
- package/lib/instrumentation/@google/genai.js +289 -0
- package/lib/instrumentation/@hapi/hapi.js +6 -10
- package/lib/instrumentation/@hapi/vision.js +3 -3
- package/lib/instrumentation/amqplib/amqplib.js +2 -4
- package/lib/instrumentation/amqplib/channel.js +3 -4
- package/lib/instrumentation/bunyan.js +1 -2
- package/lib/instrumentation/cassandra-driver.js +1 -3
- package/lib/instrumentation/core/child_process.js +1 -2
- package/lib/instrumentation/core/fs.js +2 -3
- package/lib/instrumentation/core/inspector.js +1 -2
- package/lib/instrumentation/core/net.js +2 -3
- package/lib/instrumentation/core/zlib.js +2 -3
- package/lib/instrumentation/fastify.js +4 -6
- package/lib/instrumentation/grpc-js/grpc.js +3 -8
- package/lib/instrumentation/kafkajs/consumer.js +2 -4
- package/lib/instrumentation/kafkajs/producer.js +1 -2
- package/lib/instrumentation/koa/router-instrumentation.js +2 -2
- package/lib/instrumentation/openai.js +146 -31
- package/lib/instrumentation/pino/pino.js +2 -2
- package/lib/instrumentation/winston.js +3 -6
- package/lib/instrumentations.js +1 -0
- package/lib/llm-events/aws-bedrock/bedrock-command.js +1 -9
- package/lib/llm-events/aws-bedrock/bedrock-response.js +2 -7
- package/lib/llm-events/aws-bedrock/chat-completion-message.js +1 -1
- package/lib/llm-events/error-message.js +17 -2
- package/lib/llm-events/google-genai/chat-completion-message.js +46 -0
- package/lib/llm-events/google-genai/chat-completion-summary.js +24 -0
- package/lib/llm-events/google-genai/embedding.js +25 -0
- package/lib/llm-events/google-genai/event.js +29 -0
- package/lib/llm-events/google-genai/index.js +18 -0
- package/lib/llm-events/openai/chat-completion-message.js +17 -5
- package/lib/llm-events/openai/chat-completion-summary.js +13 -3
- package/lib/metrics/names.js +6 -0
- package/lib/otel/attr-reconciler.js +7 -9
- package/lib/otel/exception-mapping.js +25 -0
- package/lib/otel/fake-span.js +1 -1
- package/lib/otel/metrics/bootstrap-metrics.js +117 -0
- package/lib/otel/metrics/proxying-exporter.js +75 -0
- package/lib/otel/rules.js +55 -26
- package/lib/otel/segment-synthesis.js +6 -6
- package/lib/otel/segments/consumer.js +7 -20
- package/lib/otel/segments/database.js +40 -75
- package/lib/otel/segments/http-external.js +25 -25
- package/lib/otel/segments/internal.js +2 -2
- package/lib/otel/segments/producer.js +5 -15
- package/lib/otel/segments/server.js +6 -49
- package/lib/otel/setup.js +23 -7
- package/lib/otel/span-processor.js +144 -116
- package/lib/otel/transformation-rules.json +1195 -0
- package/lib/otel/utils.js +162 -0
- package/lib/serverless/aws-lambda.js +6 -6
- package/lib/shim/datastore-shim.js +1 -1
- package/lib/shim/message-shim/subscribe-consume.js +2 -5
- package/lib/shim/promise-shim.js +6 -4
- package/lib/shim/shim.js +12 -11
- package/lib/shim/webframework-shim/middleware-mounter.js +1 -3
- package/lib/transaction/tracer/index.js +1 -1
- package/lib/w3c/tracestate.js +5 -0
- package/package.json +2 -1
- package/lib/otel/attr-mapping/db.js +0 -83
- package/lib/otel/attr-mapping/exceptions.js +0 -23
- package/lib/otel/attr-mapping/faas.js +0 -25
- package/lib/otel/attr-mapping/http.js +0 -193
- package/lib/otel/attr-mapping/messaging.js +0 -105
- package/lib/otel/attr-mapping/utils.js +0 -75
- package/lib/otel/bootstrap-metrics.js +0 -58
- package/lib/otel/rules.json +0 -500
package/NEWS.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
+
### v12.22.0 (2025-06-24)
|
|
2
|
+
|
|
3
|
+
#### Features
|
|
4
|
+
|
|
5
|
+
* Added `openai` v5 streaming support ([#3148](https://github.com/newrelic/node-newrelic/pull/3148)) ([6e90d41](https://github.com/newrelic/node-newrelic/commit/6e90d41756929bf69b82e190dc39792f97ec6d92))
|
|
6
|
+
* Added support for `openai.responses.create` api ([#3139](https://github.com/newrelic/node-newrelic/pull/3139)) ([a1204b2](https://github.com/newrelic/node-newrelic/commit/a1204b2484f3307eac74e7a370be2fc38061c358))
|
|
7
|
+
|
|
8
|
+
#### Bug fixes
|
|
9
|
+
|
|
10
|
+
* Fixed error logging for undefined tracestate header ([#3170](https://github.com/newrelic/node-newrelic/pull/3170)) ([3c915f5](https://github.com/newrelic/node-newrelic/commit/3c915f5a631b609daa6b87f3018e458945077f65))
|
|
11
|
+
|
|
12
|
+
#### Code refactoring
|
|
13
|
+
|
|
14
|
+
* Updated transformation rules to remove the bespoke rule to appease `@google-cloud/pubsub` < 5.1.0 ([#3151](https://github.com/newrelic/node-newrelic/pull/3151)) ([2d9b4b4](https://github.com/newrelic/node-newrelic/commit/2d9b4b4642e856622175adcfd2e31fa4cdfa7a3a))
|
|
15
|
+
|
|
16
|
+
#### Documentation
|
|
17
|
+
|
|
18
|
+
* Gemini compatibility ([#3134](https://github.com/newrelic/node-newrelic/pull/3134)) ([bbdc531](https://github.com/newrelic/node-newrelic/commit/bbdc531ac59aad7b53f1a98306b6857927b87237))
|
|
19
|
+
* Updated compatibility report ([#3171](https://github.com/newrelic/node-newrelic/pull/3171)) ([f3361e4](https://github.com/newrelic/node-newrelic/commit/f3361e421d67a0015719c3ae91bed64e5d38f317))
|
|
20
|
+
|
|
21
|
+
#### Miscellaneous chores
|
|
22
|
+
|
|
23
|
+
* Added logging of used New Relic environment variables ([#3145](https://github.com/newrelic/node-newrelic/pull/3145)) ([1a9d9f5](https://github.com/newrelic/node-newrelic/commit/1a9d9f53ddce7f373a7ff868b363feacf10e3bd8))
|
|
24
|
+
* Added supportability metrics to OTEL metrics API ([#3164](https://github.com/newrelic/node-newrelic/pull/3164)) ([5312db0](https://github.com/newrelic/node-newrelic/commit/5312db0f7c0b4260dd39691e246625380ea2ed12))
|
|
25
|
+
* Fixed formatting in Slack PR titles ([#3167](https://github.com/newrelic/node-newrelic/pull/3167)) ([847859f](https://github.com/newrelic/node-newrelic/commit/847859f8ece852d4fa511039d2131573d4b1392b))
|
|
26
|
+
* Improved output of pending prs script ([#3160](https://github.com/newrelic/node-newrelic/pull/3160)) ([9bafd77](https://github.com/newrelic/node-newrelic/commit/9bafd7758fc63d7fb5106fe0a28aaa5a626bdf3d))
|
|
27
|
+
* Improved setup of OpenTelemetry metrics API ([#3138](https://github.com/newrelic/node-newrelic/pull/3138)) ([e91592d](https://github.com/newrelic/node-newrelic/commit/e91592d8365a3e2543228526d6959751da7ea5aa))
|
|
28
|
+
* Pinned google/genai to <1.5.0 ([#3154](https://github.com/newrelic/node-newrelic/pull/3154)) ([04b9bde](https://github.com/newrelic/node-newrelic/commit/04b9bdef417d6ce9e9148c9489bbfc28081d5e84))
|
|
29
|
+
* Removed discontinued Bedrock models ([#3158](https://github.com/newrelic/node-newrelic/pull/3158)) ([2c79a31](https://github.com/newrelic/node-newrelic/commit/2c79a312daf31f51f8a270facf1c3a125700e987))
|
|
30
|
+
* Removed usage of `shim.argsToArray` in favor of rest parameters ([#3141](https://github.com/newrelic/node-newrelic/pull/3141)) ([b144d71](https://github.com/newrelic/node-newrelic/commit/b144d712f6e75265dc4be6f82a2fc3977ac1c640))
|
|
31
|
+
* Tweaked nestjs test manifest ([#3152](https://github.com/newrelic/node-newrelic/pull/3152)) ([51b82aa](https://github.com/newrelic/node-newrelic/commit/51b82aa28279e0d5ac8be5f4e6a4274532c76a22))
|
|
32
|
+
|
|
33
|
+
#### Tests
|
|
34
|
+
|
|
35
|
+
* Added JSDoc annotation for benchmark interface ([#3127](https://github.com/newrelic/node-newrelic/pull/3127)) ([77e7e0a](https://github.com/newrelic/node-newrelic/commit/77e7e0a27f719ce14d31636e46600ec7ff881b13))
|
|
36
|
+
* fixed test assertion for langchain openai ([#3169](https://github.com/newrelic/node-newrelic/pull/3169)) ([29ec912](https://github.com/newrelic/node-newrelic/commit/29ec9122fdf9347875b884efa6f6fba9cb32303e))
|
|
37
|
+
* Skips running nest 11+ on node 18 due to dropping support ([#3149](https://github.com/newrelic/node-newrelic/pull/3149)) ([961975b](https://github.com/newrelic/node-newrelic/commit/961975baeb74e46c0e60d96cbd49fb421acd0dfd))
|
|
38
|
+
* unpinned google genai tests ([#3168](https://github.com/newrelic/node-newrelic/pull/3168)) ([cfa7114](https://github.com/newrelic/node-newrelic/commit/cfa71142ba7fb9861a1e7ab835276e7c651b9993))
|
|
39
|
+
|
|
40
|
+
### v12.21.0 (2025-06-04)
|
|
41
|
+
|
|
42
|
+
#### Features
|
|
43
|
+
|
|
44
|
+
* Added `@google/genai` Gemini AI LLM instrumentation ([#3119](https://github.com/newrelic/node-newrelic/pull/3119)) ([7f28a29](https://github.com/newrelic/node-newrelic/commit/7f28a293fbd623464ed1f3f809de59eaea0ff367))
|
|
45
|
+
* Updated opentelemetry bridge to rely on configuration based transformation rules ([#3125](https://github.com/newrelic/node-newrelic/pull/3125)) ([ad116d2](https://github.com/newrelic/node-newrelic/commit/ad116d2aa49818c2824bca606a22c48abecf9580))
|
|
46
|
+
|
|
47
|
+
#### Bug fixes
|
|
48
|
+
|
|
49
|
+
* Refactored getHostnameSafe to accommodate GCP ([#3132](https://github.com/newrelic/node-newrelic/pull/3132)) ([f1eea8d](https://github.com/newrelic/node-newrelic/commit/f1eea8d076586cd0b6c4d671c261deefe5e0f027))
|
|
50
|
+
* Updated openai instrumentation to work with 5.0.0+ ([#3129](https://github.com/newrelic/node-newrelic/pull/3129)) ([09146a9](https://github.com/newrelic/node-newrelic/commit/09146a9d550c0cdbb23ec54325be6f8343db8b78))
|
|
51
|
+
* Updated rules to work with 1.17.0 and 1.24.0 for consumer and producer span kind ([#3128](https://github.com/newrelic/node-newrelic/pull/3128)) ([686c747](https://github.com/newrelic/node-newrelic/commit/686c747cedc2582061608c20402f11912092d5b5))
|
|
52
|
+
|
|
53
|
+
#### Documentation
|
|
54
|
+
|
|
55
|
+
* Updated compatibility report ([#3124](https://github.com/newrelic/node-newrelic/pull/3124)) ([c51d45f](https://github.com/newrelic/node-newrelic/commit/c51d45f4fc3c4fd56bdaa80c1028a83c7f4aadd2)) ([#3117](https://github.com/newrelic/node-newrelic/pull/3117)) ([084e599](https://github.com/newrelic/node-newrelic/commit/084e599428ac9c21e6991e27b5c154db2830ce17))
|
|
56
|
+
|
|
57
|
+
#### Miscellaneous chores
|
|
58
|
+
|
|
59
|
+
* Added preliminary otel configuration ([#3121](https://github.com/newrelic/node-newrelic/pull/3121)) ([664ee4a](https://github.com/newrelic/node-newrelic/commit/664ee4ae956d9cc6ebc6b68ad79a47948510422f))
|
|
60
|
+
|
|
1
61
|
### v12.20.0 (2025-05-27)
|
|
2
62
|
|
|
3
63
|
#### Features
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -72,6 +72,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
|
|
|
72
72
|
* [lint-staged](#lint-staged)
|
|
73
73
|
* [lockfile-lint](#lockfile-lint)
|
|
74
74
|
* [nock](#nock)
|
|
75
|
+
* [protobufjs](#protobufjs)
|
|
75
76
|
* [proxyquire](#proxyquire)
|
|
76
77
|
* [rimraf](#rimraf)
|
|
77
78
|
* [self-cert](#self-cert)
|
|
@@ -94,7 +95,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
|
|
|
94
95
|
|
|
95
96
|
### @grpc/grpc-js
|
|
96
97
|
|
|
97
|
-
This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.13.
|
|
98
|
+
This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.13.4](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.13.4)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.13.4/LICENSE):
|
|
98
99
|
|
|
99
100
|
```
|
|
100
101
|
Apache License
|
|
@@ -1901,7 +1902,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
1901
1902
|
|
|
1902
1903
|
### import-in-the-middle
|
|
1903
1904
|
|
|
1904
|
-
This product includes source derived from [import-in-the-middle](https://github.com/nodejs/import-in-the-middle) ([v1.
|
|
1905
|
+
This product includes source derived from [import-in-the-middle](https://github.com/nodejs/import-in-the-middle) ([v1.14.0](https://github.com/nodejs/import-in-the-middle/tree/v1.14.0)), distributed under the [Apache-2.0 License](https://github.com/nodejs/import-in-the-middle/blob/v1.14.0/LICENSE):
|
|
1905
1906
|
|
|
1906
1907
|
```
|
|
1907
1908
|
Apache License
|
|
@@ -2332,7 +2333,7 @@ SOFTWARE.
|
|
|
2332
2333
|
|
|
2333
2334
|
### @aws-sdk/client-s3
|
|
2334
2335
|
|
|
2335
|
-
This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.
|
|
2336
|
+
This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.821.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.821.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.821.0/LICENSE):
|
|
2336
2337
|
|
|
2337
2338
|
```
|
|
2338
2339
|
Apache License
|
|
@@ -2541,7 +2542,7 @@ This product includes source derived from [@aws-sdk/client-s3](https://github.co
|
|
|
2541
2542
|
|
|
2542
2543
|
### @aws-sdk/s3-request-presigner
|
|
2543
2544
|
|
|
2544
|
-
This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.
|
|
2545
|
+
This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.821.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.821.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.821.0/LICENSE):
|
|
2545
2546
|
|
|
2546
2547
|
```
|
|
2547
2548
|
Apache License
|
|
@@ -4369,7 +4370,7 @@ SOFTWARE.
|
|
|
4369
4370
|
|
|
4370
4371
|
### eslint-plugin-jsdoc
|
|
4371
4372
|
|
|
4372
|
-
This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v50.
|
|
4373
|
+
This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v50.7.1](https://github.com/gajus/eslint-plugin-jsdoc/tree/v50.7.1)), distributed under the [BSD-3-Clause License](https://github.com/gajus/eslint-plugin-jsdoc/blob/v50.7.1/LICENSE):
|
|
4373
4374
|
|
|
4374
4375
|
```
|
|
4375
4376
|
Copyright (c) 2018, Gajus Kuizinas (http://gajus.com/)
|
|
@@ -4401,7 +4402,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
4401
4402
|
|
|
4402
4403
|
### eslint
|
|
4403
4404
|
|
|
4404
|
-
This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v9.
|
|
4405
|
+
This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v9.28.0](https://github.com/eslint/eslint/tree/v9.28.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v9.28.0/LICENSE):
|
|
4405
4406
|
|
|
4406
4407
|
```
|
|
4407
4408
|
Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
|
|
@@ -5012,6 +5013,53 @@ SOFTWARE.
|
|
|
5012
5013
|
|
|
5013
5014
|
```
|
|
5014
5015
|
|
|
5016
|
+
### protobufjs
|
|
5017
|
+
|
|
5018
|
+
This product includes source derived from [protobufjs](https://github.com/protobufjs/protobuf.js) ([v7.5.3](https://github.com/protobufjs/protobuf.js/tree/v7.5.3)), distributed under the [BSD-3-Clause License](https://github.com/protobufjs/protobuf.js/blob/v7.5.3/LICENSE):
|
|
5019
|
+
|
|
5020
|
+
```
|
|
5021
|
+
This license applies to all parts of protobuf.js except those files
|
|
5022
|
+
either explicitly including or referencing a different license or
|
|
5023
|
+
located in a directory containing a different LICENSE file.
|
|
5024
|
+
|
|
5025
|
+
---
|
|
5026
|
+
|
|
5027
|
+
Copyright (c) 2016, Daniel Wirtz All rights reserved.
|
|
5028
|
+
|
|
5029
|
+
Redistribution and use in source and binary forms, with or without
|
|
5030
|
+
modification, are permitted provided that the following conditions are
|
|
5031
|
+
met:
|
|
5032
|
+
|
|
5033
|
+
* Redistributions of source code must retain the above copyright
|
|
5034
|
+
notice, this list of conditions and the following disclaimer.
|
|
5035
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
5036
|
+
notice, this list of conditions and the following disclaimer in the
|
|
5037
|
+
documentation and/or other materials provided with the distribution.
|
|
5038
|
+
* Neither the name of its author, nor the names of its contributors
|
|
5039
|
+
may be used to endorse or promote products derived from this software
|
|
5040
|
+
without specific prior written permission.
|
|
5041
|
+
|
|
5042
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
5043
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
5044
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
5045
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
5046
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
5047
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
5048
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
5049
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
5050
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
5051
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
5052
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
5053
|
+
|
|
5054
|
+
---
|
|
5055
|
+
|
|
5056
|
+
Code generated by the command line utilities is owned by the owner
|
|
5057
|
+
of the input file used when generating it. This code is not
|
|
5058
|
+
standalone and requires a support library to be linked with it. This
|
|
5059
|
+
support library is itself covered by the above license.
|
|
5060
|
+
|
|
5061
|
+
```
|
|
5062
|
+
|
|
5015
5063
|
### proxyquire
|
|
5016
5064
|
|
|
5017
5065
|
This product includes source derived from [proxyquire](https://github.com/thlorenz/proxyquire) ([v1.8.0](https://github.com/thlorenz/proxyquire/tree/v1.8.0)), distributed under the [MIT License](https://github.com/thlorenz/proxyquire/blob/v1.8.0/LICENSE):
|
package/lib/agent.js
CHANGED
|
@@ -104,6 +104,14 @@ const DEFAULT_HARVEST_INTERVAL_MS = 60000
|
|
|
104
104
|
* @event Agent#harvestStarted
|
|
105
105
|
*/
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Indicates that the OpenTelemetry metrics API client has been fully
|
|
109
|
+
* configured and is ready to send metrics to New Relic. This happens
|
|
110
|
+
* subsequent to the {@link Agent#started} event.
|
|
111
|
+
*
|
|
112
|
+
* @event Agent#otelMetricsBootstrapped
|
|
113
|
+
*/
|
|
114
|
+
|
|
107
115
|
/**
|
|
108
116
|
* Indicates that the agent state has entered the "started" state. That is,
|
|
109
117
|
* the agent has finished bootstrapping and is collecting and sending data.
|
package/lib/collector/facts.js
CHANGED
|
@@ -31,11 +31,7 @@ async function facts(agent, callback, { logger = defaultLogger } = {}) {
|
|
|
31
31
|
systemInfo = systemInfo || Object.create(null)
|
|
32
32
|
environment = environment || []
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
if (agent.config.gcp_cloud_run.use_instance_as_host && process.env.K_SERVICE) {
|
|
36
|
-
// K_SERVICE is the name of the service in GCP Cloud Run
|
|
37
|
-
hostname = systemInfo.vendors?.gcp?.id
|
|
38
|
-
}
|
|
34
|
+
const hostname = agent.config.getHostnameSafe(systemInfo?.vendors?.gcp?.id)
|
|
39
35
|
const results = {
|
|
40
36
|
utilization: {
|
|
41
37
|
metadata_version: 5,
|
package/lib/config/default.js
CHANGED
|
@@ -1673,7 +1673,63 @@ defaultConfig.definition = () => ({
|
|
|
1673
1673
|
* **Note**: Disabling a given library may affect the instrumentation of libraries used after
|
|
1674
1674
|
* the disabled library. Use at your own risk.
|
|
1675
1675
|
*/
|
|
1676
|
-
instrumentation: pkgInstrumentation
|
|
1676
|
+
instrumentation: pkgInstrumentation,
|
|
1677
|
+
|
|
1678
|
+
/**
|
|
1679
|
+
* Governs the various OpenTelemetry based features provided by the
|
|
1680
|
+
* agent.
|
|
1681
|
+
*
|
|
1682
|
+
* NOTICE: this configuration is subject to change while the OTEL
|
|
1683
|
+
* feature set is in development.
|
|
1684
|
+
*/
|
|
1685
|
+
opentelemetry_bridge: {
|
|
1686
|
+
/**
|
|
1687
|
+
* Global switch for the whole OpenTelemetry feature. If it is set to
|
|
1688
|
+
* `false`, any other sub-feature, e.g. `traces`, will not be enabled
|
|
1689
|
+
* regardless of that specific sub-feature setting.
|
|
1690
|
+
*/
|
|
1691
|
+
enabled: { default: false, formatter: boolean },
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* `traces` are instrumentations, e.g. `@fastify/otel`. Enabling `traces`
|
|
1695
|
+
* enables bridging OpenTelemetry instrumentations into the New Relic
|
|
1696
|
+
* agent.
|
|
1697
|
+
*/
|
|
1698
|
+
traces: {
|
|
1699
|
+
enabled: { default: false, formatter: boolean }
|
|
1700
|
+
},
|
|
1701
|
+
|
|
1702
|
+
/**
|
|
1703
|
+
* `metrics` governs automatic configuration of the OpenTelemetry
|
|
1704
|
+
* metrics API. When `true`, the agent will automatically configure the
|
|
1705
|
+
* metrics API to send metrics to New Relic and attach them to the
|
|
1706
|
+
* application entity that is instrumented by the New Relic agent.
|
|
1707
|
+
*/
|
|
1708
|
+
metrics: {
|
|
1709
|
+
enabled: { default: false, formatter: boolean },
|
|
1710
|
+
|
|
1711
|
+
/**
|
|
1712
|
+
* `exportInterval` defines the number of milliseconds between each
|
|
1713
|
+
* attempt to ship metrics to New Relic. This value must be equal to
|
|
1714
|
+
* or greater than the value of `exportTimeout`.
|
|
1715
|
+
*/
|
|
1716
|
+
exportInterval: {
|
|
1717
|
+
default: 60_000,
|
|
1718
|
+
formatter: int
|
|
1719
|
+
},
|
|
1720
|
+
|
|
1721
|
+
/**
|
|
1722
|
+
* `exportTimeout` defines the number of milliseconds an export operation
|
|
1723
|
+
* is allowed in order to successfully complete. If the timeout is
|
|
1724
|
+
* exceeded, it will be reported via the OpenTelemetry diagnostics
|
|
1725
|
+
* API.
|
|
1726
|
+
*/
|
|
1727
|
+
exportTimeout: {
|
|
1728
|
+
default: 30_000,
|
|
1729
|
+
formatter: int
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1677
1733
|
})
|
|
1678
1734
|
|
|
1679
1735
|
/**
|
package/lib/config/index.js
CHANGED
|
@@ -972,16 +972,25 @@ Config.prototype.getIPAddresses = function getIPAddresses() {
|
|
|
972
972
|
return addresses
|
|
973
973
|
}
|
|
974
974
|
|
|
975
|
-
|
|
975
|
+
/**
|
|
976
|
+
* Gets the system's host name. If that fails, it just returns ipv4/6
|
|
977
|
+
* based on the user's process_host.ipv_preference setting.
|
|
978
|
+
* @param {string} gcpId GCP metadata ID
|
|
979
|
+
* @returns {string} host name
|
|
980
|
+
*/
|
|
981
|
+
function getHostnameSafe(gcpId = null) {
|
|
976
982
|
let _hostname
|
|
977
983
|
const config = this
|
|
978
984
|
this.getHostnameSafe = function getCachedHostname() {
|
|
979
985
|
return _hostname
|
|
980
986
|
}
|
|
981
987
|
try {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
988
|
+
// Check for any special hostname scenarios.
|
|
989
|
+
// If not applicable, use the os.hostname()
|
|
990
|
+
if (config.heroku.use_dyno_names && process.env.DYNO) {
|
|
991
|
+
_hostname = process.env.DYNO || os.hostname()
|
|
992
|
+
} else if (config.gcp_cloud_run.use_instance_as_host && process.env.K_SERVICE && gcpId) {
|
|
993
|
+
_hostname = gcpId
|
|
985
994
|
} else {
|
|
986
995
|
_hostname = os.hostname()
|
|
987
996
|
}
|
|
@@ -1134,6 +1143,13 @@ function setFromEnv({ config, key, envVar, formatter, paths }) {
|
|
|
1134
1143
|
const setting = process.env[envVar]
|
|
1135
1144
|
if (setting) {
|
|
1136
1145
|
const formattedSetting = formatter ? formatter(setting, logger) : setting
|
|
1146
|
+
// `setting` _should_ be a string when reading from the actual process
|
|
1147
|
+
// environment. But we have tests that construct an environment with
|
|
1148
|
+
// non-string values. So we need to convert them before accessing.
|
|
1149
|
+
const prefix = setting.toString().at(0)
|
|
1150
|
+
const suffix = setting.toString().at(-1)
|
|
1151
|
+
const redacted = prefix + '*'.repeat(setting.length) + suffix
|
|
1152
|
+
logger.trace({ env: { [envVar]: redacted } }, 'setting value from environment variable')
|
|
1137
1153
|
setNestedKey(config, [...paths, key], formattedSetting)
|
|
1138
1154
|
}
|
|
1139
1155
|
}
|
|
@@ -1153,31 +1169,36 @@ Config.prototype._fromEnvironment = function _fromEnvironment(
|
|
|
1153
1169
|
objectKeys = 1
|
|
1154
1170
|
) {
|
|
1155
1171
|
let keysSeen = 0
|
|
1156
|
-
|
|
1172
|
+
for (const [key, value] of Object.entries(data)) {
|
|
1157
1173
|
const type = typeof value
|
|
1158
|
-
keysSeen
|
|
1174
|
+
keysSeen += 1
|
|
1175
|
+
|
|
1176
|
+
if (type !== 'string' && type !== 'object') {
|
|
1177
|
+
continue
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1159
1180
|
if (type === 'string') {
|
|
1160
1181
|
const envVar = deriveEnvVar(key, paths)
|
|
1161
1182
|
setFromEnv({ config, key, envVar, paths })
|
|
1162
|
-
|
|
1163
|
-
if (Object.prototype.hasOwnProperty.call(value, 'env')) {
|
|
1164
|
-
setFromEnv({
|
|
1165
|
-
config,
|
|
1166
|
-
key,
|
|
1167
|
-
envVar: value.env,
|
|
1168
|
-
paths,
|
|
1169
|
-
formatter: value.formatter
|
|
1170
|
-
})
|
|
1171
|
-
} else if (Object.prototype.hasOwnProperty.call(value, 'default')) {
|
|
1172
|
-
const envVar = deriveEnvVar(key, paths)
|
|
1173
|
-
setFromEnv({ config, key, envVar, formatter: value.formatter, paths })
|
|
1174
|
-
} else {
|
|
1175
|
-
paths.push(key)
|
|
1176
|
-
const { length } = Object.keys(value)
|
|
1177
|
-
this._fromEnvironment(config, value, paths, length)
|
|
1178
|
-
}
|
|
1183
|
+
continue
|
|
1179
1184
|
}
|
|
1180
|
-
|
|
1185
|
+
|
|
1186
|
+
if (Object.prototype.hasOwnProperty.call(value, 'env') === true) {
|
|
1187
|
+
const envVar = value.env
|
|
1188
|
+
setFromEnv({ config, key, paths, envVar, formatter: value.formatter })
|
|
1189
|
+
continue
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
if (Object.prototype.hasOwnProperty.call(value, 'default') === true) {
|
|
1193
|
+
const envVar = deriveEnvVar(key, paths)
|
|
1194
|
+
setFromEnv({ config, key, paths, envVar, formatter: value.formatter })
|
|
1195
|
+
continue
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
paths.push(key)
|
|
1199
|
+
const { length } = Object.keys(value)
|
|
1200
|
+
this._fromEnvironment(config, value, paths, length)
|
|
1201
|
+
}
|
|
1181
1202
|
|
|
1182
1203
|
// we have traversed every key in current object leaf node, remove wrapping key
|
|
1183
1204
|
// to properly derive env vars of future leaf nodes
|
|
@@ -1729,16 +1750,18 @@ Config.prototype._warnDeprecations = function _warnDeprecations() {
|
|
|
1729
1750
|
* configuration file settings.
|
|
1730
1751
|
*
|
|
1731
1752
|
* @param {object} config Optional configuration to be used in place of a config file.
|
|
1753
|
+
* @param root0
|
|
1754
|
+
* @param root0.loggerInstance
|
|
1732
1755
|
* @returns {object} instantiated configuration object
|
|
1733
1756
|
*/
|
|
1734
|
-
function initialize(config) {
|
|
1757
|
+
function initialize(config, { loggerInstance } = {}) {
|
|
1735
1758
|
/**
|
|
1736
1759
|
* When the logger is required here, it bootstraps itself and then
|
|
1737
1760
|
* injects itself into this module's closure via setLogger on the
|
|
1738
1761
|
* instance of the logger it creates. Logs are queued until config
|
|
1739
1762
|
* has been loaded to apply logging settings to bootstrapping logs
|
|
1740
1763
|
*/
|
|
1741
|
-
logger = require('../logger')
|
|
1764
|
+
logger = loggerInstance ?? require('../logger')
|
|
1742
1765
|
|
|
1743
1766
|
if (config) {
|
|
1744
1767
|
return new Config(config)
|
package/lib/feature_flags.js
CHANGED
|
@@ -10,7 +10,6 @@ exports.prerelease = {
|
|
|
10
10
|
// internal_test_only is used for testing our feature flag implementation.
|
|
11
11
|
// It is not used to gate any features.
|
|
12
12
|
internal_test_only: false,
|
|
13
|
-
opentelemetry_bridge: false,
|
|
14
13
|
promise_segments: false,
|
|
15
14
|
reverse_naming_rules: false,
|
|
16
15
|
unresolved_promise_cleanup: true,
|
|
@@ -20,26 +19,27 @@ exports.prerelease = {
|
|
|
20
19
|
|
|
21
20
|
// flags that are no longer used for released features
|
|
22
21
|
exports.released = [
|
|
23
|
-
'
|
|
22
|
+
'async_local_context',
|
|
23
|
+
'await_support',
|
|
24
|
+
'aws_bedrock_instrumentation',
|
|
24
25
|
'cat',
|
|
26
|
+
'certificate_bundle',
|
|
25
27
|
'custom_instrumentation',
|
|
26
28
|
'custom_metrics',
|
|
29
|
+
'dt_format_w3c',
|
|
27
30
|
'express_segments',
|
|
31
|
+
'fastify_instrumentation',
|
|
32
|
+
'langchain_instrumentation',
|
|
28
33
|
'native_metrics',
|
|
29
34
|
'new_promise_tracking',
|
|
35
|
+
'opentelemetry_bridge',
|
|
30
36
|
'protocol_17',
|
|
31
|
-
'
|
|
37
|
+
'released',
|
|
32
38
|
'send_request_uri_attribute',
|
|
39
|
+
'serverless_mode',
|
|
33
40
|
'synthetics',
|
|
34
|
-
'dt_format_w3c',
|
|
35
|
-
'fastify_instrumentation',
|
|
36
|
-
'await_support',
|
|
37
|
-
'certificate_bundle',
|
|
38
|
-
'async_local_context',
|
|
39
41
|
'undici_async_tracking',
|
|
40
42
|
'undici_instrumentation',
|
|
41
|
-
'aws_bedrock_instrumentation',
|
|
42
|
-
'langchain_instrumentation'
|
|
43
43
|
]
|
|
44
44
|
|
|
45
45
|
// flags that are no longer used for unreleased features
|