newrelic 12.10.0 → 12.11.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.
Files changed (81) hide show
  1. package/NEWS.md +54 -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/feature_flags.js +1 -1
  13. package/lib/instrumentation/@elastic/elasticsearch.js +1 -96
  14. package/lib/instrumentation/@nestjs/core.js +1 -2
  15. package/lib/instrumentation/@opensearch-project/opensearch.js +1 -96
  16. package/lib/instrumentation/aws-sdk/v3/bedrock.js +33 -15
  17. package/lib/instrumentation/core/globals.js +1 -3
  18. package/lib/instrumentation/core/http-outbound.js +41 -23
  19. package/lib/instrumentation/core/http.js +18 -6
  20. package/lib/instrumentation/core/net.js +14 -5
  21. package/lib/instrumentation/grpc-js/grpc.js +7 -7
  22. package/lib/instrumentation/kafkajs/consumer.js +3 -4
  23. package/lib/instrumentation/koa/instrumentation.js +2 -4
  24. package/lib/instrumentation/langchain/runnable.js +28 -9
  25. package/lib/instrumentation/langchain/tools.js +4 -3
  26. package/lib/instrumentation/langchain/vectorstore.js +29 -6
  27. package/lib/instrumentation/mongodb/v4-mongo.js +1 -21
  28. package/lib/instrumentation/nextjs/next-server.js +2 -4
  29. package/lib/instrumentation/nextjs/utils.js +0 -13
  30. package/lib/instrumentation/openai.js +26 -12
  31. package/lib/instrumentation/restify.js +3 -3
  32. package/lib/instrumentation/superagent.js +3 -3
  33. package/lib/instrumentation/undici.js +34 -63
  34. package/lib/instrumentation/when/contextualizer.js +19 -8
  35. package/lib/instrumentation/when/index.js +31 -19
  36. package/lib/llm-events/aws-bedrock/event.js +4 -5
  37. package/lib/llm-events/langchain/event.js +4 -5
  38. package/lib/llm-events/openai/chat-completion-message.js +11 -2
  39. package/lib/llm-events/openai/chat-completion-summary.js +2 -2
  40. package/lib/llm-events/openai/embedding.js +2 -2
  41. package/lib/llm-events/openai/event.js +2 -2
  42. package/lib/metrics/recorders/custom.js +2 -3
  43. package/lib/metrics/recorders/database-operation.js +2 -7
  44. package/lib/metrics/recorders/database.js +9 -4
  45. package/lib/metrics/recorders/generic.js +2 -3
  46. package/lib/metrics/recorders/http.js +3 -4
  47. package/lib/metrics/recorders/http_external.js +2 -3
  48. package/lib/metrics/recorders/message-transaction.js +3 -4
  49. package/lib/metrics/recorders/middleware.js +2 -3
  50. package/lib/metrics/recorders/other.js +3 -4
  51. package/lib/otel/rules.js +241 -0
  52. package/lib/otel/rules.json +500 -0
  53. package/lib/otel/segment-synthesis.js +68 -0
  54. package/lib/otel/segments/consumer.js +50 -0
  55. package/lib/otel/segments/database.js +68 -0
  56. package/lib/otel/segments/http-external.js +20 -0
  57. package/lib/otel/segments/index.js +22 -0
  58. package/lib/otel/segments/internal.js +17 -0
  59. package/lib/otel/segments/producer.js +29 -0
  60. package/lib/otel/segments/server.js +85 -0
  61. package/lib/serverless/aws-lambda.js +2 -1
  62. package/lib/shim/datastore-shim.js +2 -3
  63. package/lib/shim/message-shim/subscribe-consume.js +4 -3
  64. package/lib/shim/promise-shim.js +39 -12
  65. package/lib/shim/shim.js +189 -92
  66. package/lib/shim/transaction-shim.js +30 -25
  67. package/lib/shim/webframework-shim/middleware.js +2 -2
  68. package/lib/spans/span-event-aggregator.js +9 -8
  69. package/lib/spans/span-event.js +14 -15
  70. package/lib/spans/streaming-span-event-aggregator.js +8 -5
  71. package/lib/spans/streaming-span-event.js +2 -3
  72. package/lib/transaction/index.js +16 -26
  73. package/lib/transaction/trace/exclusive-time-calculator.js +20 -26
  74. package/lib/transaction/trace/index.js +169 -58
  75. package/lib/transaction/trace/segment-tree.js +50 -0
  76. package/lib/transaction/trace/segment.js +31 -206
  77. package/lib/transaction/tracer/index.js +124 -93
  78. package/lib/util/cat.js +7 -5
  79. package/lib/util/trace-stacks.js +25 -0
  80. package/package.json +4 -1
  81. package/lib/context-manager/create-context-manager.js +0 -29
