newrelic 12.10.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 (80) hide show
  1. package/NEWS.md +36 -0
  2. package/THIRD_PARTY_NOTICES.md +631 -1
  3. package/api.js +31 -14
  4. package/lib/agent.js +29 -16
  5. package/lib/context-manager/async-local-context-manager.js +3 -7
  6. package/lib/context-manager/context.js +29 -0
  7. package/lib/db/query-parsers/elasticsearch.js +102 -0
  8. package/lib/db/query-parsers/mongodb.js +29 -0
  9. package/lib/db/query-sample.js +3 -3
  10. package/lib/db/query-trace-aggregator.js +4 -4
  11. package/lib/db/slow-query.js +2 -1
  12. package/lib/instrumentation/@elastic/elasticsearch.js +1 -96
  13. package/lib/instrumentation/@nestjs/core.js +1 -2
  14. package/lib/instrumentation/@opensearch-project/opensearch.js +1 -96
  15. package/lib/instrumentation/aws-sdk/v3/bedrock.js +33 -15
  16. package/lib/instrumentation/core/globals.js +1 -3
  17. package/lib/instrumentation/core/http-outbound.js +41 -23
  18. package/lib/instrumentation/core/http.js +18 -6
  19. package/lib/instrumentation/core/net.js +14 -5
  20. package/lib/instrumentation/grpc-js/grpc.js +7 -7
  21. package/lib/instrumentation/kafkajs/consumer.js +3 -4
  22. package/lib/instrumentation/koa/instrumentation.js +2 -4
  23. package/lib/instrumentation/langchain/runnable.js +28 -9
  24. package/lib/instrumentation/langchain/tools.js +4 -3
  25. package/lib/instrumentation/langchain/vectorstore.js +29 -6
  26. package/lib/instrumentation/mongodb/v4-mongo.js +1 -21
  27. package/lib/instrumentation/nextjs/next-server.js +2 -4
  28. package/lib/instrumentation/nextjs/utils.js +0 -13
  29. package/lib/instrumentation/openai.js +26 -12
  30. package/lib/instrumentation/restify.js +3 -3
  31. package/lib/instrumentation/superagent.js +3 -3
  32. package/lib/instrumentation/undici.js +36 -26
  33. package/lib/instrumentation/when/contextualizer.js +19 -8
  34. package/lib/instrumentation/when/index.js +31 -19
  35. package/lib/llm-events/aws-bedrock/event.js +4 -5
  36. package/lib/llm-events/langchain/event.js +4 -5
  37. package/lib/llm-events/openai/chat-completion-message.js +11 -2
  38. package/lib/llm-events/openai/chat-completion-summary.js +2 -2
  39. package/lib/llm-events/openai/embedding.js +2 -2
  40. package/lib/llm-events/openai/event.js +2 -2
  41. package/lib/metrics/recorders/custom.js +2 -3
  42. package/lib/metrics/recorders/database-operation.js +2 -7
  43. package/lib/metrics/recorders/database.js +9 -4
  44. package/lib/metrics/recorders/generic.js +2 -3
  45. package/lib/metrics/recorders/http.js +3 -4
  46. package/lib/metrics/recorders/http_external.js +2 -3
  47. package/lib/metrics/recorders/message-transaction.js +3 -4
  48. package/lib/metrics/recorders/middleware.js +2 -3
  49. package/lib/metrics/recorders/other.js +3 -4
  50. package/lib/otel/rules.js +241 -0
  51. package/lib/otel/rules.json +500 -0
  52. package/lib/otel/segment-synthesis.js +68 -0
  53. package/lib/otel/segments/consumer.js +50 -0
  54. package/lib/otel/segments/database.js +68 -0
  55. package/lib/otel/segments/http-external.js +20 -0
  56. package/lib/otel/segments/index.js +22 -0
  57. package/lib/otel/segments/internal.js +17 -0
  58. package/lib/otel/segments/producer.js +29 -0
  59. package/lib/otel/segments/server.js +85 -0
  60. package/lib/serverless/aws-lambda.js +2 -1
  61. package/lib/shim/datastore-shim.js +2 -3
  62. package/lib/shim/message-shim/subscribe-consume.js +4 -3
  63. package/lib/shim/promise-shim.js +39 -12
  64. package/lib/shim/shim.js +189 -92
  65. package/lib/shim/transaction-shim.js +30 -25
  66. package/lib/shim/webframework-shim/middleware.js +2 -2
  67. package/lib/spans/span-event-aggregator.js +9 -8
  68. package/lib/spans/span-event.js +14 -15
  69. package/lib/spans/streaming-span-event-aggregator.js +8 -5
  70. package/lib/spans/streaming-span-event.js +2 -3
  71. package/lib/transaction/index.js +16 -26
  72. package/lib/transaction/trace/exclusive-time-calculator.js +20 -26
  73. package/lib/transaction/trace/index.js +169 -58
  74. package/lib/transaction/trace/segment-tree.js +50 -0
  75. package/lib/transaction/trace/segment.js +31 -206
  76. package/lib/transaction/tracer/index.js +124 -93
  77. package/lib/util/cat.js +7 -5
  78. package/lib/util/trace-stacks.js +25 -0
  79. package/package.json +4 -1
  80. package/lib/context-manager/create-context-manager.js +0 -29
package/NEWS.md CHANGED
@@ -1,3 +1,39 @@
1
+ ### v12.11.0 (2025-01-14)
2
+
3
+ #### Features
4
+
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))
22
+
23
+ #### Documentation
24
+
25
+ * Updated compatibility report ([#2869](https://github.com/newrelic/node-newrelic/pull/2869)) ([4bde427](https://github.com/newrelic/node-newrelic/commit/4bde427f67aa1e1699e7ab12c4f96e83f70850a6))
26
+
27
+ #### Miscellaneous chores
28
+
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))
32
+
33
+ #### Tests
34
+
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))
36
+
1
37
  ### v12.10.0 (2025-01-09)
2
38
 
3
39
  #### Features