newrelic 13.11.0 → 13.13.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 (50) hide show
  1. package/NEWS.md +108 -39
  2. package/THIRD_PARTY_NOTICES.md +17 -17
  3. package/lib/aggregators/profiling-aggregator.js +92 -0
  4. package/lib/collector/api.js +24 -16
  5. package/lib/collector/remote-method.js +3 -2
  6. package/lib/config/default.js +64 -9
  7. package/lib/llm-events/aws-bedrock/chat-completion-summary.js +1 -0
  8. package/lib/llm-events/chat-completion-message.js +117 -0
  9. package/lib/llm-events/chat-completion-summary.js +111 -0
  10. package/lib/llm-events/embedding.js +75 -0
  11. package/lib/llm-events/error-message.js +8 -2
  12. package/lib/llm-events/event-base.js +105 -0
  13. package/lib/llm-events/event.js +0 -1
  14. package/lib/llm-events/google-genai/chat-completion-summary.js +1 -0
  15. package/lib/llm-events/langchain/attach-attributes.js +41 -0
  16. package/lib/llm-events/langchain/chat-completion-message.js +39 -61
  17. package/lib/llm-events/langchain/chat-completion-summary.js +16 -27
  18. package/lib/llm-events/langchain/index.js +6 -9
  19. package/lib/llm-events/langchain/tool.js +30 -19
  20. package/lib/llm-events/langchain/vector-search-result.js +25 -25
  21. package/lib/llm-events/langchain/vector-search.js +25 -29
  22. package/lib/llm-events/langgraph/agent.js +41 -0
  23. package/lib/llm-events/openai/chat-completion-message.js +28 -36
  24. package/lib/llm-events/openai/chat-completion-summary.js +42 -11
  25. package/lib/llm-events/openai/embedding.js +30 -12
  26. package/lib/llm-events/openai/get-usage-tokens.js +20 -0
  27. package/lib/llm-events/tool.js +42 -0
  28. package/lib/metrics/names.js +7 -1
  29. package/lib/otel/metrics/index.js +12 -2
  30. package/lib/profiling/index.js +58 -0
  31. package/lib/profiling/profilers/base.js +30 -0
  32. package/lib/spans/span-event.js +8 -0
  33. package/lib/spans/span-link.js +5 -0
  34. package/lib/subscriber-configs.js +1 -0
  35. package/lib/subscribers/amqplib/connect.js +0 -1
  36. package/lib/subscribers/db.js +0 -2
  37. package/lib/subscribers/langchain/runnable-stream.js +76 -48
  38. package/lib/subscribers/langchain/runnable.js +70 -25
  39. package/lib/subscribers/langchain/tool.js +23 -9
  40. package/lib/subscribers/langchain/vectorstore.js +5 -5
  41. package/lib/subscribers/langgraph/config.js +39 -0
  42. package/lib/subscribers/langgraph/graph-stream.js +131 -0
  43. package/lib/subscribers/mcp-sdk/client-request.js +7 -1
  44. package/lib/subscribers/openai/chat.js +28 -6
  45. package/lib/subscribers/openai/embeddings.js +3 -3
  46. package/lib/transaction/trace/partial-trace.js +32 -35
  47. package/lib/util/label-parser.js +1 -1
  48. package/package.json +2 -2
  49. package/lib/llm-events/langchain/event.js +0 -86
  50. package/lib/llm-events/openai/event.js +0 -57