package/NEWS.md CHANGED
@@ -1,3 +1,57 @@
1
+ ### v12.11.1 (2025-01-16)
2
+
3
+ #### Bug fixes
4
+
5
+ * Updated undici instrumentation to fix crash with trying to calculate exclusive duration on a segment that no longer exists ([#2884](https://github.com/newrelic/node-newrelic/pull/2884)) ([3b7e4bf](https://github.com/newrelic/node-newrelic/commit/3b7e4bf0a40b21f16b11e7761809cbaa83c02515))
6
+
7
+ #### Documentation
8
+
9
+ * Updated compatibility report ([#2878](https://github.com/newrelic/node-newrelic/pull/2878)) ([e784f84](https://github.com/newrelic/node-newrelic/commit/e784f8427bd49852f0ed7a15d6025ea8dfc73c72))
10
+
11
+ #### Miscellaneous chores
12
+
13
+ * Fixed dns integration tests ([#2883](https://github.com/newrelic/node-newrelic/pull/2883)) ([dd30ad7](https://github.com/newrelic/node-newrelic/commit/dd30ad71f07233682da39ca41f452a55c6798a15))
14
+
15
+ #### Tests
16
+
17
+ * Restored the branch to test apollo-server-plugin to main ([#2879](https://github.com/newrelic/node-newrelic/pull/2879)) ([978faab](https://github.com/newrelic/node-newrelic/commit/978faab59f5378e26cb8f5e584a3c9e684e7bbb1))
18
+
19
+ ### v12.11.0 (2025-01-14)
20
+
21
+ #### Features
22
+
23
+ * 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))
24
+ * Removed children from segments. ([#2689](https://github.com/newrelic/node-newrelic/pull/2689)) ([66f140f](https://github.com/newrelic/node-newrelic/commit/66f140f36b0cf5ed1028a4cbda672bc603573ae7))
25
+ * Added segment tree to transaction trace ([#2717](https://github.com/newrelic/node-newrelic/pull/2717)) ([8fcc239](https://github.com/newrelic/node-newrelic/commit/8fcc239b37d7ece569de0bd19406e4d62904bcd3))
26
+ * 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))
27
+ * Added otel consumer span processing ([#2854](https://github.com/newrelic/node-newrelic/pull/2854)) ([82fe9d5](https://github.com/newrelic/node-newrelic/commit/82fe9d5017d042234472c5d05c2c9c05d8a45091))
28
+ * 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))
29
+ * 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))
30
+ * Added segment synthesis for internal spans ([#2840](https://github.com/newrelic/node-newrelic/pull/2840)) ([436c63d](https://github.com/newrelic/node-newrelic/commit/436c63d0447bce6ddae77eaf032a4ddb65c7e07f))
31
+ * 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))
32
+
33
+ #### Bug fixes
34
+
35
+ * 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))
36
+
37
+ #### Code refactoring
38
+
39
+ * 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))
40
+
41
+ #### Documentation
42
+
43
+ * Updated compatibility report ([#2869](https://github.com/newrelic/node-newrelic/pull/2869)) ([4bde427](https://github.com/newrelic/node-newrelic/commit/4bde427f67aa1e1699e7ab12c4f96e83f70850a6))
44
+
45
+ #### Miscellaneous chores
46
+
47
+ * 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))
48
+ * 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))
49
+ * Updated versioned tests docs ([#2874](https://github.com/newrelic/node-newrelic/pull/2874)) ([73a84d7](https://github.com/newrelic/node-newrelic/commit/73a84d76be655a8cca88a47de177f1dfa4faa6e7))
50
+
51
+ #### Tests
52
+
53
+ * 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))
54
+
1
55
  ### v12.10.0 (2025-01-09)
2
56
 
3
57
  #### Features