newrelic 12.9.0 → 12.11.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.
Files changed (158) hide show
  1. package/NEWS.md +68 -8
  2. package/THIRD_PARTY_NOTICES.md +771 -313
  3. package/api.js +45 -27
  4. package/bin/test-naming-rules.js +2 -3
  5. package/index.js +0 -4
  6. package/lib/agent.js +31 -17
  7. package/lib/aggregators/base-aggregator.js +2 -2
  8. package/lib/aggregators/trace-aggregator.js +1 -5
  9. package/lib/attributes.js +5 -5
  10. package/lib/collector/api.js +1 -3
  11. package/lib/collector/facts.js +2 -2
  12. package/lib/collector/http-agents.js +2 -2
  13. package/lib/collector/remote-method.js +4 -4
  14. package/lib/config/attribute-filter.js +1 -1
  15. package/lib/config/default.js +2 -2
  16. package/lib/config/harvest-config-validator.js +2 -2
  17. package/lib/config/index.js +9 -11
  18. package/lib/config/merge-server-config.js +1 -2
  19. package/lib/context-manager/async-local-context-manager.js +3 -7
  20. package/lib/context-manager/context.js +29 -0
  21. package/lib/custom-events/custom-event-aggregator.js +0 -1
  22. package/lib/db/query-parsers/elasticsearch.js +102 -0
  23. package/lib/db/query-parsers/mongodb.js +29 -0
  24. package/lib/db/query-parsers/sql.js +2 -0
  25. package/lib/db/query-sample.js +3 -3
  26. package/lib/db/query-trace-aggregator.js +4 -4
  27. package/lib/db/slow-query.js +3 -1
  28. package/lib/db/statement-matcher.js +3 -2
  29. package/lib/db/utils.js +4 -0
  30. package/lib/environment.js +2 -2
  31. package/lib/errors/error-collector.js +2 -2
  32. package/lib/errors/error-event-aggregator.js +1 -0
  33. package/lib/errors/helper.js +4 -4
  34. package/lib/errors/index.js +5 -6
  35. package/lib/grpc/connection.js +1 -1
  36. package/lib/header-attributes.js +21 -20
  37. package/lib/instrumentation/@elastic/elasticsearch.js +1 -96
  38. package/lib/instrumentation/@nestjs/core.js +1 -2
  39. package/lib/instrumentation/@opensearch-project/opensearch.js +66 -0
  40. package/lib/instrumentation/@prisma/client.js +4 -3
  41. package/lib/instrumentation/amqplib/utils.js +1 -1
  42. package/lib/instrumentation/aws-sdk/v3/bedrock.js +33 -15
  43. package/lib/instrumentation/aws-sdk/v3/common.js +4 -7
  44. package/lib/instrumentation/aws-sdk/v3/lambda.js +2 -3
  45. package/lib/instrumentation/bluebird.js +1 -0
  46. package/lib/instrumentation/connect.js +1 -1
  47. package/lib/instrumentation/core/globals.js +1 -3
  48. package/lib/instrumentation/core/http-outbound.js +42 -25
  49. package/lib/instrumentation/core/http.js +20 -8
  50. package/lib/instrumentation/core/net.js +14 -5
  51. package/lib/instrumentation/core/timers.js +0 -1
  52. package/lib/instrumentation/express.js +1 -1
  53. package/lib/instrumentation/grpc-js/grpc.js +7 -7
  54. package/lib/instrumentation/kafkajs/consumer.js +4 -5
  55. package/lib/instrumentation/koa/instrumentation.js +2 -4
  56. package/lib/instrumentation/langchain/runnable.js +28 -9
  57. package/lib/instrumentation/langchain/tools.js +4 -3
  58. package/lib/instrumentation/langchain/vectorstore.js +29 -6
  59. package/lib/instrumentation/mongodb/v4-mongo.js +1 -21
  60. package/lib/instrumentation/mysql/mysql.js +2 -2
  61. package/lib/instrumentation/nextjs/next-server.js +2 -4
  62. package/lib/instrumentation/nextjs/utils.js +0 -13
  63. package/lib/instrumentation/openai.js +27 -14
  64. package/lib/instrumentation/restify.js +3 -3
  65. package/lib/instrumentation/superagent.js +3 -3
  66. package/lib/instrumentation/undici.js +38 -27
  67. package/lib/instrumentation/when/contextualizer.js +21 -9
  68. package/lib/instrumentation/when/index.js +34 -20
  69. package/lib/instrumentations.js +27 -26
  70. package/lib/llm-events/aws-bedrock/bedrock-response.js +0 -2
  71. package/lib/llm-events/aws-bedrock/chat-completion-summary.js +1 -0
  72. package/lib/llm-events/aws-bedrock/embedding.js +1 -0
  73. package/lib/llm-events/aws-bedrock/event.js +5 -6
  74. package/lib/llm-events/aws-bedrock/stream-handler.js +6 -6
  75. package/lib/llm-events/event.js +1 -0
  76. package/lib/llm-events/langchain/chat-completion-summary.js +2 -2
  77. package/lib/llm-events/langchain/event.js +5 -5
  78. package/lib/llm-events/langchain/vector-search.js +2 -2
  79. package/lib/llm-events/openai/chat-completion-message.js +11 -2
  80. package/lib/llm-events/openai/chat-completion-summary.js +2 -2
  81. package/lib/llm-events/openai/embedding.js +2 -2
  82. package/lib/llm-events/openai/event.js +2 -2
  83. package/lib/logger.js +0 -2
  84. package/lib/metrics/index.js +0 -1
  85. package/lib/metrics/mapper.js +2 -2
  86. package/lib/metrics/names.js +1 -1
  87. package/lib/metrics/normalizer/rule.js +2 -1
  88. package/lib/metrics/normalizer/tx_segment.js +4 -2
  89. package/lib/metrics/normalizer.js +5 -5
  90. package/lib/metrics/recorders/custom.js +2 -3
  91. package/lib/metrics/recorders/database-operation.js +2 -7
  92. package/lib/metrics/recorders/database.js +9 -4
  93. package/lib/metrics/recorders/generic.js +2 -3
  94. package/lib/metrics/recorders/http.js +3 -4
  95. package/lib/metrics/recorders/http_external.js +2 -3
  96. package/lib/metrics/recorders/message-transaction.js +3 -4
  97. package/lib/metrics/recorders/middleware.js +2 -3
  98. package/lib/metrics/recorders/other.js +3 -4
  99. package/lib/otel/rules.js +241 -0
  100. package/lib/otel/rules.json +500 -0
  101. package/lib/otel/segment-synthesis.js +68 -0
  102. package/lib/otel/segments/consumer.js +50 -0
  103. package/lib/otel/segments/database.js +68 -0
  104. package/lib/otel/segments/http-external.js +20 -0
  105. package/lib/otel/segments/index.js +22 -0
  106. package/lib/otel/segments/internal.js +17 -0
  107. package/lib/otel/segments/producer.js +29 -0
  108. package/lib/otel/segments/server.js +85 -0
  109. package/lib/prioritized-attributes.js +3 -2
  110. package/lib/priority-queue.js +1 -1
  111. package/lib/reservoir.js +1 -1
  112. package/lib/sampler.js +5 -5
  113. package/lib/serverless/api-gateway.js +13 -79
  114. package/lib/serverless/aws-lambda.js +6 -1
  115. package/lib/shim/conglomerate-shim.js +5 -0
  116. package/lib/shim/datastore-shim.js +4 -4
  117. package/lib/shim/message-shim/consume.js +2 -1
  118. package/lib/shim/message-shim/index.js +1 -1
  119. package/lib/shim/message-shim/subscribe-consume.js +14 -15
  120. package/lib/shim/promise-shim.js +46 -19
  121. package/lib/shim/shim.js +199 -104
  122. package/lib/shim/transaction-shim.js +30 -25
  123. package/lib/shim/webframework-shim/index.js +1 -1
  124. package/lib/shim/webframework-shim/middleware.js +3 -3
  125. package/lib/shimmer.js +2 -3
  126. package/lib/spans/base-span-streamer.js +1 -1
  127. package/lib/spans/map-to-streaming-type.js +0 -3
  128. package/lib/spans/span-event-aggregator.js +9 -8
  129. package/lib/spans/span-event.js +14 -15
  130. package/lib/spans/span-streamer.js +0 -4
  131. package/lib/spans/streaming-span-event-aggregator.js +9 -8
  132. package/lib/spans/streaming-span-event.js +2 -3
  133. package/lib/system-info.js +1 -2
  134. package/lib/timer.js +0 -1
  135. package/lib/transaction/index.js +24 -31
  136. package/lib/transaction/name-state.js +6 -5
  137. package/lib/transaction/trace/exclusive-time-calculator.js +20 -26
  138. package/lib/transaction/trace/index.js +169 -58
  139. package/lib/transaction/trace/segment-tree.js +50 -0
  140. package/lib/transaction/trace/segment.js +31 -207
  141. package/lib/transaction/tracecontext.js +3 -3
  142. package/lib/transaction/tracer/index.js +124 -93
  143. package/lib/util/cat.js +10 -8
  144. package/lib/util/copy.js +1 -1
  145. package/lib/util/deep-equal.js +1 -1
  146. package/lib/util/hashes.js +2 -0
  147. package/lib/util/label-parser.js +1 -0
  148. package/lib/util/logger.js +2 -4
  149. package/lib/util/sql/obfuscate.js +7 -4
  150. package/lib/util/trace-stacks.js +25 -0
  151. package/lib/util/urltils.js +3 -3
  152. package/lib/utilization/aws-info.js +1 -0
  153. package/lib/utilization/azure-info.js +1 -0
  154. package/lib/utilization/docker-info.js +4 -4
  155. package/lib/utilization/index.js +1 -1
  156. package/package.json +10 -8
  157. package/stub_api.js +1 -2
  158. package/lib/context-manager/create-context-manager.js +0 -29
