newrelic 13.0.0 → 13.2.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 (68) hide show
  1. package/NEWS.md +92 -0
  2. package/README.md +2 -4
  3. package/THIRD_PARTY_NOTICES.md +429 -9
  4. package/esm-loader.mjs +9 -1
  5. package/index.js +38 -3
  6. package/lib/agent.js +8 -2
  7. package/lib/config/build-instrumentation-config.js +3 -0
  8. package/lib/config/default.js +1397 -1383
  9. package/lib/config/index.js +15 -19
  10. package/lib/context-manager/context.js +13 -4
  11. package/lib/harvester.js +11 -13
  12. package/lib/instrumentation/@google/genai.js +8 -3
  13. package/lib/instrumentation/@hapi/hapi.js +4 -6
  14. package/lib/instrumentation/@nestjs/core.js +12 -14
  15. package/lib/instrumentation/aws-sdk/v3/bedrock.js +2 -2
  16. package/lib/instrumentation/core/http-outbound.js +11 -26
  17. package/lib/instrumentation/kafkajs/producer.js +13 -19
  18. package/lib/instrumentation/openai.js +2 -2
  19. package/lib/instrumentation/undici.js +48 -40
  20. package/lib/instrumentations.js +14 -5
  21. package/lib/llm-events/aws-bedrock/utils.js +1 -1
  22. package/lib/metrics/names.js +8 -0
  23. package/lib/metrics/normalizer.js +1 -3
  24. package/lib/otel/context.js +18 -14
  25. package/lib/otel/logs/bootstrap-logs.js +84 -0
  26. package/lib/otel/logs/no-op-exporter.js +25 -0
  27. package/lib/otel/logs/normalize-timestamp.js +59 -0
  28. package/lib/otel/logs/proxying-provider.js +46 -0
  29. package/lib/otel/logs/severity-to-string.js +56 -0
  30. package/lib/otel/metrics/bootstrap-metrics.js +1 -1
  31. package/lib/otel/setup.js +21 -8
  32. package/lib/patch-module.js +70 -0
  33. package/lib/serverless/aws-lambda.js +1 -3
  34. package/lib/shim/webframework-shim/middleware-mounter.js +1 -3
  35. package/lib/shimmer.js +56 -8
  36. package/lib/subscriber-configs.js +17 -0
  37. package/lib/subscribers/application-logs.js +55 -0
  38. package/lib/subscribers/base.js +177 -0
  39. package/lib/subscribers/create-config.js +27 -0
  40. package/lib/subscribers/db-operation.js +21 -0
  41. package/lib/subscribers/db-query.js +54 -0
  42. package/lib/subscribers/db.js +57 -0
  43. package/lib/subscribers/elasticsearch/config.js +49 -0
  44. package/lib/subscribers/elasticsearch/elasticsearch.js +42 -0
  45. package/lib/subscribers/elasticsearch/opensearch.js +15 -0
  46. package/lib/subscribers/elasticsearch/transport.js +14 -0
  47. package/lib/subscribers/ioredis/config.js +37 -0
  48. package/lib/subscribers/ioredis/index.js +48 -0
  49. package/lib/subscribers/mcp-sdk/client-prompt.js +23 -0
  50. package/lib/subscribers/mcp-sdk/client-resource.js +24 -0
  51. package/lib/subscribers/mcp-sdk/client-tool.js +23 -0
  52. package/lib/subscribers/mcp-sdk/client.js +29 -0
  53. package/lib/subscribers/mcp-sdk/config.js +104 -0
  54. package/lib/subscribers/pino/config.js +20 -0
  55. package/lib/subscribers/pino/index.js +102 -0
  56. package/lib/transaction/index.js +4 -1
  57. package/lib/transaction/trace/aggregator.js +7 -9
  58. package/lib/util/camel-case.js +1 -3
  59. package/lib/util/get-package-version.js +34 -0
  60. package/lib/util/urltils.js +19 -13
  61. package/lib/w3c/tracestate.js +3 -3
  62. package/newrelic.js +10 -0
  63. package/package.json +9 -5
  64. package/lib/instrumentation/@elastic/elasticsearch.js +0 -62
  65. package/lib/instrumentation/@opensearch-project/opensearch.js +0 -66
  66. package/lib/instrumentation/ioredis.js +0 -50
  67. package/lib/instrumentation/pino/nr-hooks.js +0 -19
  68. package/lib/instrumentation/pino/pino.js +0 -168
