newrelic 11.10.3 → 11.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.
- package/NEWS.md +63 -0
- package/README.md +3 -1
- package/THIRD_PARTY_NOTICES.md +53 -58
- package/api.js +22 -49
- package/lib/agent.js +46 -217
- package/lib/aggregators/base-aggregator.js +19 -4
- package/lib/aggregators/event-aggregator.js +4 -3
- package/lib/aggregators/log-aggregator.js +2 -2
- package/lib/aggregators/trace-aggregator.js +2 -2
- package/lib/collector/api.js +63 -210
- package/lib/collector/remote-method.js +3 -1
- package/lib/collector/serverless.js +5 -112
- package/lib/config/default.js +10 -0
- package/lib/config/index.js +1 -1
- package/lib/custom-events/custom-event-aggregator.js +3 -5
- package/lib/db/query-trace-aggregator.js +2 -2
- package/lib/errors/error-collector.js +0 -45
- package/lib/errors/error-event-aggregator.js +8 -2
- package/lib/errors/error-trace-aggregator.js +9 -2
- package/lib/harvester.js +84 -0
- package/lib/instrumentation/@elastic/elasticsearch.js +4 -2
- package/lib/instrumentation/@hapi/hapi.js +32 -22
- package/lib/instrumentation/@hapi/vision.js +2 -1
- package/lib/instrumentation/@node-redis/client.js +9 -4
- package/lib/instrumentation/@prisma/client.js +3 -2
- package/lib/instrumentation/amqplib/amqplib.js +71 -41
- package/lib/instrumentation/cassandra-driver.js +30 -13
- package/lib/instrumentation/connect.js +20 -11
- package/lib/instrumentation/core/child_process.js +3 -1
- package/lib/instrumentation/core/crypto.js +4 -2
- package/lib/instrumentation/core/dns.js +3 -1
- package/lib/instrumentation/core/fs.js +2 -1
- package/lib/instrumentation/core/timers.js +2 -1
- package/lib/instrumentation/core/zlib.js +2 -1
- package/lib/instrumentation/director.js +37 -25
- package/lib/instrumentation/express.js +114 -68
- package/lib/instrumentation/fastify/spec-builders.js +6 -4
- package/lib/instrumentation/fastify.js +3 -2
- package/lib/instrumentation/grpc-js/grpc.js +5 -1
- package/lib/instrumentation/ioredis.js +9 -6
- package/lib/instrumentation/langchain/callback-manager.js +25 -0
- package/lib/instrumentation/langchain/common.js +65 -0
- package/lib/instrumentation/langchain/nr-hooks.js +27 -0
- package/lib/instrumentation/langchain/runnable.js +124 -0
- package/lib/instrumentation/langchain/tools.js +69 -0
- package/lib/instrumentation/memcached.js +8 -4
- package/lib/instrumentation/mongodb/common.js +24 -17
- package/lib/instrumentation/mongodb/v2-mongo.js +4 -3
- package/lib/instrumentation/mongodb/v3-mongo.js +2 -1
- package/lib/instrumentation/mongodb/v4-mongo.js +2 -1
- package/lib/instrumentation/mysql/mysql.js +12 -9
- package/lib/instrumentation/openai.js +25 -35
- package/lib/instrumentation/pg.js +10 -8
- package/lib/instrumentation/redis.js +10 -6
- package/lib/instrumentation/restify.js +50 -43
- package/lib/instrumentations.js +2 -1
- package/lib/llm-events/{openai/error-message.js → error-message.js} +5 -1
- package/lib/llm-events/event.js +7 -3
- package/lib/llm-events/{openai/feedback-message.js → feedback-message.js} +2 -4
- package/lib/llm-events/langchain/chat-completion-message.js +8 -7
- package/lib/llm-events/langchain/chat-completion-summary.js +0 -15
- package/lib/llm-events/langchain/event.js +10 -4
- package/lib/llm-events/langchain/index.js +2 -1
- package/lib/llm-events/langchain/tool.js +24 -0
- package/lib/llm-events/openai/chat-completion-message.js +0 -1
- package/lib/llm-events/openai/chat-completion-summary.js +0 -1
- package/lib/llm-events/openai/event.js +1 -1
- package/lib/llm-events/openai/index.js +2 -4
- package/lib/metrics/metric-aggregator.js +2 -2
- package/lib/metrics/names.js +13 -2
- package/lib/serverless/aws-lambda.js +2 -1
- package/lib/shim/datastore-shim.js +74 -155
- package/lib/shim/message-shim/index.js +2 -1
- package/lib/shim/message-shim/subscribe-consume.js +7 -4
- package/lib/shim/shim.js +17 -230
- package/lib/shim/specs/class.js +97 -0
- package/lib/shim/specs/constants.js +16 -0
- package/lib/shim/specs/index.js +21 -97
- package/lib/shim/specs/message-subscribe.js +41 -0
- package/lib/shim/specs/message.js +90 -0
- package/lib/shim/specs/middleware-mounter.js +83 -0
- package/lib/shim/specs/middleware.js +150 -0
- package/lib/shim/specs/operation.js +50 -0
- package/lib/shim/specs/params/datastore.js +40 -0
- package/lib/shim/specs/params/queue-message.js +31 -0
- package/lib/shim/specs/query.js +53 -0
- package/lib/shim/specs/recorder.js +127 -0
- package/lib/shim/specs/render.js +43 -0
- package/lib/shim/specs/segment.js +114 -0
- package/lib/shim/specs/spec.js +18 -0
- package/lib/shim/specs/transaction.js +58 -0
- package/lib/shim/specs/wrap.js +67 -0
- package/lib/shim/transaction-shim.js +4 -26
- package/lib/shim/webframework-shim/common.js +3 -0
- package/lib/shim/webframework-shim/index.js +8 -127
- package/lib/shim/webframework-shim/middleware-mounter.js +7 -8
- package/lib/shimmer.js +6 -5
- package/lib/spans/create-span-event-aggregator.js +15 -10
- package/lib/spans/span-event-aggregator.js +2 -2
- package/lib/spans/streaming-span-event-aggregator.js +3 -2
- package/lib/symbols.js +1 -0
- package/lib/transaction/index.js +0 -5
- package/lib/transaction/trace/aggregator.js +2 -2
- package/lib/transaction/trace/index.js +1 -1
- package/lib/transaction/transaction-event-aggregator.js +3 -3
- package/lib/util/properties.js +1 -1
- package/package.json +5 -5
- package/lib/llm-events/tracked-ids.js +0 -27
package/NEWS.md
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
|
+
### v11.11.0 (2024-02-27)
|
|
2
|
+
|
|
3
|
+
#### Features
|
|
4
|
+
|
|
5
|
+
* Added instrumentation for RunnableSequence ([#1996](https://github.com/newrelic/node-newrelic/pull/1996)) ([71ffa37](https://github.com/newrelic/node-newrelic/commit/71ffa373e01d27be4d3ad40464facc8a33f4aeb2))
|
|
6
|
+
|
|
7
|
+
* Added LangChain error events capture ([#2040](https://github.com/newrelic/node-newrelic/pull/2040)) ([4d0d839](https://github.com/newrelic/node-newrelic/commit/4d0d8396ac3c19dee9d14477d8b408efaae3c24f))
|
|
8
|
+
|
|
9
|
+
* Added `ai_monitoring.streaming.enabled`. When set to `false` this will not instrument chat completion streams, thus it will not create relevant Llm events. ([#2021](https://github.com/newrelic/node-newrelic/pull/2021)) ([ff78b51](https://github.com/newrelic/node-newrelic/commit/ff78b514d0afe8127a094ce810f164b08768bcac))
|
|
10
|
+
* Added ability to recordLlmFeedbackEvent by traceId ([#2043](https://github.com/newrelic/node-newrelic/pull/2043)) ([b0a4ed1](https://github.com/newrelic/node-newrelic/commit/b0a4ed10ad7d6e021727d6d5e4746292e7a34ea1))
|
|
11
|
+
* Added instrumentation for langchain tools. ([#2009](https://github.com/newrelic/node-newrelic/pull/2009)) ([695d10e](https://github.com/newrelic/node-newrelic/commit/695d10e28ee6cbeba252299d7d94c9660137d293))
|
|
12
|
+
|
|
13
|
+
#### Code refactoring
|
|
14
|
+
|
|
15
|
+
* Updated AIM instrumentation ([#2015](https://github.com/newrelic/node-newrelic/pull/2015)) ([d37d2a8](https://github.com/newrelic/node-newrelic/commit/d37d2a88a4754c23ee039955c5839d8b7d35f875))
|
|
16
|
+
* removed capturing last 4 of api key
|
|
17
|
+
* included all custom attributes prefixed with `llm.` as attributes on all Llm events
|
|
18
|
+
* changed tracking metric to start with Supportability
|
|
19
|
+
|
|
20
|
+
* Updated capturing conversation_id on Llm Events as `llm.conversation_id` ([#2020](https://github.com/newrelic/node-newrelic/pull/2020)) ([5f93f65](https://github.com/newrelic/node-newrelic/commit/5f93f6571eeb38740d8f3cb59f7706d9cb07c67a))
|
|
21
|
+
* Updated instrumentation to construct specs at source instead of within the shim methods ([#2035](https://github.com/newrelic/node-newrelic/pull/2035)) ([ead8c25](https://github.com/newrelic/node-newrelic/commit/ead8c25e851d49b199cf808529e6483b2a3f024d))
|
|
22
|
+
* Simplified the logic in `shim.recordQuery` and `shim.recordOperation` to reduce merging of spec properties and rely on the constructed spec
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
#### Documentation
|
|
26
|
+
|
|
27
|
+
* Added note about using sudo for firewall script ([#2032](https://github.com/newrelic/node-newrelic/pull/2032)) ([bf106d2](https://github.com/newrelic/node-newrelic/commit/bf106d2a8a84d86443765a27d031233993cbd788))
|
|
28
|
+
|
|
29
|
+
* Fixed spec objects parameter definitions ([#2024](https://github.com/newrelic/node-newrelic/pull/2024)) ([4378173](https://github.com/newrelic/node-newrelic/commit/4378173b19cd1a7c92c38d6d9d7c6ad22d823fe5))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
#### Miscellaneous chores
|
|
33
|
+
|
|
34
|
+
* Added missing is_response to LangChain completion messages ([#2044](https://github.com/newrelic/node-newrelic/pull/2044)) ([20c7d47](https://github.com/newrelic/node-newrelic/commit/20c7d473e318d50854ab8fefcc92d0b7a3b95b64))
|
|
35
|
+
|
|
36
|
+
* Attached specs to the `Shim.prototype` for use in custom instrumentation and instrumentation outside of the agent ([#2038](https://github.com/newrelic/node-newrelic/pull/2038)) ([2c97488](https://github.com/newrelic/node-newrelic/commit/2c974887068b7cc522eb29dd781481bb1583bde7))
|
|
37
|
+
* **deps:** Updated to use @newrelic/ritm from require-in-the-middle ([#2034](https://github.com/newrelic/node-newrelic/pull/2034)) ([ffb729f](https://github.com/newrelic/node-newrelic/commit/ffb729f1e9389e7a3d495b09df913eb3b5b43c3f))
|
|
38
|
+
* Updated DatastoreParameters to include collection ([#2039](https://github.com/newrelic/node-newrelic/pull/2039)) ([b9c73ca](https://github.com/newrelic/node-newrelic/commit/b9c73ca482d13d26f2bf54c22cd3ab4f77f413ca))
|
|
39
|
+
|
|
40
|
+
#### Tests
|
|
41
|
+
|
|
42
|
+
* Cleaned up pending mocks in the log dropping test to avoid a console warning around pending mocks in after each ([#2017](https://github.com/newrelic/node-newrelic/pull/2017)) ([d2f40c2](https://github.com/newrelic/node-newrelic/commit/d2f40c2e67c5bff826d0234412eacdfff70a2fd7))
|
|
43
|
+
|
|
44
|
+
### v11.10.4 (2024-02-13)
|
|
45
|
+
|
|
46
|
+
#### Bug fixes
|
|
47
|
+
|
|
48
|
+
* Resolved application logs getting blocked when an excessive payload is encountered ([#2013](https://github.com/newrelic/node-newrelic/pull/2013)) ([365ded4](https://github.com/newrelic/node-newrelic/commit/365ded432b7781ee9c896bf0e067dac8cc2c45cc))
|
|
49
|
+
* Updated Shim to properly calculate the `_moduleRoot` on windows environments ([#2014](https://github.com/newrelic/node-newrelic/pull/2014)) ([ab0bd7f](https://github.com/newrelic/node-newrelic/commit/ab0bd7f87a5ed6ea38f51f068a2fc066af8f8d74))
|
|
50
|
+
|
|
51
|
+
#### Code refactoring
|
|
52
|
+
|
|
53
|
+
* Abstracted registering of new aggregators into a Harvester class that is responsible for starting, stopping, updating all registered aggregators. ([#1994](https://github.com/newrelic/node-newrelic/pull/1994)) ([1fb85a6](https://github.com/newrelic/node-newrelic/commit/1fb85a6f97c522ce2951911c670fcbddaa218049))
|
|
54
|
+
* Refactored specs into classes for easier code navigation ([#2004](https://github.com/newrelic/node-newrelic/pull/2004)) ([4daedc0](https://github.com/newrelic/node-newrelic/commit/4daedc08c707bec22056466ef15a45b50f20026f))
|
|
55
|
+
|
|
56
|
+
#### Miscellaneous chores
|
|
57
|
+
|
|
58
|
+
* **deps:** Updated @newrelic/security agent to v1.0.1 ([#2002](https://github.com/newrelic/node-newrelic/pull/2002)) ([b460c7b](https://github.com/newrelic/node-newrelic/commit/b460c7be589dd6fa801285b756bf66f62e0f10aa))
|
|
59
|
+
|
|
60
|
+
#### Tests
|
|
61
|
+
|
|
62
|
+
* Updated smoke tests to send data to the appropriate collector method ([#2005](https://github.com/newrelic/node-newrelic/pull/2005)) ([6130486](https://github.com/newrelic/node-newrelic/commit/6130486514268b02f68dccceb9b1e29d1e99c78e))
|
|
63
|
+
|
|
1
64
|
### v11.10.3 (2024-02-07)
|
|
2
65
|
|
|
3
66
|
#### Features
|
package/README.md
CHANGED
|
@@ -242,7 +242,9 @@ To [all contributors](https://github.com/newrelic/node-newrelic/graphs/contribut
|
|
|
242
242
|
|
|
243
243
|
## License
|
|
244
244
|
|
|
245
|
-
|
|
245
|
+
Except as noted below, the Node.js agent is licensed under the [Apache 2.0](https://apache.org/licenses/LICENSE-2.0.txt) License.
|
|
246
|
+
|
|
247
|
+
The New Relic [security agent](https://github.com/newrelic/csec-node-agent) is licensed under the New Relic Software License v1.0. The New Relic security agent module may be integrated like the New Relic Node.js agent.
|
|
246
248
|
|
|
247
249
|
The Node.js agent also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in [the third-party notices document](https://github.com/newrelic/node-newrelic/blob/main/THIRD_PARTY_NOTICES.md).
|
|
248
250
|
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -18,6 +18,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
|
|
|
18
18
|
* [@grpc/proto-loader](#grpcproto-loader)
|
|
19
19
|
* [@newrelic/aws-sdk](#newrelicaws-sdk)
|
|
20
20
|
* [@newrelic/koa](#newrelickoa)
|
|
21
|
+
* [@newrelic/ritm](#newrelicritm)
|
|
21
22
|
* [@newrelic/security-agent](#newrelicsecurity-agent)
|
|
22
23
|
* [@newrelic/superagent](#newrelicsuperagent)
|
|
23
24
|
* [@tyriar/fibonacci-heap](#tyriarfibonacci-heap)
|
|
@@ -28,7 +29,6 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
|
|
|
28
29
|
* [json-stringify-safe](#json-stringify-safe)
|
|
29
30
|
* [module-details-from-path](#module-details-from-path)
|
|
30
31
|
* [readable-stream](#readable-stream)
|
|
31
|
-
* [require-in-the-middle](#require-in-the-middle)
|
|
32
32
|
* [semver](#semver)
|
|
33
33
|
* [winston-transport](#winston-transport)
|
|
34
34
|
|
|
@@ -919,54 +919,79 @@ Apache License
|
|
|
919
919
|
|
|
920
920
|
```
|
|
921
921
|
|
|
922
|
-
### @newrelic/
|
|
922
|
+
### @newrelic/ritm
|
|
923
923
|
|
|
924
|
-
This product includes source derived from [@newrelic/
|
|
924
|
+
This product includes source derived from [@newrelic/ritm](https://github.com/newrelic-forks/require-in-the-middle) ([v7.2.0](https://github.com/newrelic-forks/require-in-the-middle/tree/v7.2.0)), distributed under the [MIT License](https://github.com/newrelic-forks/require-in-the-middle/blob/v7.2.0/LICENSE):
|
|
925
925
|
|
|
926
926
|
```
|
|
927
|
-
|
|
927
|
+
The MIT License (MIT)
|
|
928
928
|
|
|
929
|
-
|
|
929
|
+
Copyright (c) 2016-2019, Thomas Watson Steen
|
|
930
|
+
Copyright (c) 2019-2023, Elasticsearch B.V.
|
|
930
931
|
|
|
931
|
-
|
|
932
|
-
|
|
932
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
933
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
934
|
+
in the Software without restriction, including without limitation the rights
|
|
935
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
936
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
937
|
+
furnished to do so, subject to the following conditions:
|
|
933
938
|
|
|
934
|
-
|
|
939
|
+
The above copyright notice and this permission notice shall be included in all
|
|
940
|
+
copies or substantial portions of the Software.
|
|
935
941
|
|
|
936
|
-
|
|
942
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
943
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
944
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
945
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
946
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
947
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
948
|
+
SOFTWARE.
|
|
937
949
|
|
|
938
|
-
|
|
950
|
+
```
|
|
939
951
|
|
|
940
|
-
|
|
952
|
+
### @newrelic/security-agent
|
|
941
953
|
|
|
942
|
-
|
|
954
|
+
This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v1.0.1](https://github.com/newrelic/csec-node-agent/tree/v1.0.1)), distributed under the [UNKNOWN License](https://github.com/newrelic/csec-node-agent/blob/v1.0.1/LICENSE):
|
|
943
955
|
|
|
944
|
-
|
|
956
|
+
```
|
|
957
|
+
## New Relic Software License v1.0
|
|
958
|
+
|
|
959
|
+
### Acceptance
|
|
960
|
+
|
|
961
|
+
This software license applies to the repositories, directories, or files that it has been associated with (referred to here as “the Software”). In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
962
|
+
|
|
963
|
+
### License
|
|
964
|
+
|
|
965
|
+
New Relic grants you a license for the Software to do everything you might do with the Software that would otherwise infringe the New Relic’s copyrights or patent rights, conditional on only using the Software for Permitted Purposes and compliance with all other Restrictions on Use. All other uses are prohibited.
|
|
966
|
+
|
|
967
|
+
### Permitted Purposes
|
|
945
968
|
|
|
946
|
-
|
|
969
|
+
The Software is solely for use with New Relic’s proprietary SaaS service (“New Relic Service”). To use the Software you must have a valid and active subscription agreement to the New Relic Service. You may not use the Software in conjunction with any other similar service.
|
|
947
970
|
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
971
|
+
### Restrictions on Use
|
|
972
|
+
|
|
973
|
+
1. The use of the Software is limited to you and your organization. You cannot expose the Software to third parties via the network or use the Software on behalf of anyone else.
|
|
974
|
+
2. You cannot modify the Software. You can compile or link the Software into your programs as described in the New Relic Documentation, but you cannot otherwise make any derivative works of the Software.
|
|
975
|
+
3. You cannot reverse engineer or decompile the Software.
|
|
976
|
+
4. You cannot use the Software for competitive analysis, benchmarking, or any purposes that compete with or are intended to compete with New Relic.
|
|
977
|
+
5. You cannot remove or obscure any proprietary notices in the Software.
|
|
978
|
+
6. You can only copy the Software to the extent needed to use the Software within your organization. You cannot distribute the Software to any third parties.
|
|
979
|
+
7. You can only use the New Relic Services and the Software consistent with your subscription agreement with New Relic, New Relic’s product Documentation and Acceptable Use Policy.
|
|
955
980
|
|
|
956
981
|
### Intellectual Property
|
|
957
982
|
|
|
958
|
-
Any feedback provided to New Relic about the
|
|
983
|
+
Any feedback provided to New Relic about the Software, including feedback provided as source code, comments, or other copyrightable or patentable material, is provided to New Relic under the terms of the Apache Software License, version 2. If you do not provide attribution information or a copy of the license with your feedback, you waive the performance of those requirements of the Apache License with respect to New Relic. The license grant regarding any feedback is irrevocable and persists past the termination of this license.
|
|
959
984
|
|
|
960
985
|
### Termination
|
|
961
986
|
|
|
962
|
-
This license terminates when the
|
|
987
|
+
This license terminates when the Software stops being provided by New Relic or when described by the New Relic subscription agreement, whichever comes first. When this license terminates, you have a commercially reasonable time to either remove the Software from your systems.
|
|
963
988
|
|
|
964
989
|
### Other Terms
|
|
965
990
|
|
|
966
|
-
1. The
|
|
967
|
-
2.
|
|
968
|
-
3.
|
|
969
|
-
|
|
991
|
+
1. The Software is provided “AS IS.” New Relic disclaims all warranties, whether express, implied, statutory or otherwise, including warranties of merchantability, fitness for a particular purpose, title, and noninfringement.
|
|
992
|
+
2. To the full extent permitted by law, New Relic will have no liability arising from or related to the Software or from this license for any direct, indirect, special, incidental, or consequential damages of any kind, even if advised of their possibility in advance, and regardless of legal theory (whether contract, tort, negligence, strict liability or otherwise).
|
|
993
|
+
3. The Software may contain third-party software, including open source software (“OSS”). The third party software is governed by its own license and subject to its own terms, disclosed in the provided licensing information associated with the third party components. If a source code disclosure is required under the terms of the license covering any OSS component, the source code can be requested of New Relic by emailing opensource@newrelic.com.
|
|
994
|
+
|
|
970
995
|
|
|
971
996
|
```
|
|
972
997
|
|
|
@@ -1411,36 +1436,6 @@ IN THE SOFTWARE.
|
|
|
1411
1436
|
|
|
1412
1437
|
```
|
|
1413
1438
|
|
|
1414
|
-
### require-in-the-middle
|
|
1415
|
-
|
|
1416
|
-
This product includes source derived from [require-in-the-middle](https://github.com/elastic/require-in-the-middle) ([v7.2.0](https://github.com/elastic/require-in-the-middle/tree/v7.2.0)), distributed under the [MIT License](https://github.com/elastic/require-in-the-middle/blob/v7.2.0/LICENSE):
|
|
1417
|
-
|
|
1418
|
-
```
|
|
1419
|
-
The MIT License (MIT)
|
|
1420
|
-
|
|
1421
|
-
Copyright (c) 2016-2019, Thomas Watson Steen
|
|
1422
|
-
Copyright (c) 2019-2023, Elasticsearch B.V.
|
|
1423
|
-
|
|
1424
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1425
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
1426
|
-
in the Software without restriction, including without limitation the rights
|
|
1427
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1428
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
1429
|
-
furnished to do so, subject to the following conditions:
|
|
1430
|
-
|
|
1431
|
-
The above copyright notice and this permission notice shall be included in all
|
|
1432
|
-
copies or substantial portions of the Software.
|
|
1433
|
-
|
|
1434
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1435
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1436
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1437
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1438
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1439
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1440
|
-
SOFTWARE.
|
|
1441
|
-
|
|
1442
|
-
```
|
|
1443
|
-
|
|
1444
1439
|
### semver
|
|
1445
1440
|
|
|
1446
1441
|
This product includes source derived from [semver](https://github.com/npm/node-semver) ([v7.6.0](https://github.com/npm/node-semver/tree/v7.6.0)), distributed under the [ISC License](https://github.com/npm/node-semver/blob/v7.6.0/LICENSE):
|
|
@@ -2431,7 +2426,7 @@ THE SOFTWARE.
|
|
|
2431
2426
|
|
|
2432
2427
|
### eslint-plugin-jsdoc
|
|
2433
2428
|
|
|
2434
|
-
This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([
|
|
2429
|
+
This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v48.0.6](https://github.com/gajus/eslint-plugin-jsdoc/tree/v48.0.6)), distributed under the [BSD-3-Clause License](https://github.com/gajus/eslint-plugin-jsdoc/blob/v48.0.6/LICENSE):
|
|
2435
2430
|
|
|
2436
2431
|
```
|
|
2437
2432
|
Copyright (c) 2018, Gajus Kuizinas (http://gajus.com/)
|
package/api.js
CHANGED
|
@@ -23,7 +23,7 @@ const {
|
|
|
23
23
|
assignCLMSymbol,
|
|
24
24
|
addCLMAttributes: maybeAddCLMAttributes
|
|
25
25
|
} = require('./lib/util/code-level-metrics')
|
|
26
|
-
const
|
|
26
|
+
const LlmFeedbackMessage = require('./lib/llm-events/feedback-message')
|
|
27
27
|
|
|
28
28
|
const ATTR_DEST = require('./lib/config/attribute-filter').DESTINATIONS
|
|
29
29
|
const MODULE_TYPE = require('./lib/shim/constants').MODULE_TYPE
|
|
@@ -617,7 +617,7 @@ API.prototype.addIgnoringRule = function addIgnoringRule(pattern) {
|
|
|
617
617
|
* @private
|
|
618
618
|
* @see RUM_ISSUES
|
|
619
619
|
* @param {number} errorCode Error code from `RUM_ISSUES`.
|
|
620
|
-
* @param {boolean} [quiet
|
|
620
|
+
* @param {boolean} [quiet] Be quiet about this failure.
|
|
621
621
|
* @returns {string} HTML comment for debugging purposes with specific error code
|
|
622
622
|
*/
|
|
623
623
|
function _gracefail(errorCode, quiet) {
|
|
@@ -1541,52 +1541,20 @@ API.prototype.getTraceMetadata = function getTraceMetadata() {
|
|
|
1541
1541
|
return metadata
|
|
1542
1542
|
}
|
|
1543
1543
|
|
|
1544
|
-
/**
|
|
1545
|
-
* Get a set of tracked identifiers
|
|
1546
|
-
*
|
|
1547
|
-
* @param {object} params Input parameters.
|
|
1548
|
-
* @param {string} params.responseId The LLM generated identifier for the
|
|
1549
|
-
* response.
|
|
1550
|
-
* @returns {LlmTrackedIds|undefined} The tracked identifiers.
|
|
1551
|
-
*/
|
|
1552
|
-
API.prototype.getLlmMessageIds = function getLlmMessageIds({ responseId } = {}) {
|
|
1553
|
-
this.agent.metrics
|
|
1554
|
-
.getOrCreateMetric(`${NAMES.SUPPORTABILITY.API}/getLlmMessageIds`)
|
|
1555
|
-
.incrementCallCount()
|
|
1556
|
-
|
|
1557
|
-
if (this.agent.config?.ai_monitoring?.enabled !== true) {
|
|
1558
|
-
logger.warn('getLlmMessageIds invoked but ai_monitoring is disabled.')
|
|
1559
|
-
return
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
const tx = this.agent.tracer.getTransaction()
|
|
1563
|
-
if (!tx) {
|
|
1564
|
-
logger.warn('getLlmMessageIds must be called within the scope of a transaction.')
|
|
1565
|
-
return
|
|
1566
|
-
}
|
|
1567
|
-
return tx.llm.responses.get(responseId)
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1570
1544
|
/**
|
|
1571
1545
|
* Record a LLM feedback event which can be viewed in New Relic API Monitoring.
|
|
1572
1546
|
*
|
|
1573
1547
|
* @param {object} params Input parameters.
|
|
1574
|
-
* @param {string}
|
|
1575
|
-
*
|
|
1576
|
-
* @param {string} [params.requestId=""] If available, the request identifier
|
|
1577
|
-
* from the remote service.
|
|
1578
|
-
* @param {string} params.messageId Identifier for the message being rated.
|
|
1579
|
-
* Obtained from {@link getLlmMessageIds}.
|
|
1548
|
+
* @param {string} params.traceId Identifier for the feedback event.
|
|
1549
|
+
* Obtained from {@link getTraceMetadata}.
|
|
1580
1550
|
* @param {string} params.category A tag for the event.
|
|
1581
1551
|
* @param {string} params.rating A indicator of how useful the message was.
|
|
1582
|
-
* @param {string} [params.message
|
|
1583
|
-
* @param {object} [params.metadata
|
|
1552
|
+
* @param {string} [params.message] The message that triggered the event.
|
|
1553
|
+
* @param {object} [params.metadata] Additional key-value pairs to associate
|
|
1584
1554
|
* with the recorded event.
|
|
1585
1555
|
*/
|
|
1586
1556
|
API.prototype.recordLlmFeedbackEvent = function recordLlmFeedbackEvent({
|
|
1587
|
-
|
|
1588
|
-
requestId = '',
|
|
1589
|
-
messageId,
|
|
1557
|
+
traceId,
|
|
1590
1558
|
category,
|
|
1591
1559
|
rating,
|
|
1592
1560
|
message = '',
|
|
@@ -1596,6 +1564,13 @@ API.prototype.recordLlmFeedbackEvent = function recordLlmFeedbackEvent({
|
|
|
1596
1564
|
.getOrCreateMetric(`${NAMES.SUPPORTABILITY.API}/recordLlmFeedbackEvent`)
|
|
1597
1565
|
.incrementCallCount()
|
|
1598
1566
|
|
|
1567
|
+
if (!traceId) {
|
|
1568
|
+
logger.warn(
|
|
1569
|
+
'A feedback event will not be recorded. recordLlmFeedbackEvent must be called with a traceId.'
|
|
1570
|
+
)
|
|
1571
|
+
return
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1599
1574
|
if (this.agent.config?.ai_monitoring?.enabled !== true) {
|
|
1600
1575
|
logger.warn('recordLlmFeedbackEvent invoked but ai_monitoring is disabled.')
|
|
1601
1576
|
return
|
|
@@ -1604,15 +1579,13 @@ API.prototype.recordLlmFeedbackEvent = function recordLlmFeedbackEvent({
|
|
|
1604
1579
|
const tx = this.agent.tracer.getTransaction()
|
|
1605
1580
|
if (!tx) {
|
|
1606
1581
|
logger.warn(
|
|
1607
|
-
'
|
|
1582
|
+
'A feedback events will not be recorded. recordLlmFeedbackEvent must be called within the scope of a transaction.'
|
|
1608
1583
|
)
|
|
1609
1584
|
return
|
|
1610
1585
|
}
|
|
1611
1586
|
|
|
1612
1587
|
const feedback = new LlmFeedbackMessage({
|
|
1613
|
-
|
|
1614
|
-
requestId,
|
|
1615
|
-
messageId,
|
|
1588
|
+
traceId,
|
|
1616
1589
|
category,
|
|
1617
1590
|
rating,
|
|
1618
1591
|
message
|
|
@@ -1625,12 +1598,12 @@ API.prototype.recordLlmFeedbackEvent = function recordLlmFeedbackEvent({
|
|
|
1625
1598
|
*
|
|
1626
1599
|
* @param {object} [options]
|
|
1627
1600
|
* Object with shut down options.
|
|
1628
|
-
* @param {boolean} [options.collectPendingData
|
|
1601
|
+
* @param {boolean} [options.collectPendingData]
|
|
1629
1602
|
* If true, the agent will send any pending data to the collector before
|
|
1630
1603
|
* shutting down.
|
|
1631
|
-
* @param {number} [options.timeout
|
|
1604
|
+
* @param {number} [options.timeout]
|
|
1632
1605
|
* Time in milliseconds to wait before shutting down.
|
|
1633
|
-
* @param {boolean} [options.waitForIdle
|
|
1606
|
+
* @param {boolean} [options.waitForIdle]
|
|
1634
1607
|
* If true, the agent will not shut down until there are no active transactions.
|
|
1635
1608
|
* @param {Function} [cb]
|
|
1636
1609
|
* Callback function that runs when agent stops.
|
|
@@ -1675,12 +1648,12 @@ function _logErrorCallback(error, phase) {
|
|
|
1675
1648
|
* @private
|
|
1676
1649
|
* @param {object} api instantiation of this file
|
|
1677
1650
|
* @param {object} options shutdown options object
|
|
1678
|
-
* @param {boolean} [options.collectPendingData
|
|
1651
|
+
* @param {boolean} [options.collectPendingData]
|
|
1679
1652
|
* If true, the agent will send any pending data to the collector before
|
|
1680
1653
|
* shutting down.
|
|
1681
|
-
* @param {number} [options.timeout
|
|
1654
|
+
* @param {number} [options.timeout]
|
|
1682
1655
|
* Time in milliseconds to wait before shutting down.
|
|
1683
|
-
* @param {boolean} [options.waitForIdle
|
|
1656
|
+
* @param {boolean} [options.waitForIdle]
|
|
1684
1657
|
* If true, the agent will not shut down until there are no active transactions.
|
|
1685
1658
|
* @param {Function} callback callback function to execute after shutdown process is complete (successful or not)
|
|
1686
1659
|
*/
|