package/NEWS.md CHANGED
@@ -1,24 +1,84 @@
1
- ### v12.9.0 (2024-12-18)
1
+ ### v12.11.0 (2025-01-14)
2
2
 
3
3
  #### Features
4
4
 
5
- * Added entity linking attributes to aws-sdk v3 Lambda segments ([#2845](https://github.com/newrelic/node-newrelic/pull/2845)) ([8820265](https://github.com/newrelic/node-newrelic/commit/882026502dbc12b700b893485458176bcd03f68e))
6
- * Provided ability to define newrelic config as `newrelic.mjs` ([#2836](https://github.com/newrelic/node-newrelic/pull/2836)) ([972b59d](https://github.com/newrelic/node-newrelic/commit/972b59d4c4bd5f212d5fd695ce1007802354b7a0))
5
+ * Removed transaction from segment. Introduced a new `enterSegment` and `enterTransaction` to make context propagation more clear ([#2646](https://github.com/newrelic/node-newrelic/pull/2646)) ([d84531a](https://github.com/newrelic/node-newrelic/commit/d84531a9035387b997cb2b3c6bc7895e232f87e2))
6
+ * Removed children from segments. ([#2689](https://github.com/newrelic/node-newrelic/pull/2689)) ([66f140f](https://github.com/newrelic/node-newrelic/commit/66f140f36b0cf5ed1028a4cbda672bc603573ae7))
7
+ * Added segment tree to transaction trace ([#2717](https://github.com/newrelic/node-newrelic/pull/2717)) ([8fcc239](https://github.com/newrelic/node-newrelic/commit/8fcc239b37d7ece569de0bd19406e4d62904bcd3))
8
+ * Added segment synthesizer and provided ability to convert http client otel spans to external http trace segments ([#2745](https://github.com/newrelic/node-newrelic/pull/2745)) ([c42f8e6](https://github.com/newrelic/node-newrelic/commit/c42f8e646acaf50d5878a891f7b062ea46094091))
9
+ * Added otel consumer span processing ([#2854](https://github.com/newrelic/node-newrelic/pull/2854)) ([82fe9d5](https://github.com/newrelic/node-newrelic/commit/82fe9d5017d042234472c5d05c2c9c05d8a45091))
10
+ * Added segment and transaction synthesis for http server spans ([#2833](https://github.com/newrelic/node-newrelic/pull/2833)) ([8fa4d05](https://github.com/newrelic/node-newrelic/commit/8fa4d055b27a0494d7021bc3a284f4c4752a3cee))
11
+ * Added segment synthesis for db client otel spans to db trace ([#2820](https://github.com/newrelic/node-newrelic/pull/2820)) ([1ad1858](https://github.com/newrelic/node-newrelic/commit/1ad1858dcec71fa13065c2c80000055e206cb53a))
12
+ * Added segment synthesis for internal spans ([#2840](https://github.com/newrelic/node-newrelic/pull/2840)) ([436c63d](https://github.com/newrelic/node-newrelic/commit/436c63d0447bce6ddae77eaf032a4ddb65c7e07f))
13
+ * Added segment synthesis for otel producer spans ([#2839](https://github.com/newrelic/node-newrelic/pull/2839)) ([30f4995](https://github.com/newrelic/node-newrelic/commit/30f49955aa60fe4ef87c1bc82fe7faec3d756ccd))
14
+
15
+ #### Bug fixes
16
+
17
+ * Updated `shim.createSegment` and `shim.handleMqTracingHeaders` to be backwards compatible with the changes to context manager ([#2844](https://github.com/newrelic/node-newrelic/pull/2844)) ([554b4bf](https://github.com/newrelic/node-newrelic/commit/554b4bf0ae77dfa1e5a324f17622bc1c49b5f4f7))
18
+
19
+ #### Code refactoring
20
+
21
+ * Removed class construction on the segment synthesis and instrumentation ([#2837](https://github.com/newrelic/node-newrelic/pull/2837)) ([4b7ec0f](https://github.com/newrelic/node-newrelic/commit/4b7ec0f669cd936e86816bc24768727ba5067c88))
7
22
 
8
23
  #### Documentation
9
24
 
10
- * Updated compatibility report ([#2828](https://github.com/newrelic/node-newrelic/pull/2828)) ([d5fe8e3](https://github.com/newrelic/node-newrelic/commit/d5fe8e323c34464e8cc10be3f5c968a96357b6f6))
25
+ * Updated compatibility report ([#2869](https://github.com/newrelic/node-newrelic/pull/2869)) ([4bde427](https://github.com/newrelic/node-newrelic/commit/4bde427f67aa1e1699e7ab12c4f96e83f70850a6))
11
26
 
12
27
  #### Miscellaneous chores
13
28
 
14
- * **deps:** Updated @newrelic/security-agent to v2.2.0 ([#2842](https://github.com/newrelic/node-newrelic/pull/2842)) ([170941e](https://github.com/newrelic/node-newrelic/commit/170941e2f16d7e84edabfff40fd31906612b393e))
15
- * Updated borp configs to target tests correctly ([#2835](https://github.com/newrelic/node-newrelic/pull/2835)) ([66ae59d](https://github.com/newrelic/node-newrelic/commit/66ae59d1e047dead092b3fa681017e3d42ce9474))
29
+ * Added rules engine to match OTEL spans ([#2694](https://github.com/newrelic/node-newrelic/pull/2694)) ([2c93c68](https://github.com/newrelic/node-newrelic/commit/2c93c68b8563a07c450b8bd84d442c5ac18df3d8))
30
+ * Updated rules engine to account for fallbacks ([#2831](https://github.com/newrelic/node-newrelic/pull/2831)) ([19fbdfb](https://github.com/newrelic/node-newrelic/commit/19fbdfb4ec71fc5f6041d4ac8435d69a5f88ae9a))
31
+ * Updated versioned tests docs ([#2874](https://github.com/newrelic/node-newrelic/pull/2874)) ([73a84d7](https://github.com/newrelic/node-newrelic/commit/73a84d76be655a8cca88a47de177f1dfa4faa6e7))
16
32
 
17
33
  #### Tests
18
34
 
19
- * Removed `tap` and cleaned up left over tap helpers ([#2804](https://github.com/newrelic/node-newrelic/pull/2804)) ([37407b6](https://github.com/newrelic/node-newrelic/commit/37407b6d14c2bd6a1c577cce811277753eb8069e))
20
- * Updated `match` to fail if you pass in an object that lacks the expected keys ([#2843](https://github.com/newrelic/node-newrelic/pull/2843)) ([a3db8bd](https://github.com/newrelic/node-newrelic/commit/a3db8bd993d82a3c1c8873f9e552ba5fdf7cb5f4))
35
+ * Updated a langchain test to be less rigid on asserting the tracking metric by `@langchain/core` version ([#2876](https://github.com/newrelic/node-newrelic/pull/2876)) ([73985ea](https://github.com/newrelic/node-newrelic/commit/73985ea45634478133a0ac6437b16758cfd775b2))
21
36
 
37
+ ### v12.10.0 (2025-01-09)
38
+
39
+ #### Features
40
+
41
+ * Added instrumentation for `@opensearch-projects/opensearch` v2.1.0+ ([#2850](https://github.com/newrelic/node-newrelic/pull/2850)) ([763c0e6](https://github.com/newrelic/node-newrelic/commit/763c0e6ad50f15677b5f535999f93f122c84b583))
42
+
43
+ #### Bug fixes
44
+
45
+ * Fixed event matcher to use properties specific to web requests (v1/ALB and v2) ([#2863](https://github.com/newrelic/node-newrelic/pull/2863)) ([a93fe6e](https://github.com/newrelic/node-newrelic/commit/a93fe6e68e5b8047cc7c3bca8b9f50a0a7ffddd6))
46
+
47
+ #### Miscellaneous chores
48
+
49
+ * Fixed mysql2 tests for new mysql2 version ([#2853](https://github.com/newrelic/node-newrelic/pull/2853)) ([30a6de0](https://github.com/newrelic/node-newrelic/commit/30a6de00d22b92332009d7127bf52fbd10310214))
50
+ * Updated eslint configuration ([#2851](https://github.com/newrelic/node-newrelic/pull/2851)) ([d2fba9d](https://github.com/newrelic/node-newrelic/commit/d2fba9da8b9ba28d94e50c24fa494a35c442f0a5))
51
+ * Utilize updated @newrelic/eslint-config ([#2865](https://github.com/newrelic/node-newrelic/pull/2865)) ([f53d4fc](https://github.com/newrelic/node-newrelic/commit/f53d4fc8d911a998759cae90a9cd0bf09ff17828))
52
+
53
+ #### Tests
54
+
55
+ * Removed `t.diagnostic` from tests ([#2858](https://github.com/newrelic/node-newrelic/pull/2858)) ([23ca237](https://github.com/newrelic/node-newrelic/commit/23ca237731d4fd94b13d03eab9feb645aabe36d0))
56
+
57
+ #### Continuous integration
58
+
59
+ * Updated codecov-action to latest released version sha ([#2866](https://github.com/newrelic/node-newrelic/pull/2866)) ([75f8902](https://github.com/newrelic/node-newrelic/commit/75f8902e2dd9e1946666db6b1cf8617a5360d757))
60
+
61
+ ### v12.9.0 (2024-12-18)
62
+
63
+ #### Features
64
+
65
+ * Added entity linking attributes to aws-sdk v3 Lambda segments ([#2845](https://github.com/newrelic/node-newrelic/pull/2845)) ([8820265](https://github.com/newrelic/node-newrelic/commit/882026502dbc12b700b893485458176bcd03f68e))
66
+ * Provided ability to define newrelic config as `newrelic.mjs` ([#2836](https://github.com/newrelic/node-newrelic/pull/2836)) ([972b59d](https://github.com/newrelic/node-newrelic/commit/972b59d4c4bd5f212d5fd695ce1007802354b7a0))
67
+
68
+ #### Documentation
69
+
70
+ * Updated compatibility report ([#2828](https://github.com/newrelic/node-newrelic/pull/2828)) ([d5fe8e3](https://github.com/newrelic/node-newrelic/commit/d5fe8e323c34464e8cc10be3f5c968a96357b6f6))
71
+
72
+ #### Miscellaneous chores
73
+
74
+ * **deps:** Updated @newrelic/security-agent to v2.2.0 ([#2842](https://github.com/newrelic/node-newrelic/pull/2842)) ([170941e](https://github.com/newrelic/node-newrelic/commit/170941e2f16d7e84edabfff40fd31906612b393e))
75
+ * Updated borp configs to target tests correctly ([#2835](https://github.com/newrelic/node-newrelic/pull/2835)) ([66ae59d](https://github.com/newrelic/node-newrelic/commit/66ae59d1e047dead092b3fa681017e3d42ce9474))
76
+
77
+ #### Tests
78
+
79
+ * Removed `tap` and cleaned up left over tap helpers ([#2804](https://github.com/newrelic/node-newrelic/pull/2804)) ([37407b6](https://github.com/newrelic/node-newrelic/commit/37407b6d14c2bd6a1c577cce811277753eb8069e))
80
+ * Updated `match` to fail if you pass in an object that lacks the expected keys ([#2843](https://github.com/newrelic/node-newrelic/pull/2843)) ([a3db8bd](https://github.com/newrelic/node-newrelic/commit/a3db8bd993d82a3c1c8873f9e552ba5fdf7cb5f4))
81
+
22
82
  ### v12.8.2 (2024-12-09)
23
83
 
24
84
  #### Bug fixes