@@ -17,10 +17,12 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
17
17
  * [@grpc/grpc-js](#grpcgrpc-js)
18
18
  * [@grpc/proto-loader](#grpcproto-loader)
19
19
  * [@newrelic/security-agent](#newrelicsecurity-agent)
20
+ * [@opentelemetry/api-logs](#opentelemetryapi-logs)
20
21
  * [@opentelemetry/api](#opentelemetryapi)
21
22
  * [@opentelemetry/core](#opentelemetrycore)
22
23
  * [@opentelemetry/exporter-metrics-otlp-proto](#opentelemetryexporter-metrics-otlp-proto)
23
24
  * [@opentelemetry/resources](#opentelemetryresources)
25
+ * [@opentelemetry/sdk-logs](#opentelemetrysdk-logs)
24
26
  * [@opentelemetry/sdk-metrics](#opentelemetrysdk-metrics)
25
27
  * [@opentelemetry/sdk-trace-base](#opentelemetrysdk-trace-base)
26
28
  * [@tyriar/fibonacci-heap](#tyriarfibonacci-heap)
@@ -95,7 +97,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
95
97
 
96
98
  ### @grpc/grpc-js
97
99
 
98
- This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.13.3](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.13.3)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.13.3/LICENSE):
100
+ This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.13.4](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.13.4)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.13.4/LICENSE):
99
101
 
100
102
  ```
101
103
  Apache License
@@ -555,6 +557,215 @@ This license terminates when the Software stops being provided by New Relic or w
555
557
  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.
556
558
 
557
559
 
560
+ ```
561
+
562
+ ### @opentelemetry/api-logs
563
+
564
+ This product includes source derived from [@opentelemetry/api-logs](https://github.com/open-telemetry/opentelemetry-js) ([v0.203.0](https://github.com/open-telemetry/opentelemetry-js/tree/v0.203.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v0.203.0/LICENSE):
565
+
566
+ ```
567
+ Apache License
568
+ Version 2.0, January 2004
569
+ http://www.apache.org/licenses/
570
+
571
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
572
+
573
+ 1. Definitions.
574
+
575
+ "License" shall mean the terms and conditions for use, reproduction,
576
+ and distribution as defined by Sections 1 through 9 of this document.
577
+
578
+ "Licensor" shall mean the copyright owner or entity authorized by
579
+ the copyright owner that is granting the License.
580
+
581
+ "Legal Entity" shall mean the union of the acting entity and all
582
+ other entities that control, are controlled by, or are under common
583
+ control with that entity. For the purposes of this definition,
584
+ "control" means (i) the power, direct or indirect, to cause the
585
+ direction or management of such entity, whether by contract or
586
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
587
+ outstanding shares, or (iii) beneficial ownership of such entity.
588
+
589
+ "You" (or "Your") shall mean an individual or Legal Entity
590
+ exercising permissions granted by this License.
591
+
592
+ "Source" form shall mean the preferred form for making modifications,
593
+ including but not limited to software source code, documentation
594
+ source, and configuration files.
595
+
596
+ "Object" form shall mean any form resulting from mechanical
597
+ transformation or translation of a Source form, including but
598
+ not limited to compiled object code, generated documentation,
599
+ and conversions to other media types.
600
+
601
+ "Work" shall mean the work of authorship, whether in Source or
602
+ Object form, made available under the License, as indicated by a
603
+ copyright notice that is included in or attached to the work
604
+ (an example is provided in the Appendix below).
605
+
606
+ "Derivative Works" shall mean any work, whether in Source or Object
607
+ form, that is based on (or derived from) the Work and for which the
608
+ editorial revisions, annotations, elaborations, or other modifications
609
+ represent, as a whole, an original work of authorship. For the purposes
610
+ of this License, Derivative Works shall not include works that remain
611
+ separable from, or merely link (or bind by name) to the interfaces of,
612
+ the Work and Derivative Works thereof.
613
+
614
+ "Contribution" shall mean any work of authorship, including
615
+ the original version of the Work and any modifications or additions
616
+ to that Work or Derivative Works thereof, that is intentionally
617
+ submitted to Licensor for inclusion in the Work by the copyright owner
618
+ or by an individual or Legal Entity authorized to submit on behalf of
619
+ the copyright owner. For the purposes of this definition, "submitted"
620
+ means any form of electronic, verbal, or written communication sent
621
+ to the Licensor or its representatives, including but not limited to
622
+ communication on electronic mailing lists, source code control systems,
623
+ and issue tracking systems that are managed by, or on behalf of, the
624
+ Licensor for the purpose of discussing and improving the Work, but
625
+ excluding communication that is conspicuously marked or otherwise
626
+ designated in writing by the copyright owner as "Not a Contribution."
627
+
628
+ "Contributor" shall mean Licensor and any individual or Legal Entity
629
+ on behalf of whom a Contribution has been received by Licensor and
630
+ subsequently incorporated within the Work.
631
+
632
+ 2. Grant of Copyright License. Subject to the terms and conditions of
633
+ this License, each Contributor hereby grants to You a perpetual,
634
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
635
+ copyright license to reproduce, prepare Derivative Works of,
636
+ publicly display, publicly perform, sublicense, and distribute the
637
+ Work and such Derivative Works in Source or Object form.
638
+
639
+ 3. Grant of Patent License. Subject to the terms and conditions of
640
+ this License, each Contributor hereby grants to You a perpetual,
641
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
642
+ (except as stated in this section) patent license to make, have made,
643
+ use, offer to sell, sell, import, and otherwise transfer the Work,
644
+ where such license applies only to those patent claims licensable
645
+ by such Contributor that are necessarily infringed by their
646
+ Contribution(s) alone or by combination of their Contribution(s)
647
+ with the Work to which such Contribution(s) was submitted. If You
648
+ institute patent litigation against any entity (including a
649
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
650
+ or a Contribution incorporated within the Work constitutes direct
651
+ or contributory patent infringement, then any patent licenses
652
+ granted to You under this License for that Work shall terminate
653
+ as of the date such litigation is filed.
654
+
655
+ 4. Redistribution. You may reproduce and distribute copies of the
656
+ Work or Derivative Works thereof in any medium, with or without
657
+ modifications, and in Source or Object form, provided that You
658
+ meet the following conditions:
659
+
660
+ (a) You must give any other recipients of the Work or
661
+ Derivative Works a copy of this License; and
662
+
663
+ (b) You must cause any modified files to carry prominent notices
664
+ stating that You changed the files; and
665
+
666
+ (c) You must retain, in the Source form of any Derivative Works
667
+ that You distribute, all copyright, patent, trademark, and
668
+ attribution notices from the Source form of the Work,
669
+ excluding those notices that do not pertain to any part of
670
+ the Derivative Works; and
671
+
672
+ (d) If the Work includes a "NOTICE" text file as part of its
673
+ distribution, then any Derivative Works that You distribute must
674
+ include a readable copy of the attribution notices contained
675
+ within such NOTICE file, excluding those notices that do not
676
+ pertain to any part of the Derivative Works, in at least one
677
+ of the following places: within a NOTICE text file distributed
678
+ as part of the Derivative Works; within the Source form or
679
+ documentation, if provided along with the Derivative Works; or,
680
+ within a display generated by the Derivative Works, if and
681
+ wherever such third-party notices normally appear. The contents
682
+ of the NOTICE file are for informational purposes only and
683
+ do not modify the License. You may add Your own attribution
684
+ notices within Derivative Works that You distribute, alongside
685
+ or as an addendum to the NOTICE text from the Work, provided
686
+ that such additional attribution notices cannot be construed
687
+ as modifying the License.
688
+
689
+ You may add Your own copyright statement to Your modifications and
690
+ may provide additional or different license terms and conditions
691
+ for use, reproduction, or distribution of Your modifications, or
692
+ for any such Derivative Works as a whole, provided Your use,
693
+ reproduction, and distribution of the Work otherwise complies with
694
+ the conditions stated in this License.
695
+
696
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
697
+ any Contribution intentionally submitted for inclusion in the Work
698
+ by You to the Licensor shall be under the terms and conditions of
699
+ this License, without any additional terms or conditions.
700
+ Notwithstanding the above, nothing herein shall supersede or modify
701
+ the terms of any separate license agreement you may have executed
702
+ with Licensor regarding such Contributions.
703
+
704
+ 6. Trademarks. This License does not grant permission to use the trade
705
+ names, trademarks, service marks, or product names of the Licensor,
706
+ except as required for reasonable and customary use in describing the
707
+ origin of the Work and reproducing the content of the NOTICE file.
708
+
709
+ 7. Disclaimer of Warranty. Unless required by applicable law or
710
+ agreed to in writing, Licensor provides the Work (and each
711
+ Contributor provides its Contributions) on an "AS IS" BASIS,
712
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
713
+ implied, including, without limitation, any warranties or conditions
714
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
715
+ PARTICULAR PURPOSE. You are solely responsible for determining the
716
+ appropriateness of using or redistributing the Work and assume any
717
+ risks associated with Your exercise of permissions under this License.
718
+
719
+ 8. Limitation of Liability. In no event and under no legal theory,
720
+ whether in tort (including negligence), contract, or otherwise,
721
+ unless required by applicable law (such as deliberate and grossly
722
+ negligent acts) or agreed to in writing, shall any Contributor be
723
+ liable to You for damages, including any direct, indirect, special,
724
+ incidental, or consequential damages of any character arising as a
725
+ result of this License or out of the use or inability to use the
726
+ Work (including but not limited to damages for loss of goodwill,
727
+ work stoppage, computer failure or malfunction, or any and all
728
+ other commercial damages or losses), even if such Contributor
729
+ has been advised of the possibility of such damages.
730
+
731
+ 9. Accepting Warranty or Additional Liability. While redistributing
732
+ the Work or Derivative Works thereof, You may choose to offer,
733
+ and charge a fee for, acceptance of support, warranty, indemnity,
734
+ or other liability obligations and/or rights consistent with this
735
+ License. However, in accepting such obligations, You may act only
736
+ on Your own behalf and on Your sole responsibility, not on behalf
737
+ of any other Contributor, and only if You agree to indemnify,
738
+ defend, and hold each Contributor harmless for any liability
739
+ incurred by, or claims asserted against, such Contributor by reason
740
+ of your accepting any such warranty or additional liability.
741
+
742
+ END OF TERMS AND CONDITIONS
743
+
744
+ APPENDIX: How to apply the Apache License to your work.
745
+
746
+ To apply the Apache License to your work, attach the following
747
+ boilerplate notice, with the fields enclosed by brackets "[]"
748
+ replaced with your own identifying information. (Don't include
749
+ the brackets!) The text should be enclosed in the appropriate
750
+ comment syntax for the file format. We also recommend that a
751
+ file or class name and description of purpose be included on the
752
+ same "printed page" as the copyright notice for easier
753
+ identification within third-party archives.
754
+
755
+ Copyright [yyyy] [name of copyright owner]
756
+
757
+ Licensed under the Apache License, Version 2.0 (the "License");
758
+ you may not use this file except in compliance with the License.
759
+ You may obtain a copy of the License at
760
+
761
+ http://www.apache.org/licenses/LICENSE-2.0
762
+
763
+ Unless required by applicable law or agreed to in writing, software
764
+ distributed under the License is distributed on an "AS IS" BASIS,
765
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
766
+ See the License for the specific language governing permissions and
767
+ limitations under the License.
768
+
558
769
  ```
559
770
 
560
771
  ### @opentelemetry/api
@@ -1393,6 +1604,215 @@ This product includes source derived from [@opentelemetry/resources](https://git
1393
1604
 
1394
1605
  ```
1395
1606
 
1607
+ ### @opentelemetry/sdk-logs
1608
+
1609
+ This product includes source derived from [@opentelemetry/sdk-logs](https://github.com/open-telemetry/opentelemetry-js) ([v0.203.0](https://github.com/open-telemetry/opentelemetry-js/tree/v0.203.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v0.203.0/LICENSE):
1610
+
1611
+ ```
1612
+ Apache License
1613
+ Version 2.0, January 2004
1614
+ http://www.apache.org/licenses/
1615
+
1616
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1617
+
1618
+ 1. Definitions.
1619
+
1620
+ "License" shall mean the terms and conditions for use, reproduction,
1621
+ and distribution as defined by Sections 1 through 9 of this document.
1622
+
1623
+ "Licensor" shall mean the copyright owner or entity authorized by
1624
+ the copyright owner that is granting the License.
1625
+
1626
+ "Legal Entity" shall mean the union of the acting entity and all
1627
+ other entities that control, are controlled by, or are under common
1628
+ control with that entity. For the purposes of this definition,
1629
+ "control" means (i) the power, direct or indirect, to cause the
1630
+ direction or management of such entity, whether by contract or
1631
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
1632
+ outstanding shares, or (iii) beneficial ownership of such entity.
1633
+
1634
+ "You" (or "Your") shall mean an individual or Legal Entity
1635
+ exercising permissions granted by this License.
1636
+
1637
+ "Source" form shall mean the preferred form for making modifications,
1638
+ including but not limited to software source code, documentation
1639
+ source, and configuration files.
1640
+
1641
+ "Object" form shall mean any form resulting from mechanical
1642
+ transformation or translation of a Source form, including but
1643
+ not limited to compiled object code, generated documentation,
1644
+ and conversions to other media types.
1645
+
1646
+ "Work" shall mean the work of authorship, whether in Source or
1647
+ Object form, made available under the License, as indicated by a
1648
+ copyright notice that is included in or attached to the work
1649
+ (an example is provided in the Appendix below).
1650
+
1651
+ "Derivative Works" shall mean any work, whether in Source or Object
1652
+ form, that is based on (or derived from) the Work and for which the
1653
+ editorial revisions, annotations, elaborations, or other modifications
1654
+ represent, as a whole, an original work of authorship. For the purposes
1655
+ of this License, Derivative Works shall not include works that remain
1656
+ separable from, or merely link (or bind by name) to the interfaces of,
1657
+ the Work and Derivative Works thereof.
1658
+
1659
+ "Contribution" shall mean any work of authorship, including
1660
+ the original version of the Work and any modifications or additions
1661
+ to that Work or Derivative Works thereof, that is intentionally
1662
+ submitted to Licensor for inclusion in the Work by the copyright owner
1663
+ or by an individual or Legal Entity authorized to submit on behalf of
1664
+ the copyright owner. For the purposes of this definition, "submitted"
1665
+ means any form of electronic, verbal, or written communication sent
1666
+ to the Licensor or its representatives, including but not limited to
1667
+ communication on electronic mailing lists, source code control systems,
1668
+ and issue tracking systems that are managed by, or on behalf of, the
1669
+ Licensor for the purpose of discussing and improving the Work, but
1670
+ excluding communication that is conspicuously marked or otherwise
1671
+ designated in writing by the copyright owner as "Not a Contribution."
1672
+
1673
+ "Contributor" shall mean Licensor and any individual or Legal Entity
1674
+ on behalf of whom a Contribution has been received by Licensor and
1675
+ subsequently incorporated within the Work.
1676
+
1677
+ 2. Grant of Copyright License. Subject to the terms and conditions of
1678
+ this License, each Contributor hereby grants to You a perpetual,
1679
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1680
+ copyright license to reproduce, prepare Derivative Works of,
1681
+ publicly display, publicly perform, sublicense, and distribute the
1682
+ Work and such Derivative Works in Source or Object form.
1683
+
1684
+ 3. Grant of Patent License. Subject to the terms and conditions of
1685
+ this License, each Contributor hereby grants to You a perpetual,
1686
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1687
+ (except as stated in this section) patent license to make, have made,
1688
+ use, offer to sell, sell, import, and otherwise transfer the Work,
1689
+ where such license applies only to those patent claims licensable
1690
+ by such Contributor that are necessarily infringed by their
1691
+ Contribution(s) alone or by combination of their Contribution(s)
1692
+ with the Work to which such Contribution(s) was submitted. If You
1693
+ institute patent litigation against any entity (including a
1694
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
1695
+ or a Contribution incorporated within the Work constitutes direct
1696
+ or contributory patent infringement, then any patent licenses
1697
+ granted to You under this License for that Work shall terminate
1698
+ as of the date such litigation is filed.
1699
+
1700
+ 4. Redistribution. You may reproduce and distribute copies of the
1701
+ Work or Derivative Works thereof in any medium, with or without
1702
+ modifications, and in Source or Object form, provided that You
1703
+ meet the following conditions:
1704
+
1705
+ (a) You must give any other recipients of the Work or
1706
+ Derivative Works a copy of this License; and
1707
+
1708
+ (b) You must cause any modified files to carry prominent notices
1709
+ stating that You changed the files; and
1710
+
1711
+ (c) You must retain, in the Source form of any Derivative Works
1712
+ that You distribute, all copyright, patent, trademark, and
1713
+ attribution notices from the Source form of the Work,
1714
+ excluding those notices that do not pertain to any part of
1715
+ the Derivative Works; and
1716
+
1717
+ (d) If the Work includes a "NOTICE" text file as part of its
1718
+ distribution, then any Derivative Works that You distribute must
1719
+ include a readable copy of the attribution notices contained
1720
+ within such NOTICE file, excluding those notices that do not
1721
+ pertain to any part of the Derivative Works, in at least one
1722
+ of the following places: within a NOTICE text file distributed
1723
+ as part of the Derivative Works; within the Source form or
1724
+ documentation, if provided along with the Derivative Works; or,
1725
+ within a display generated by the Derivative Works, if and
1726
+ wherever such third-party notices normally appear. The contents
1727
+ of the NOTICE file are for informational purposes only and
1728
+ do not modify the License. You may add Your own attribution
1729
+ notices within Derivative Works that You distribute, alongside
1730
+ or as an addendum to the NOTICE text from the Work, provided
1731
+ that such additional attribution notices cannot be construed
1732
+ as modifying the License.
1733
+
1734
+ You may add Your own copyright statement to Your modifications and
1735
+ may provide additional or different license terms and conditions
1736
+ for use, reproduction, or distribution of Your modifications, or
1737
+ for any such Derivative Works as a whole, provided Your use,
1738
+ reproduction, and distribution of the Work otherwise complies with
1739
+ the conditions stated in this License.
1740
+
1741
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
1742
+ any Contribution intentionally submitted for inclusion in the Work
1743
+ by You to the Licensor shall be under the terms and conditions of
1744
+ this License, without any additional terms or conditions.
1745
+ Notwithstanding the above, nothing herein shall supersede or modify
1746
+ the terms of any separate license agreement you may have executed
1747
+ with Licensor regarding such Contributions.
1748
+
1749
+ 6. Trademarks. This License does not grant permission to use the trade
1750
+ names, trademarks, service marks, or product names of the Licensor,
1751
+ except as required for reasonable and customary use in describing the
1752
+ origin of the Work and reproducing the content of the NOTICE file.
1753
+
1754
+ 7. Disclaimer of Warranty. Unless required by applicable law or
1755
+ agreed to in writing, Licensor provides the Work (and each
1756
+ Contributor provides its Contributions) on an "AS IS" BASIS,
1757
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1758
+ implied, including, without limitation, any warranties or conditions
1759
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1760
+ PARTICULAR PURPOSE. You are solely responsible for determining the
1761
+ appropriateness of using or redistributing the Work and assume any
1762
+ risks associated with Your exercise of permissions under this License.
1763
+
1764
+ 8. Limitation of Liability. In no event and under no legal theory,
1765
+ whether in tort (including negligence), contract, or otherwise,
1766
+ unless required by applicable law (such as deliberate and grossly
1767
+ negligent acts) or agreed to in writing, shall any Contributor be
1768
+ liable to You for damages, including any direct, indirect, special,
1769
+ incidental, or consequential damages of any character arising as a
1770
+ result of this License or out of the use or inability to use the
1771
+ Work (including but not limited to damages for loss of goodwill,
1772
+ work stoppage, computer failure or malfunction, or any and all
1773
+ other commercial damages or losses), even if such Contributor
1774
+ has been advised of the possibility of such damages.
1775
+
1776
+ 9. Accepting Warranty or Additional Liability. While redistributing
1777
+ the Work or Derivative Works thereof, You may choose to offer,
1778
+ and charge a fee for, acceptance of support, warranty, indemnity,
1779
+ or other liability obligations and/or rights consistent with this
1780
+ License. However, in accepting such obligations, You may act only
1781
+ on Your own behalf and on Your sole responsibility, not on behalf
1782
+ of any other Contributor, and only if You agree to indemnify,
1783
+ defend, and hold each Contributor harmless for any liability
1784
+ incurred by, or claims asserted against, such Contributor by reason
1785
+ of your accepting any such warranty or additional liability.
1786
+
1787
+ END OF TERMS AND CONDITIONS
1788
+
1789
+ APPENDIX: How to apply the Apache License to your work.
1790
+
1791
+ To apply the Apache License to your work, attach the following
1792
+ boilerplate notice, with the fields enclosed by brackets "[]"
1793
+ replaced with your own identifying information. (Don't include
1794
+ the brackets!) The text should be enclosed in the appropriate
1795
+ comment syntax for the file format. We also recommend that a
1796
+ file or class name and description of purpose be included on the
1797
+ same "printed page" as the copyright notice for easier
1798
+ identification within third-party archives.
1799
+
1800
+ Copyright [yyyy] [name of copyright owner]
1801
+
1802
+ Licensed under the Apache License, Version 2.0 (the "License");
1803
+ you may not use this file except in compliance with the License.
1804
+ You may obtain a copy of the License at
1805
+
1806
+ http://www.apache.org/licenses/LICENSE-2.0
1807
+
1808
+ Unless required by applicable law or agreed to in writing, software
1809
+ distributed under the License is distributed on an "AS IS" BASIS,
1810
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1811
+ See the License for the specific language governing permissions and
1812
+ limitations under the License.
1813
+
1814
+ ```
1815
+
1396
1816
  ### @opentelemetry/sdk-metrics
1397
1817
 
1398
1818
  This product includes source derived from [@opentelemetry/sdk-metrics](https://github.com/open-telemetry/opentelemetry-js) ([v2.0.1](https://github.com/open-telemetry/opentelemetry-js/tree/v2.0.1)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.0.1/LICENSE):
@@ -1902,7 +2322,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1902
2322
 
1903
2323
  ### import-in-the-middle
1904
2324
 
1905
- This product includes source derived from [import-in-the-middle](https://github.com/nodejs/import-in-the-middle) ([v1.13.2](https://github.com/nodejs/import-in-the-middle/tree/v1.13.2)), distributed under the [Apache-2.0 License](https://github.com/nodejs/import-in-the-middle/blob/v1.13.2/LICENSE):
2325
+ This product includes source derived from [import-in-the-middle](https://github.com/nodejs/import-in-the-middle) ([v1.14.0](https://github.com/nodejs/import-in-the-middle/tree/v1.14.0)), distributed under the [Apache-2.0 License](https://github.com/nodejs/import-in-the-middle/blob/v1.14.0/LICENSE):
1906
2326
 
1907
2327
  ```
1908
2328
  Apache License
@@ -2333,7 +2753,7 @@ SOFTWARE.
2333
2753
 
2334
2754
  ### @aws-sdk/client-s3
2335
2755
 
2336
- This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.808.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.808.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.808.0/LICENSE):
2756
+ This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.821.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.821.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.821.0/LICENSE):
2337
2757
 
2338
2758
  ```
2339
2759
  Apache License
@@ -2542,7 +2962,7 @@ This product includes source derived from [@aws-sdk/client-s3](https://github.co
2542
2962
 
2543
2963
  ### @aws-sdk/s3-request-presigner
2544
2964
 
2545
- This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.808.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.808.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.808.0/LICENSE):
2965
+ This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.821.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.821.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.821.0/LICENSE):
2546
2966
 
2547
2967
  ```
2548
2968
  Apache License
@@ -2809,7 +3229,7 @@ SOFTWARE.
2809
3229
 
2810
3230
  ### @newrelic/eslint-config
2811
3231
 
2812
- This product includes source derived from [@newrelic/eslint-config](https://github.com/newrelic/eslint-config-newrelic) ([v0.5.0](https://github.com/newrelic/eslint-config-newrelic/tree/v0.5.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/eslint-config-newrelic/blob/v0.5.0/LICENSE):
3232
+ 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):
2813
3233
 
2814
3234
  ```
2815
3235
  Apache License
@@ -3226,7 +3646,7 @@ This product includes source derived from [@newrelic/newrelic-oss-cli](https://g
3226
3646
 
3227
3647
  ### @newrelic/test-utilities
3228
3648
 
3229
- This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v9.1.0](https://github.com/newrelic/node-test-utilities/tree/v9.1.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v9.1.0/LICENSE):
3649
+ This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v10.0.0](https://github.com/newrelic/node-test-utilities/tree/v10.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v10.0.0/LICENSE):
3230
3650
 
3231
3651
  ```
3232
3652
  Apache License
@@ -4370,7 +4790,7 @@ SOFTWARE.
4370
4790
 
4371
4791
  ### eslint-plugin-jsdoc
4372
4792
 
4373
- This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v50.6.14](https://github.com/gajus/eslint-plugin-jsdoc/tree/v50.6.14)), distributed under the [BSD-3-Clause License](https://github.com/gajus/eslint-plugin-jsdoc/blob/v50.6.14/LICENSE):
4793
+ This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v50.7.1](https://github.com/gajus/eslint-plugin-jsdoc/tree/v50.7.1)), distributed under the [BSD-3-Clause License](https://github.com/gajus/eslint-plugin-jsdoc/blob/v50.7.1/LICENSE):
4374
4794
 
4375
4795
  ```
4376
4796
  Copyright (c) 2018, Gajus Kuizinas (http://gajus.com/)
@@ -4402,7 +4822,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4402
4822
 
4403
4823
  ### eslint
4404
4824
 
4405
- This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v9.26.0](https://github.com/eslint/eslint/tree/v9.26.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v9.26.0/LICENSE):
4825
+ This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v9.28.0](https://github.com/eslint/eslint/tree/v9.28.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v9.28.0/LICENSE):
4406
4826
 
4407
4827
  ```
4408
4828
  Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
@@ -5263,7 +5683,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5263
5683
 
5264
5684
  ### @newrelic/native-metrics
5265
5685
 
5266
- This product includes source derived from [@newrelic/native-metrics](https://github.com/newrelic/node-native-metrics) ([v11.1.0](https://github.com/newrelic/node-native-metrics/tree/v11.1.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-native-metrics/blob/v11.1.0/LICENSE):
5686
+ This product includes source derived from [@newrelic/native-metrics](https://github.com/newrelic/node-native-metrics) ([v12.0.0](https://github.com/newrelic/node-native-metrics/tree/v12.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-native-metrics/blob/v12.0.0/LICENSE):
5267
5687
 
5268
5688
  ```
5269
5689
  Apache License
package/esm-loader.mjs CHANGED
@@ -3,4 +3,12 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
6
- export * from 'import-in-the-middle/hook.mjs'
6
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
7
+ import { register } from 'node:module'
8
+ // Exclusions must be regexes
9
+ const exclusions = [/@openai\/agents.*/]
10
+
11
+ register('./esm-rewriter.mjs', import.meta.url)
12
+ register('import-in-the-middle/hook.mjs', import.meta.url, {
13
+ data: { exclude: exclusions }
14
+ })
package/index.js CHANGED
@@ -26,6 +26,10 @@ logger.info(
26
26
  pkgJSON.version,
27
27
  process.version
28
28
  )
29
+ const path = require('node:path')
30
+ const Module = require('node:module')
31
+ const otelPackages = Object.keys(pkgJSON.dependencies).filter((d) => d.startsWith('@opentelemetry'))
32
+ const otelRequire = Module.createRequire(path.join(__dirname, __filename))
29
33
 
30
34
  if (require.cache.__NR_cache) {
31
35
  logger.warn(
@@ -40,14 +44,15 @@ if (require.cache.__NR_cache) {
40
44
  initialize()
41
45
  }
42
46
 
43
- function initApi({ agent, apiPath }) {
44
- const API = require(`./${apiPath}`)
47
+ function initApi({ agent }) {
48
+ const API = agent != null ? require('./api.js') : require('./stub_api.js')
45
49
 
46
50
  const api = new API(agent)
47
51
  require.cache.__NR_cache = module.exports = api
48
52
  return api
49
53
  }
50
54
 
55
+ // eslint-disable-next-line sonarjs/cognitive-complexity
51
56
  function initialize() {
52
57
  logger.debug('Loading agent from %s', __dirname)
53
58
  let agent = null
@@ -97,6 +102,10 @@ function initialize() {
97
102
  logger.warn(
98
103
  'New Relic for Node.js in worker_threads is not officially supported. Not starting! To bypass this, set `config.worker_threads.enabled` to true in configuration.'
99
104
  )
105
+ } else if (config.opentelemetry_bridge.enabled === true && otelBridgeAvailable() === false) {
106
+ logger.warn(
107
+ 'OpenTelemetry bridge enabled, but packages are missing. Not starting!'
108
+ )
100
109
  } else {
101
110
  if (!isMainThread && config.worker_threads.enabled) {
102
111
  logger.warn(
@@ -114,7 +123,7 @@ function initialize() {
114
123
  console.error(error.stack)
115
124
  }
116
125
 
117
- const api = agent ? initApi({ agent, apiPath: 'api' }) : initApi({ apiPath: 'stub_api' })
126
+ const api = initApi({ agent })
118
127
 
119
128
  // If we loaded an agent, record a startup time for the agent.
120
129
  // NOTE: Metrics are recorded in seconds, so divide the value by 1000.
@@ -191,6 +200,7 @@ function addStartupSupportabilities(agent) {
191
200
  recordNodeVersionMetric(agent)
192
201
  recordFeatureFlagMetrics(agent)
193
202
  recordSourceMapMetric(agent)
203
+ recordDisabledPackages(agent)
194
204
  }
195
205
 
196
206
  /**
@@ -265,3 +275,28 @@ function recordSourceMapMetric(agent) {
265
275
  agent.metrics.getOrCreateMetric(NAMES.FEATURES.SOURCE_MAPS).incrementCallCount()
266
276
  }
267
277
  }
278
+
279
+ /**
280
+ * Records supportability metrics for disabled instrumentation packages.
281
+ * @param {Agent} agent active NR agent
282
+ */
283
+ function recordDisabledPackages(agent) {
284
+ for (const [pkg, config] of Object.entries(agent.config.instrumentation)) {
285
+ if (config.enabled === false) {
286
+ agent.recordSupportability(`Nodejs/Instrumentation/${pkg}/disabled`)
287
+ }
288
+ }
289
+ }
290
+
291
+ function otelBridgeAvailable() {
292
+ for (const p of otelPackages) {
293
+ try {
294
+ otelRequire.resolve(p)
295
+ } catch (error) {
296
+ if (error.code.includes('MODULE_NOT_FOUND')) {
297
+ return false
298
+ }
299
+ }
300
+ }
301
+ return true
302
+ }
package/lib/agent.js CHANGED
@@ -112,6 +112,13 @@ const DEFAULT_HARVEST_INTERVAL_MS = 60000
112
112
  * @event Agent#otelMetricsBootstrapped
113
113
  */
114
114
 
115
+ /**
116
+ * Indicates that the OpenTelemetry logs API has been configured and is
117
+ * ready for use.
118
+ *
119
+ * @event Agent#otelLogsBootstrapped
120
+ */
121
+
115
122
  /**
116
123
  * Indicates that the agent state has entered the "started" state. That is,
117
124
  * the agent has finished bootstrapping and is collecting and sending data.
@@ -260,8 +267,7 @@ function Agent(config) {
260
267
  periodMs: config.event_harvest_config.report_period_ms,
261
268
  limit: config.event_harvest_config.harvest_limits.log_event_data,
262
269
  config,
263
- enabled: (config) =>
264
- config.application_logging.enabled && config.application_logging.forwarding.enabled
270
+ enabled: (config) => config.application_logging.enabled && config.application_logging.forwarding.enabled
265
271
  },
266
272
  this
267
273
  )
@@ -9,6 +9,9 @@ const instrumentedLibraries = require('../instrumentations')()
9
9
  const pkgNames = Object.keys(instrumentedLibraries)
10
10
  const coreLibraries = require('../core-instrumentation')
11
11
  const corePkgs = Object.keys(coreLibraries)
12
+ const subscriptions = require('../subscriber-configs')
13
+ const subscribers = Object.keys(subscriptions)
14
+ pkgNames.push(...subscribers)
12
15
  // Manually adding undici as it is registered separately in shimmer
13
16
  corePkgs.push('undici')
14
17
  // Manually adding domain as it is registered separately in shimmer