package/NEWS.md CHANGED
@@ -1,42 +1,110 @@
1
- ### v13.11.0 (2026-01-29)
2
-
3
- #### Features
4
-
5
- * Added `timestamp` to AIM `LlmChatCompletionMessage` messages
6
- * Added `timestamp` to AWS Bedrock `LlmChatCompletionMessage` ([#3685](https://github.com/newrelic/node-newrelic/pull/3685)) ([ea297c8](https://github.com/newrelic/node-newrelic/commit/ea297c86772c1ae377a16e636db8bbcf53ef1547))
7
- * Added `timestamp` to Google Gen AI `LlmChatCompletionMessage` ([#3686](https://github.com/newrelic/node-newrelic/pull/3686)) ([f4dd09e](https://github.com/newrelic/node-newrelic/commit/f4dd09ec332c47396277f6aaeff2f6f15daad97a))
8
- * Added `timestamp` to LangChain input `LlmChatCompletionMessage` ([#3658](https://github.com/newrelic/node-newrelic/pull/3658)) ([0bce235](https://github.com/newrelic/node-newrelic/commit/0bce235ce02f772bc089bf947afadf312c735c1b))
9
- * Added timestamp to OpenAI `LlmChatCompletionSummary` ([#3689](https://github.com/newrelic/node-newrelic/pull/3689)) ([55b0310](https://github.com/newrelic/node-newrelic/commit/55b03100323eefb3578816cff69f2b919e4b7bdd))
10
- * Additional support for partial granularity traces (Not available for production use)
11
- * Added essential tracing mode for span links ([#3670](https://github.com/newrelic/node-newrelic/pull/3670)) ([83dfb84](https://github.com/newrelic/node-newrelic/commit/83dfb84b842e0245392425ce61e92a2789fcaf06))
12
- * Updated `Supportability/Nodejs/PartialGranularity/NrIds/Dropped` metric to only keep track of spans that got dropped when `nr.ids` execeeded 63 spans. ([#3684](https://github.com/newrelic/node-newrelic/pull/3684)) ([9797cf3](https://github.com/newrelic/node-newrelic/commit/9797cf38aa2808b29da9623158edb221b1819548))
13
-
14
- #### Bug fixes
15
-
16
- * Added defensive code in `lib/subscribers/middleware-wrapper.js` to prevent crash when attempting to associate an error on an incoming http request ([#3697](https://github.com/newrelic/node-newrelic/pull/3697)) ([658e78b](https://github.com/newrelic/node-newrelic/commit/658e78ba564eae996d790bb3334bda6847c7e2bd))
17
- * Updated `pg` instrumentation to properly capture the TraceSegment duration for promise based queries ([#3695](https://github.com/newrelic/node-newrelic/pull/3695)) ([0051697](https://github.com/newrelic/node-newrelic/commit/005169776a3f3fe9d988174857b3c96e6131aea3))
18
-
19
- #### Code refactoring
20
-
21
- * Added AIM abstract subscribers and updated all AIM subscribers to use them ([#3676](https://github.com/newrelic/node-newrelic/pull/3676)) ([08cd38b](https://github.com/newrelic/node-newrelic/commit/08cd38b5b34b4f1a2636ccc12d359484af6b3e83))
22
-
23
- #### Documentation
24
-
25
- * Updated compatibility report ([#3675](https://github.com/newrelic/node-newrelic/pull/3675)) ([cc898f4](https://github.com/newrelic/node-newrelic/commit/cc898f4d8b0f520e120f330ff9e90fe7baaebedc))
26
-
27
- #### Miscellaneous chores
28
-
29
- * Added TimedEvent limit of 100 ([#3683](https://github.com/newrelic/node-newrelic/pull/3683)) ([0d595d8](https://github.com/newrelic/node-newrelic/commit/0d595d8579b5a58e49908bc24321ce7b526ddff2))
30
- * Added supportability metrics `Supportability/Nodejs/SpanEvent/<Links|Events>/Dropped` when limit of 100 is exceeded ([#3688](https://github.com/newrelic/node-newrelic/pull/3688)) ([a247d31](https://github.com/newrelic/node-newrelic/commit/a247d31fc9c24752be50a73d4ddfc7a088a68ce6))
31
- * Removed eslint disable next line for `sonarjs/no-dead-store` ([#3692](https://github.com/newrelic/node-newrelic/pull/3692)) ([593fa15](https://github.com/newrelic/node-newrelic/commit/593fa15a033437b95fe375cf6034b8453c7d2b36))
32
-
33
- #### Continuous Integration
34
- * Fixed CI issue when sec-agent present ([#3677](https://github.com/newrelic/node-newrelic/pull/3677)) ([23da654](https://github.com/newrelic/node-newrelic/commit/23da6547e72f49bf798046330e8cfa74a0b4d2af))
35
-
36
- #### Tests
37
-
38
- * Assert that span events drop in partial traces ([#3680](https://github.com/newrelic/node-newrelic/pull/3680)) ([25e3781](https://github.com/newrelic/node-newrelic/commit/25e3781098343b9ca9e4aed0cd5c9e0f94266926))
39
-
1
+ ### v13.13.0 (2026-02-17)
2
+
3
+ ## Feature Release
4
+
5
+ With this release, we are making available our Node.js Hybrid Agent.
6
+ The Node.js Hybrid Agent provides a future-proof observability solution with
7
+ integrated support for OpenTelemetry Tracing, Metrics, and Logs APIs. Key
8
+ enhancements like Span Links and Events on Spans are now available, ensuring
9
+ seamless interoperability in mixed-mode environments. It is designed to bridge
10
+ the gap for Node.js teams looking to adopt OpenTelemetry standards while
11
+ maintaining backwards compatibility with their existing New Relic dashboards.
12
+
13
+ A full product announcement, and documentation for this feature, is
14
+ coming soon. Please [subscribe to our news releases](https://newrelic.com/blog)
15
+ to be kept up-to-date.
16
+
17
+ #### Features
18
+
19
+ * Added `delay` and `duration` to profiling config ([#3754](https://github.com/newrelic/node-newrelic/pull/3754)) ([a7f06e0](https://github.com/newrelic/node-newrelic/commit/a7f06e016ee6e8488fb5364e118cdebaf8a3af0f))
20
+ * Added `ProfilingAggregator` that will be used to collect and send `pprof_data` telemetry ([#3732](https://github.com/newrelic/node-newrelic/pull/3732)) ([738045c](https://github.com/newrelic/node-newrelic/commit/738045c955b1ca82e60c4b3a1a9799e8257c0d51))
21
+ * Added profiling configuration ([#3733](https://github.com/newrelic/node-newrelic/pull/3733)) ([2b4d7d8](https://github.com/newrelic/node-newrelic/commit/2b4d7d898dea12d8d7f89f3024e56bf5e44d5b8b))
22
+ * Added ProfilingManager class, used to orchestrate profilers ([#3738](https://github.com/newrelic/node-newrelic/pull/3738)) ([105da3b](https://github.com/newrelic/node-newrelic/commit/105da3b788f8e47099a47857e9e490103c6163d4))
23
+ * Updated `RemoteMethod` to handle sending `pprof_data` through the collector ([#3734](https://github.com/newrelic/node-newrelic/pull/3734)) ([868e5bd](https://github.com/newrelic/node-newrelic/commit/868e5bdd102211b9569fef40efef77cfdd3719d2))
24
+ * Updated the profiling config properties ([#3742](https://github.com/newrelic/node-newrelic/pull/3742)) ([fa55881](https://github.com/newrelic/node-newrelic/commit/fa55881fafe45499461c89e70ce8c3d03d4cc8af))
25
+
26
+ #### Code refactoring
27
+
28
+ * LangChain LLM event refactor ([#3745](https://github.com/newrelic/node-newrelic/pull/3745)) ([b2612ec](https://github.com/newrelic/node-newrelic/commit/b2612ec1a95f68c19290025f4279cd0f06f6c7d1))
29
+ * OpenAI LLM event refactor ([#3726](https://github.com/newrelic/node-newrelic/pull/3726)) ([0ccad21](https://github.com/newrelic/node-newrelic/commit/0ccad2102d8f52da5ea77161534697f98c18c21e))
30
+
31
+ #### Documentation
32
+
33
+ * Updated compatibility report ([#3743](https://github.com/newrelic/node-newrelic/pull/3743)) ([4a7cafc](https://github.com/newrelic/node-newrelic/commit/4a7cafc9c72aa3a947f7a27f69ceb50424d30163)) ([#3739](https://github.com/newrelic/node-newrelic/pull/3739)) ([59ff976](https://github.com/newrelic/node-newrelic/commit/59ff9768e33e029dea469739ed790407665cf135)) ([#3730](https://github.com/newrelic/node-newrelic/pull/3730)) ([dea410b](https://github.com/newrelic/node-newrelic/commit/dea410bbaab9d940030e0e7eca72b1329effe004)) ([#3703](https://github.com/newrelic/node-newrelic/pull/3703)) ([532729a](https://github.com/newrelic/node-newrelic/commit/532729a3955454a7bb9ee282630af78379233037))
34
+
35
+ #### Miscellaneous chores
36
+
37
+ * Added subcomponent attribute to LangChain tool traces ([#3706](https://github.com/newrelic/node-newrelic/pull/3706)) ([c5469ea](https://github.com/newrelic/node-newrelic/commit/c5469eaa40a9600f56390f6251bc6c3ea2e30d08))
38
+ * Added subcomponent attribute to mcp-sdk invocations ([#3749](https://github.com/newrelic/node-newrelic/pull/3749)) ([70b7f41](https://github.com/newrelic/node-newrelic/commit/70b7f4115370857836ecd172f2ce041b66376bae))
39
+ * Enabled all OTEL signals by default when OTEL is enabled ([#3712](https://github.com/newrelic/node-newrelic/pull/3712)) ([15b82c2](https://github.com/newrelic/node-newrelic/commit/15b82c298937af4309cf3f9d0e88060b5b1c044c))
40
+ * Fixed `@langchain/community` peer dep conflict ([#3741](https://github.com/newrelic/node-newrelic/pull/3741)) ([202d2b3](https://github.com/newrelic/node-newrelic/commit/202d2b35b01182160f3dfa014e0abcff6ca0d6d2))
41
+ * Removed `@langchain/core` peer dep from LangGraph test matrix ([#3737](https://github.com/newrelic/node-newrelic/pull/3737)) ([8ba2616](https://github.com/newrelic/node-newrelic/commit/8ba2616afc21e2f4d1b98c6ccf448e6edbd86114))
42
+ * Renamed OTEL metrics config params to snake_case from camelCas… ([#3711](https://github.com/newrelic/node-newrelic/pull/3711)) ([4f59108](https://github.com/newrelic/node-newrelic/commit/4f591088888ae724136d409ee93438ecd81a5539))
43
+ * Updated `ai-support.json` to include LangGraph ([#3705](https://github.com/newrelic/node-newrelic/pull/3705)) ([aa0ba22](https://github.com/newrelic/node-newrelic/commit/aa0ba2296c13aee7090a532f504ccad2d30c6cd4))
44
+ * Updated eslint configuration ([#3740](https://github.com/newrelic/node-newrelic/pull/3740)) ([d306374](https://github.com/newrelic/node-newrelic/commit/d3063748b8ef6f2fa74dd7791d846e9597a8f525))
45
+
46
+ #### Tests
47
+
48
+ * Updated mcp streaming tests to generate sessions to reuse transport for all streaming tests ([#3729](https://github.com/newrelic/node-newrelic/pull/3729)) ([1772fd5](https://github.com/newrelic/node-newrelic/commit/1772fd599236ce22e970442288f302cf06f93798))
49
+
50
+ ### v13.12.0 (2026-02-02)
51
+
52
+ #### Features
53
+
54
+ * Added instrumentation support for `@langchain/langgraph` ([#3645](https://github.com/newrelic/node-newrelic/pull/3645)) ([f339675](https://github.com/newrelic/node-newrelic/commit/f3396754fb182a3f0af09488a8abb1981b6f3e3f))
55
+ * Added `timestamp` to `LlmChatCompletionSummary` messages
56
+ * Added `timestamp` to AWS Bedrock `LlmChatCompletionSummary` ([#3702](https://github.com/newrelic/node-newrelic/pull/3702)) ([430d1dd](https://github.com/newrelic/node-newrelic/commit/430d1dd5ef847203045486a054142df3a02c7c1c))
57
+ * Added `timestamp` to Google Gen AI `LlmChatCompletionSummary` ([#3690](https://github.com/newrelic/node-newrelic/pull/3690)) ([7748e26](https://github.com/newrelic/node-newrelic/commit/7748e26aceb7b050b13dc686c852513026f043ac))
58
+ * Added `timestamp` to LangChain `LlmChatCompletionSummary` ([#3701](https://github.com/newrelic/node-newrelic/pull/3701)) ([7472118](https://github.com/newrelic/node-newrelic/commit/747211814396e4bf52dc63d249c0ec045b35457a))
59
+ * Added compact mode for span links ([#3681](https://github.com/newrelic/node-newrelic/pull/3681)) ([6ff6961](https://github.com/newrelic/node-newrelic/commit/6ff6961e6b46feb14638da97a95d0891a0d88645))
60
+
61
+ #### Bug fixes
62
+
63
+ * Updated langchain tool instrumentation to properly redefine the segment name on every call ([#3691](https://github.com/newrelic/node-newrelic/pull/3691)) ([4df6068](https://github.com/newrelic/node-newrelic/commit/4df6068d23b5da276486bd3d3f0c3af4b748c4a8))
64
+
65
+ #### Documentation
66
+
67
+ * Updated compatibility report ([#3699](https://github.com/newrelic/node-newrelic/pull/3699)) ([40b6b81](https://github.com/newrelic/node-newrelic/commit/40b6b813e7b6490c2e866a33cb1a7492b35d2a36))
68
+
69
+ ### v13.11.0 (2026-01-29)
70
+
71
+ #### Features
72
+
73
+ * Added `timestamp` to AIM `LlmChatCompletionMessage` messages
74
+ * Added `timestamp` to AWS Bedrock `LlmChatCompletionMessage` ([#3685](https://github.com/newrelic/node-newrelic/pull/3685)) ([ea297c8](https://github.com/newrelic/node-newrelic/commit/ea297c86772c1ae377a16e636db8bbcf53ef1547))
75
+ * Added `timestamp` to Google Gen AI `LlmChatCompletionMessage` ([#3686](https://github.com/newrelic/node-newrelic/pull/3686)) ([f4dd09e](https://github.com/newrelic/node-newrelic/commit/f4dd09ec332c47396277f6aaeff2f6f15daad97a))
76
+ * Added `timestamp` to LangChain input `LlmChatCompletionMessage` ([#3658](https://github.com/newrelic/node-newrelic/pull/3658)) ([0bce235](https://github.com/newrelic/node-newrelic/commit/0bce235ce02f772bc089bf947afadf312c735c1b))
77
+ * Added timestamp to OpenAI `LlmChatCompletionSummary` ([#3689](https://github.com/newrelic/node-newrelic/pull/3689)) ([55b0310](https://github.com/newrelic/node-newrelic/commit/55b03100323eefb3578816cff69f2b919e4b7bdd))
78
+ * Additional support for partial granularity traces (Not available for production use)
79
+ * Added essential tracing mode for span links ([#3670](https://github.com/newrelic/node-newrelic/pull/3670)) ([83dfb84](https://github.com/newrelic/node-newrelic/commit/83dfb84b842e0245392425ce61e92a2789fcaf06))
80
+ * Updated `Supportability/Nodejs/PartialGranularity/NrIds/Dropped` metric to only keep track of spans that got dropped when `nr.ids` execeeded 63 spans. ([#3684](https://github.com/newrelic/node-newrelic/pull/3684)) ([9797cf3](https://github.com/newrelic/node-newrelic/commit/9797cf38aa2808b29da9623158edb221b1819548))
81
+
82
+ #### Bug fixes
83
+
84
+ * Added defensive code in `lib/subscribers/middleware-wrapper.js` to prevent crash when attempting to associate an error on an incoming http request ([#3697](https://github.com/newrelic/node-newrelic/pull/3697)) ([658e78b](https://github.com/newrelic/node-newrelic/commit/658e78ba564eae996d790bb3334bda6847c7e2bd))
85
+ * Updated `pg` instrumentation to properly capture the TraceSegment duration for promise based queries ([#3695](https://github.com/newrelic/node-newrelic/pull/3695)) ([0051697](https://github.com/newrelic/node-newrelic/commit/005169776a3f3fe9d988174857b3c96e6131aea3))
86
+
87
+ #### Code refactoring
88
+
89
+ * Added AIM abstract subscribers and updated all AIM subscribers to use them ([#3676](https://github.com/newrelic/node-newrelic/pull/3676)) ([08cd38b](https://github.com/newrelic/node-newrelic/commit/08cd38b5b34b4f1a2636ccc12d359484af6b3e83))
90
+
91
+ #### Documentation
92
+
93
+ * Updated compatibility report ([#3675](https://github.com/newrelic/node-newrelic/pull/3675)) ([cc898f4](https://github.com/newrelic/node-newrelic/commit/cc898f4d8b0f520e120f330ff9e90fe7baaebedc))
94
+
95
+ #### Miscellaneous chores
96
+
97
+ * Added TimedEvent limit of 100 ([#3683](https://github.com/newrelic/node-newrelic/pull/3683)) ([0d595d8](https://github.com/newrelic/node-newrelic/commit/0d595d8579b5a58e49908bc24321ce7b526ddff2))
98
+ * Added supportability metrics `Supportability/Nodejs/SpanEvent/<Links|Events>/Dropped` when limit of 100 is exceeded ([#3688](https://github.com/newrelic/node-newrelic/pull/3688)) ([a247d31](https://github.com/newrelic/node-newrelic/commit/a247d31fc9c24752be50a73d4ddfc7a088a68ce6))
99
+ * Removed eslint disable next line for `sonarjs/no-dead-store` ([#3692](https://github.com/newrelic/node-newrelic/pull/3692)) ([593fa15](https://github.com/newrelic/node-newrelic/commit/593fa15a033437b95fe375cf6034b8453c7d2b36))
100
+
101
+ #### Continuous Integration
102
+ * Fixed CI issue when sec-agent present ([#3677](https://github.com/newrelic/node-newrelic/pull/3677)) ([23da654](https://github.com/newrelic/node-newrelic/commit/23da6547e72f49bf798046330e8cfa74a0b4d2af))
103
+
104
+ #### Tests
105
+
106
+ * Assert that span events drop in partial traces ([#3680](https://github.com/newrelic/node-newrelic/pull/3680)) ([25e3781](https://github.com/newrelic/node-newrelic/commit/25e3781098343b9ca9e4aed0cd5c9e0f94266926))
107
+
40
108
  ### v13.10.0 (2026-01-20)
41
109
 
42
110
  #### Features
@@ -8299,3 +8367,4 @@ Special thanks to Ryan Copley (@RyanCopley) for the contribution.
8299
8367
 
8300
8368
 
8301
8369
 
8370
+
@@ -722,7 +722,7 @@ This product includes source derived from [@grpc/proto-loader](https://github.co
722
722
 
723
723
  ### @newrelic/security-agent
724
724
 
725
- This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v3.0.0](https://github.com/newrelic/csec-node-agent/tree/v3.0.0)), distributed under the [UNKNOWN License](https://github.com/newrelic/csec-node-agent/blob/v3.0.0/LICENSE):
725
+ This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v3.0.1](https://github.com/newrelic/csec-node-agent/tree/v3.0.1)), distributed under the [UNKNOWN License](https://github.com/newrelic/csec-node-agent/blob/v3.0.1/LICENSE):
726
726
 
727
727
  ```
728
728
  ## New Relic Software License v1.0
@@ -1186,7 +1186,7 @@ This product includes source derived from [@opentelemetry/api](https://github.co
1186
1186
 
1187
1187
  ### @opentelemetry/core
1188
1188
 
1189
- This product includes source derived from [@opentelemetry/core](https://github.com/open-telemetry/opentelemetry-js) ([v2.2.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.2.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.2.0/LICENSE):
1189
+ This product includes source derived from [@opentelemetry/core](https://github.com/open-telemetry/opentelemetry-js) ([v2.5.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.5.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.5.0/LICENSE):
1190
1190
 
1191
1191
  ```
1192
1192
  Apache License
@@ -1604,7 +1604,7 @@ This product includes source derived from [@opentelemetry/exporter-metrics-otlp-
1604
1604
 
1605
1605
  ### @opentelemetry/resources
1606
1606
 
1607
- This product includes source derived from [@opentelemetry/resources](https://github.com/open-telemetry/opentelemetry-js) ([v2.2.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.2.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.2.0/LICENSE):
1607
+ This product includes source derived from [@opentelemetry/resources](https://github.com/open-telemetry/opentelemetry-js) ([v2.5.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.5.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.5.0/LICENSE):
1608
1608
 
1609
1609
  ```
1610
1610
  Apache License
@@ -2022,7 +2022,7 @@ This product includes source derived from [@opentelemetry/sdk-logs](https://gith
2022
2022
 
2023
2023
  ### @opentelemetry/sdk-metrics
2024
2024
 
2025
- This product includes source derived from [@opentelemetry/sdk-metrics](https://github.com/open-telemetry/opentelemetry-js) ([v2.2.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.2.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.2.0/LICENSE):
2025
+ This product includes source derived from [@opentelemetry/sdk-metrics](https://github.com/open-telemetry/opentelemetry-js) ([v2.5.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.5.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.5.0/LICENSE):
2026
2026
 
2027
2027
  ```
2028
2028
  Apache License
@@ -2231,7 +2231,7 @@ This product includes source derived from [@opentelemetry/sdk-metrics](https://g
2231
2231
 
2232
2232
  ### @opentelemetry/sdk-trace-base
2233
2233
 
2234
- This product includes source derived from [@opentelemetry/sdk-trace-base](https://github.com/open-telemetry/opentelemetry-js) ([v2.2.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.2.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.2.0/LICENSE):
2234
+ This product includes source derived from [@opentelemetry/sdk-trace-base](https://github.com/open-telemetry/opentelemetry-js) ([v2.5.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.5.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.5.0/LICENSE):
2235
2235
 
2236
2236
  ```
2237
2237
  Apache License
@@ -2960,7 +2960,7 @@ SOFTWARE.
2960
2960
 
2961
2961
  ### @aws-sdk/client-s3
2962
2962
 
2963
- This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.958.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.958.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.958.0/LICENSE):
2963
+ This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.982.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.982.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.982.0/LICENSE):
2964
2964
 
2965
2965
  ```
2966
2966
  Apache License
@@ -3169,7 +3169,7 @@ This product includes source derived from [@aws-sdk/client-s3](https://github.co
3169
3169
 
3170
3170
  ### @aws-sdk/s3-request-presigner
3171
3171
 
3172
- This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.958.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.958.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.958.0/LICENSE):
3172
+ This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.982.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.982.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.982.0/LICENSE):
3173
3173
 
3174
3174
  ```
3175
3175
  Apache License
@@ -3407,7 +3407,7 @@ SOFTWARE.
3407
3407
 
3408
3408
  ### @newrelic/eslint-config
3409
3409
 
3410
- This product includes source derived from [@newrelic/eslint-config](https://github.com/newrelic/eslint-config-newrelic) ([v0.6.0](https://github.com/newrelic/eslint-config-newrelic/tree/v0.6.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/eslint-config-newrelic/blob/v0.6.0/LICENSE):
3410
+ This product includes source derived from [@newrelic/eslint-config](https://github.com/newrelic/eslint-config-newrelic) ([v0.7.0](https://github.com/newrelic/eslint-config-newrelic/tree/v0.7.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/eslint-config-newrelic/blob/v0.7.0/LICENSE):
3411
3411
 
3412
3412
  ```
3413
3413
  Apache License
@@ -5637,19 +5637,19 @@ MIT License
5637
5637
 
5638
5638
  Copyright (c) <year> <copyright holders>
5639
5639
 
5640
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
5641
- associated documentation files (the "Software"), to deal in the Software without restriction, including
5642
- without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5643
- copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
5640
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
5641
+ associated documentation files (the "Software"), to deal in the Software without restriction, including
5642
+ without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5643
+ copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
5644
5644
  following conditions:
5645
5645
 
5646
- The above copyright notice and this permission notice shall be included in all copies or substantial
5646
+ The above copyright notice and this permission notice shall be included in all copies or substantial
5647
5647
  portions of the Software.
5648
5648
 
5649
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
5650
- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
5651
- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
5652
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
5649
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
5650
+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
5651
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
5652
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
5653
5653
  USE OR OTHER DEALINGS IN THE SOFTWARE.
5654
5654
  ```
5655
5655
 
@@ -0,0 +1,92 @@
1
+ /*
2
+ * Copyright 2026 New Relic Corporation. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ 'use strict'
7
+
8
+ const logger = require('../logger').child({ component: 'pprof_aggregator' })
9
+ const BaseAggregator = require('./base-aggregator')
10
+ const ProfilingManager = require('#agentlib/profiling/index.js')
11
+
12
+ /**
13
+ * Serves as a means for transmitting pprof data as it is being collected.
14
+ * This doesn't really work as an "aggregator". It instead leverages the `BaseAggregator`
15
+ * to integrate with the `Harvester` and `Collector`
16
+ *
17
+ * The `ProfilingAggregator` aggregator overrides the base `start` method.
18
+ * It sets up the interval based on configuration but instead of calling `send`,
19
+ * it calls `collectData` which instructs the Profiler to collect profiling data
20
+ * for every registered profiler(cpu, heap at the moment if enabled)
21
+ *
22
+ * @private
23
+ * @class
24
+ */
25
+ class ProfilingAggregator extends BaseAggregator {
26
+ constructor(opts = {}, agent) {
27
+ const { collector, harvester } = agent
28
+ opts.method = opts.method || 'pprof_data'
29
+ super(opts, collector, harvester)
30
+ this.agent = agent
31
+ this.profilingManager = new ProfilingManager(agent)
32
+ this.pprofData = null
33
+ }
34
+
35
+ // simply returns what was given from the profiler collect method
36
+ _toPayloadSync() {
37
+ return this.pprofData
38
+ }
39
+
40
+ /**
41
+ * This overrides the default `start` method
42
+ * as we want to collect profiling data for `cpu` and/or `heap`
43
+ * and send the gzipped binary encoded data for each profiler
44
+ */
45
+ start() {
46
+ logger.trace(`${this.method} aggregator started.`)
47
+ this.profilingManager.register()
48
+
49
+ if (!this.sendTimer) {
50
+ this.sendTimer = setInterval(this.collectData.bind(this), this.periodMs)
51
+ this.sendTimer.unref()
52
+ }
53
+ }
54
+
55
+ stop() {
56
+ super.stop()
57
+ this.profilingManager.stop()
58
+ }
59
+
60
+ /**
61
+ * Called on an interval. Iterates over all registered profilers
62
+ * and collects data for the given time period. Then asynchronously
63
+ * calls send which takes care of sending the data to the collector
64
+ */
65
+ collectData() {
66
+ const self = this
67
+ for (const pprofData of this.profilingManager.collect()) {
68
+ if (pprofData) {
69
+ self.pprofData = pprofData
70
+ self.send()
71
+ }
72
+ }
73
+ }
74
+
75
+ // `pprof_data` is not retained/merged in any way to just return null
76
+ _getMergeData() {
77
+ return null
78
+ }
79
+
80
+ // this implies the transmission fails
81
+ // we log this error in `lib/collector/api.js#_handleResponseCode`
82
+ _merge() {
83
+ return null
84
+ }
85
+
86
+ // clears the `this.pprofData` for the next iteration of profiling collection
87
+ clear() {
88
+ this.pprofData = null
89
+ }
90
+ }
91
+
92
+ module.exports = ProfilingAggregator
@@ -90,23 +90,31 @@ function CollectorAPI(agent) {
90
90
  * save some GC time?
91
91
  */
92
92
  this._methods = {}
93
- for (const name of [
94
- 'preconnect',
95
- 'connect',
96
- 'agent_settings',
97
- 'error_data',
98
- 'metric_data',
99
- 'transaction_sample_data',
100
- 'shutdown',
101
- 'analytic_event_data',
102
- 'custom_event_data',
103
- 'sql_trace_data',
104
- 'error_event_data',
105
- 'span_event_data',
106
- 'log_event_data'
93
+ for (const methodOptions of [
94
+ { name: 'preconnect' },
95
+ { name: 'connect' },
96
+ { name: 'agent_settings' },
97
+ { name: 'error_data' },
98
+ { name: 'metric_data' },
99
+ { name: 'transaction_sample_data' },
100
+ { name: 'shutdown' },
101
+ { name: 'analytic_event_data' },
102
+ { name: 'custom_event_data' },
103
+ { name: 'sql_trace_data' },
104
+ { name: 'error_event_data' },
105
+ { name: 'span_event_data' },
106
+ { name: 'log_event_data' },
107
+ { name: 'pprof_data', contentType: 'application/octet-stream' },
107
108
  ]) {
108
- const method = new RemoteMethod(name, agent, initialEndpoint)
109
- this._methods[name] = method
109
+ const method = new RemoteMethod(
110
+ {
111
+ name: methodOptions.name,
112
+ agent,
113
+ endpoint: initialEndpoint,
114
+ contentType: methodOptions.contentType
115
+ }
116
+ )
117
+ this._methods[methodOptions.name] = method
110
118
  }
111
119
  }
112
120
 
@@ -34,7 +34,7 @@ const USER_AGENT_FORMAT = 'NewRelic-NodeAgent/%s (nodejs %s %s-%s)'
34
34
  const ENCODING_HEADER = 'CONTENT-ENCODING'
35
35
  const DEFAULT_ENCODING = 'identity'
36
36
 
37
- function RemoteMethod(name, agent, endpoint) {
37
+ function RemoteMethod({ name, agent, endpoint, contentType = 'application/json' }) {
38
38
  if (!name) {
39
39
  throw new TypeError('Must include name of method to invoke on collector.')
40
40
  }
@@ -48,6 +48,7 @@ function RemoteMethod(name, agent, endpoint) {
48
48
  this._protocolVersion = 17
49
49
 
50
50
  this.endpoint = endpoint
51
+ this._contentType = contentType
51
52
  }
52
53
 
53
54
  RemoteMethod.prototype.updateEndpoint = function updateEndpoint(endpoint) {
@@ -377,7 +378,7 @@ RemoteMethod.prototype._headers = function _headers(options) {
377
378
  'User-Agent': agent,
378
379
  Connection: 'Keep-Alive',
379
380
  'Content-Length': byteLength(options.body),
380
- 'Content-Type': 'application/json'
381
+ 'Content-Type': this._contentType
381
382
  }
382
383
 
383
384
  if (options.compressed) {
@@ -1253,6 +1253,61 @@ defaultConfig.definition = () => {
1253
1253
  default: true
1254
1254
  }
1255
1255
  },
1256
+ /**
1257
+ * Controls the behavior of the profiler.
1258
+ */
1259
+ profiling: {
1260
+ enabled: {
1261
+ formatter: boolean,
1262
+ default: false
1263
+ },
1264
+ /**
1265
+ * Harvest and ingest profile data every n milliseconds
1266
+ */
1267
+ sample_interval: {
1268
+ formatter: int,
1269
+ default: 100
1270
+ },
1271
+ /**
1272
+ * List of profile type names to enable. Only cpu and heap profiles are currently supported
1273
+ */
1274
+ include: {
1275
+ formatter: array,
1276
+ default: ['cpu', 'heap']
1277
+ },
1278
+ /**
1279
+ * Delay in milliseconds before starting profiler.
1280
+ */
1281
+ delay: {
1282
+ formatter: int,
1283
+ default: 0
1284
+ },
1285
+ /**
1286
+ * If >0, stop profiler after this many milliseconds of operation.
1287
+ */
1288
+ duration: {
1289
+ formatter: int,
1290
+ default: 0
1291
+ },
1292
+ /**
1293
+ * Restart the cpu profiler every n milliseconds to report its data
1294
+ */
1295
+ cpu: {
1296
+ report_interval: {
1297
+ formatter: int,
1298
+ default: 0
1299
+ }
1300
+ },
1301
+ /**
1302
+ * Restart heap profiler every n milliseconds to report its data
1303
+ */
1304
+ heap: {
1305
+ report_interval: {
1306
+ formatter: int,
1307
+ default: 0
1308
+ }
1309
+ }
1310
+ },
1256
1311
 
1257
1312
  /**
1258
1313
  * When `true`, the AWS Lambda instrumentation will add the necessary
@@ -1707,7 +1762,7 @@ defaultConfig.definition = () => {
1707
1762
  * agent.
1708
1763
  */
1709
1764
  traces: {
1710
- enabled: { default: false, formatter: boolean }
1765
+ enabled: { default: true, formatter: boolean }
1711
1766
  },
1712
1767
 
1713
1768
  /**
@@ -1719,7 +1774,7 @@ defaultConfig.definition = () => {
1719
1774
  * application logs forwarding must be enabled as well.
1720
1775
  */
1721
1776
  logs: {
1722
- enabled: { default: false, formatter: boolean }
1777
+ enabled: { default: true, formatter: boolean }
1723
1778
  },
1724
1779
 
1725
1780
  /**
@@ -1729,26 +1784,26 @@ defaultConfig.definition = () => {
1729
1784
  * application entity that is instrumented by the New Relic agent.
1730
1785
  */
1731
1786
  metrics: {
1732
- enabled: { default: false, formatter: boolean },
1787
+ enabled: { default: true, formatter: boolean },
1733
1788
 
1734
1789
  /**
1735
- * `exportInterval` defines the number of milliseconds between each
1790
+ * `export_interval` defines the number of milliseconds between each
1736
1791
  * attempt to ship metrics to New Relic. This value must be equal to
1737
- * or greater than the value of `exportTimeout`.
1792
+ * or greater than the value of `export_timeout`.
1738
1793
  */
1739
- exportInterval: {
1794
+ export_interval: {
1740
1795
  default: 60_000,
1741
1796
  formatter: int
1742
1797
  },
1743
1798
 
1744
1799
  /**
1745
- * `exportTimeout` defines the number of milliseconds an export operation
1800
+ * `export_timeout` defines the number of milliseconds an export operation
1746
1801
  * is allowed in order to successfully complete. If the timeout is
1747
1802
  * exceeded, it will be reported via the OpenTelemetry diagnostics
1748
1803
  * API.
1749
1804
  */
1750
- exportTimeout: {
1751
- default: 30_000,
1805
+ export_timeout: {
1806
+ default: 10_000,
1752
1807
  formatter: int
1753
1808
  }
1754
1809
  }
@@ -37,6 +37,7 @@ class LlmChatCompletionSummary extends LlmEvent {
37
37
  this['request.temperature'] = cmd.temperature
38
38
  this['response.number_of_messages'] = (cmd.prompt.length ?? 0) + (res.completions.length ?? 0)
39
39
 
40
+ this.timestamp = segment.timer.start
40
41
  this.setTokens(agent)
41
42
  }
42
43