newrelic 12.19.0 → 12.20.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 CHANGED
@@ -1,3 +1,22 @@
1
+ ### v12.20.0 (2025-05-27)
2
+
3
+ #### Features
4
+
5
+ * Added support for OTEL metrics API ([#3109](https://github.com/newrelic/node-newrelic/pull/3109)) ([4a57721](https://github.com/newrelic/node-newrelic/commit/4a5772142817afd7ffda0659bad5c9328263fbd0))
6
+
7
+ #### Bug fixes
8
+
9
+ * Fixed common.getKeys logic ([#3114](https://github.com/newrelic/node-newrelic/pull/3114)) ([01d4fa5](https://github.com/newrelic/node-newrelic/commit/01d4fa586e0bc9d9eefdbc416d94f8e4b2ad6504))
10
+ * Fixed Google Cloud Run hostname issue ([#3111](https://github.com/newrelic/node-newrelic/pull/3111)) ([e233fb7](https://github.com/newrelic/node-newrelic/commit/e233fb722760a7683a78145d2953d40b22a27f3a))
11
+
12
+ #### Documentation
13
+
14
+ * Updated compatibility report ([#3106](https://github.com/newrelic/node-newrelic/pull/3106)) ([3c47406](https://github.com/newrelic/node-newrelic/commit/3c47406257ee76d47a878bb71bce902e11211e3a))
15
+
16
+ #### Miscellaneous chores
17
+
18
+ * Added event source type to txn name for Lambda APM Mode ([#3110](https://github.com/newrelic/node-newrelic/pull/3110)) ([ddc2e2a](https://github.com/newrelic/node-newrelic/commit/ddc2e2ad962d72c0dd99f0c16436e7f64e23dce0))
19
+
1
20
  ### v12.19.0 (2025-05-20)
2
21
 
3
22
  #### Features
@@ -19,6 +19,9 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
19
19
  * [@newrelic/security-agent](#newrelicsecurity-agent)
20
20
  * [@opentelemetry/api](#opentelemetryapi)
21
21
  * [@opentelemetry/core](#opentelemetrycore)
22
+ * [@opentelemetry/exporter-metrics-otlp-proto](#opentelemetryexporter-metrics-otlp-proto)
23
+ * [@opentelemetry/resources](#opentelemetryresources)
24
+ * [@opentelemetry/sdk-metrics](#opentelemetrysdk-metrics)
22
25
  * [@opentelemetry/sdk-trace-base](#opentelemetrysdk-trace-base)
23
26
  * [@tyriar/fibonacci-heap](#tyriarfibonacci-heap)
24
27
  * [concat-stream](#concat-stream)
@@ -509,7 +512,7 @@ This product includes source derived from [@grpc/proto-loader](https://github.co
509
512
 
510
513
  ### @newrelic/security-agent
511
514
 
512
- This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v2.4.1](https://github.com/newrelic/csec-node-agent/tree/v2.4.1)), distributed under the [UNKNOWN License](https://github.com/newrelic/csec-node-agent/blob/v2.4.1/LICENSE):
515
+ This product includes source derived from [@newrelic/security-agent](https://github.com/newrelic/csec-node-agent) ([v2.4.2](https://github.com/newrelic/csec-node-agent/tree/v2.4.2)), distributed under the [UNKNOWN License](https://github.com/newrelic/csec-node-agent/blob/v2.4.2/LICENSE):
513
516
 
514
517
  ```
515
518
  ## New Relic Software License v1.0
@@ -764,7 +767,634 @@ This product includes source derived from [@opentelemetry/api](https://github.co
764
767
 
765
768
  ### @opentelemetry/core
766
769
 
767
- This product includes source derived from [@opentelemetry/core](https://github.com/open-telemetry/opentelemetry-js) ([v2.0.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.0.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.0.0/LICENSE):
770
+ This product includes source derived from [@opentelemetry/core](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):
771
+
772
+ ```
773
+ Apache License
774
+ Version 2.0, January 2004
775
+ http://www.apache.org/licenses/
776
+
777
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
778
+
779
+ 1. Definitions.
780
+
781
+ "License" shall mean the terms and conditions for use, reproduction,
782
+ and distribution as defined by Sections 1 through 9 of this document.
783
+
784
+ "Licensor" shall mean the copyright owner or entity authorized by
785
+ the copyright owner that is granting the License.
786
+
787
+ "Legal Entity" shall mean the union of the acting entity and all
788
+ other entities that control, are controlled by, or are under common
789
+ control with that entity. For the purposes of this definition,
790
+ "control" means (i) the power, direct or indirect, to cause the
791
+ direction or management of such entity, whether by contract or
792
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
793
+ outstanding shares, or (iii) beneficial ownership of such entity.
794
+
795
+ "You" (or "Your") shall mean an individual or Legal Entity
796
+ exercising permissions granted by this License.
797
+
798
+ "Source" form shall mean the preferred form for making modifications,
799
+ including but not limited to software source code, documentation
800
+ source, and configuration files.
801
+
802
+ "Object" form shall mean any form resulting from mechanical
803
+ transformation or translation of a Source form, including but
804
+ not limited to compiled object code, generated documentation,
805
+ and conversions to other media types.
806
+
807
+ "Work" shall mean the work of authorship, whether in Source or
808
+ Object form, made available under the License, as indicated by a
809
+ copyright notice that is included in or attached to the work
810
+ (an example is provided in the Appendix below).
811
+
812
+ "Derivative Works" shall mean any work, whether in Source or Object
813
+ form, that is based on (or derived from) the Work and for which the
814
+ editorial revisions, annotations, elaborations, or other modifications
815
+ represent, as a whole, an original work of authorship. For the purposes
816
+ of this License, Derivative Works shall not include works that remain
817
+ separable from, or merely link (or bind by name) to the interfaces of,
818
+ the Work and Derivative Works thereof.
819
+
820
+ "Contribution" shall mean any work of authorship, including
821
+ the original version of the Work and any modifications or additions
822
+ to that Work or Derivative Works thereof, that is intentionally
823
+ submitted to Licensor for inclusion in the Work by the copyright owner
824
+ or by an individual or Legal Entity authorized to submit on behalf of
825
+ the copyright owner. For the purposes of this definition, "submitted"
826
+ means any form of electronic, verbal, or written communication sent
827
+ to the Licensor or its representatives, including but not limited to
828
+ communication on electronic mailing lists, source code control systems,
829
+ and issue tracking systems that are managed by, or on behalf of, the
830
+ Licensor for the purpose of discussing and improving the Work, but
831
+ excluding communication that is conspicuously marked or otherwise
832
+ designated in writing by the copyright owner as "Not a Contribution."
833
+
834
+ "Contributor" shall mean Licensor and any individual or Legal Entity
835
+ on behalf of whom a Contribution has been received by Licensor and
836
+ subsequently incorporated within the Work.
837
+
838
+ 2. Grant of Copyright License. Subject to the terms and conditions of
839
+ this License, each Contributor hereby grants to You a perpetual,
840
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
841
+ copyright license to reproduce, prepare Derivative Works of,
842
+ publicly display, publicly perform, sublicense, and distribute the
843
+ Work and such Derivative Works in Source or Object form.
844
+
845
+ 3. Grant of Patent License. Subject to the terms and conditions of
846
+ this License, each Contributor hereby grants to You a perpetual,
847
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
848
+ (except as stated in this section) patent license to make, have made,
849
+ use, offer to sell, sell, import, and otherwise transfer the Work,
850
+ where such license applies only to those patent claims licensable
851
+ by such Contributor that are necessarily infringed by their
852
+ Contribution(s) alone or by combination of their Contribution(s)
853
+ with the Work to which such Contribution(s) was submitted. If You
854
+ institute patent litigation against any entity (including a
855
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
856
+ or a Contribution incorporated within the Work constitutes direct
857
+ or contributory patent infringement, then any patent licenses
858
+ granted to You under this License for that Work shall terminate
859
+ as of the date such litigation is filed.
860
+
861
+ 4. Redistribution. You may reproduce and distribute copies of the
862
+ Work or Derivative Works thereof in any medium, with or without
863
+ modifications, and in Source or Object form, provided that You
864
+ meet the following conditions:
865
+
866
+ (a) You must give any other recipients of the Work or
867
+ Derivative Works a copy of this License; and
868
+
869
+ (b) You must cause any modified files to carry prominent notices
870
+ stating that You changed the files; and
871
+
872
+ (c) You must retain, in the Source form of any Derivative Works
873
+ that You distribute, all copyright, patent, trademark, and
874
+ attribution notices from the Source form of the Work,
875
+ excluding those notices that do not pertain to any part of
876
+ the Derivative Works; and
877
+
878
+ (d) If the Work includes a "NOTICE" text file as part of its
879
+ distribution, then any Derivative Works that You distribute must
880
+ include a readable copy of the attribution notices contained
881
+ within such NOTICE file, excluding those notices that do not
882
+ pertain to any part of the Derivative Works, in at least one
883
+ of the following places: within a NOTICE text file distributed
884
+ as part of the Derivative Works; within the Source form or
885
+ documentation, if provided along with the Derivative Works; or,
886
+ within a display generated by the Derivative Works, if and
887
+ wherever such third-party notices normally appear. The contents
888
+ of the NOTICE file are for informational purposes only and
889
+ do not modify the License. You may add Your own attribution
890
+ notices within Derivative Works that You distribute, alongside
891
+ or as an addendum to the NOTICE text from the Work, provided
892
+ that such additional attribution notices cannot be construed
893
+ as modifying the License.
894
+
895
+ You may add Your own copyright statement to Your modifications and
896
+ may provide additional or different license terms and conditions
897
+ for use, reproduction, or distribution of Your modifications, or
898
+ for any such Derivative Works as a whole, provided Your use,
899
+ reproduction, and distribution of the Work otherwise complies with
900
+ the conditions stated in this License.
901
+
902
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
903
+ any Contribution intentionally submitted for inclusion in the Work
904
+ by You to the Licensor shall be under the terms and conditions of
905
+ this License, without any additional terms or conditions.
906
+ Notwithstanding the above, nothing herein shall supersede or modify
907
+ the terms of any separate license agreement you may have executed
908
+ with Licensor regarding such Contributions.
909
+
910
+ 6. Trademarks. This License does not grant permission to use the trade
911
+ names, trademarks, service marks, or product names of the Licensor,
912
+ except as required for reasonable and customary use in describing the
913
+ origin of the Work and reproducing the content of the NOTICE file.
914
+
915
+ 7. Disclaimer of Warranty. Unless required by applicable law or
916
+ agreed to in writing, Licensor provides the Work (and each
917
+ Contributor provides its Contributions) on an "AS IS" BASIS,
918
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
919
+ implied, including, without limitation, any warranties or conditions
920
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
921
+ PARTICULAR PURPOSE. You are solely responsible for determining the
922
+ appropriateness of using or redistributing the Work and assume any
923
+ risks associated with Your exercise of permissions under this License.
924
+
925
+ 8. Limitation of Liability. In no event and under no legal theory,
926
+ whether in tort (including negligence), contract, or otherwise,
927
+ unless required by applicable law (such as deliberate and grossly
928
+ negligent acts) or agreed to in writing, shall any Contributor be
929
+ liable to You for damages, including any direct, indirect, special,
930
+ incidental, or consequential damages of any character arising as a
931
+ result of this License or out of the use or inability to use the
932
+ Work (including but not limited to damages for loss of goodwill,
933
+ work stoppage, computer failure or malfunction, or any and all
934
+ other commercial damages or losses), even if such Contributor
935
+ has been advised of the possibility of such damages.
936
+
937
+ 9. Accepting Warranty or Additional Liability. While redistributing
938
+ the Work or Derivative Works thereof, You may choose to offer,
939
+ and charge a fee for, acceptance of support, warranty, indemnity,
940
+ or other liability obligations and/or rights consistent with this
941
+ License. However, in accepting such obligations, You may act only
942
+ on Your own behalf and on Your sole responsibility, not on behalf
943
+ of any other Contributor, and only if You agree to indemnify,
944
+ defend, and hold each Contributor harmless for any liability
945
+ incurred by, or claims asserted against, such Contributor by reason
946
+ of your accepting any such warranty or additional liability.
947
+
948
+ END OF TERMS AND CONDITIONS
949
+
950
+ APPENDIX: How to apply the Apache License to your work.
951
+
952
+ To apply the Apache License to your work, attach the following
953
+ boilerplate notice, with the fields enclosed by brackets "[]"
954
+ replaced with your own identifying information. (Don't include
955
+ the brackets!) The text should be enclosed in the appropriate
956
+ comment syntax for the file format. We also recommend that a
957
+ file or class name and description of purpose be included on the
958
+ same "printed page" as the copyright notice for easier
959
+ identification within third-party archives.
960
+
961
+ Copyright [yyyy] [name of copyright owner]
962
+
963
+ Licensed under the Apache License, Version 2.0 (the "License");
964
+ you may not use this file except in compliance with the License.
965
+ You may obtain a copy of the License at
966
+
967
+ http://www.apache.org/licenses/LICENSE-2.0
968
+
969
+ Unless required by applicable law or agreed to in writing, software
970
+ distributed under the License is distributed on an "AS IS" BASIS,
971
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
972
+ See the License for the specific language governing permissions and
973
+ limitations under the License.
974
+
975
+ ```
976
+
977
+ ### @opentelemetry/exporter-metrics-otlp-proto
978
+
979
+ This product includes source derived from [@opentelemetry/exporter-metrics-otlp-proto](https://github.com/open-telemetry/opentelemetry-js) ([v0.201.1](https://github.com/open-telemetry/opentelemetry-js/tree/v0.201.1)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v0.201.1/LICENSE):
980
+
981
+ ```
982
+ Apache License
983
+ Version 2.0, January 2004
984
+ http://www.apache.org/licenses/
985
+
986
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
987
+
988
+ 1. Definitions.
989
+
990
+ "License" shall mean the terms and conditions for use, reproduction,
991
+ and distribution as defined by Sections 1 through 9 of this document.
992
+
993
+ "Licensor" shall mean the copyright owner or entity authorized by
994
+ the copyright owner that is granting the License.
995
+
996
+ "Legal Entity" shall mean the union of the acting entity and all
997
+ other entities that control, are controlled by, or are under common
998
+ control with that entity. For the purposes of this definition,
999
+ "control" means (i) the power, direct or indirect, to cause the
1000
+ direction or management of such entity, whether by contract or
1001
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
1002
+ outstanding shares, or (iii) beneficial ownership of such entity.
1003
+
1004
+ "You" (or "Your") shall mean an individual or Legal Entity
1005
+ exercising permissions granted by this License.
1006
+
1007
+ "Source" form shall mean the preferred form for making modifications,
1008
+ including but not limited to software source code, documentation
1009
+ source, and configuration files.
1010
+
1011
+ "Object" form shall mean any form resulting from mechanical
1012
+ transformation or translation of a Source form, including but
1013
+ not limited to compiled object code, generated documentation,
1014
+ and conversions to other media types.
1015
+
1016
+ "Work" shall mean the work of authorship, whether in Source or
1017
+ Object form, made available under the License, as indicated by a
1018
+ copyright notice that is included in or attached to the work
1019
+ (an example is provided in the Appendix below).
1020
+
1021
+ "Derivative Works" shall mean any work, whether in Source or Object
1022
+ form, that is based on (or derived from) the Work and for which the
1023
+ editorial revisions, annotations, elaborations, or other modifications
1024
+ represent, as a whole, an original work of authorship. For the purposes
1025
+ of this License, Derivative Works shall not include works that remain
1026
+ separable from, or merely link (or bind by name) to the interfaces of,
1027
+ the Work and Derivative Works thereof.
1028
+
1029
+ "Contribution" shall mean any work of authorship, including
1030
+ the original version of the Work and any modifications or additions
1031
+ to that Work or Derivative Works thereof, that is intentionally
1032
+ submitted to Licensor for inclusion in the Work by the copyright owner
1033
+ or by an individual or Legal Entity authorized to submit on behalf of
1034
+ the copyright owner. For the purposes of this definition, "submitted"
1035
+ means any form of electronic, verbal, or written communication sent
1036
+ to the Licensor or its representatives, including but not limited to
1037
+ communication on electronic mailing lists, source code control systems,
1038
+ and issue tracking systems that are managed by, or on behalf of, the
1039
+ Licensor for the purpose of discussing and improving the Work, but
1040
+ excluding communication that is conspicuously marked or otherwise
1041
+ designated in writing by the copyright owner as "Not a Contribution."
1042
+
1043
+ "Contributor" shall mean Licensor and any individual or Legal Entity
1044
+ on behalf of whom a Contribution has been received by Licensor and
1045
+ subsequently incorporated within the Work.
1046
+
1047
+ 2. Grant of Copyright License. Subject to the terms and conditions of
1048
+ this License, each Contributor hereby grants to You a perpetual,
1049
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1050
+ copyright license to reproduce, prepare Derivative Works of,
1051
+ publicly display, publicly perform, sublicense, and distribute the
1052
+ Work and such Derivative Works in Source or Object form.
1053
+
1054
+ 3. Grant of Patent License. Subject to the terms and conditions of
1055
+ this License, each Contributor hereby grants to You a perpetual,
1056
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1057
+ (except as stated in this section) patent license to make, have made,
1058
+ use, offer to sell, sell, import, and otherwise transfer the Work,
1059
+ where such license applies only to those patent claims licensable
1060
+ by such Contributor that are necessarily infringed by their
1061
+ Contribution(s) alone or by combination of their Contribution(s)
1062
+ with the Work to which such Contribution(s) was submitted. If You
1063
+ institute patent litigation against any entity (including a
1064
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
1065
+ or a Contribution incorporated within the Work constitutes direct
1066
+ or contributory patent infringement, then any patent licenses
1067
+ granted to You under this License for that Work shall terminate
1068
+ as of the date such litigation is filed.
1069
+
1070
+ 4. Redistribution. You may reproduce and distribute copies of the
1071
+ Work or Derivative Works thereof in any medium, with or without
1072
+ modifications, and in Source or Object form, provided that You
1073
+ meet the following conditions:
1074
+
1075
+ (a) You must give any other recipients of the Work or
1076
+ Derivative Works a copy of this License; and
1077
+
1078
+ (b) You must cause any modified files to carry prominent notices
1079
+ stating that You changed the files; and
1080
+
1081
+ (c) You must retain, in the Source form of any Derivative Works
1082
+ that You distribute, all copyright, patent, trademark, and
1083
+ attribution notices from the Source form of the Work,
1084
+ excluding those notices that do not pertain to any part of
1085
+ the Derivative Works; and
1086
+
1087
+ (d) If the Work includes a "NOTICE" text file as part of its
1088
+ distribution, then any Derivative Works that You distribute must
1089
+ include a readable copy of the attribution notices contained
1090
+ within such NOTICE file, excluding those notices that do not
1091
+ pertain to any part of the Derivative Works, in at least one
1092
+ of the following places: within a NOTICE text file distributed
1093
+ as part of the Derivative Works; within the Source form or
1094
+ documentation, if provided along with the Derivative Works; or,
1095
+ within a display generated by the Derivative Works, if and
1096
+ wherever such third-party notices normally appear. The contents
1097
+ of the NOTICE file are for informational purposes only and
1098
+ do not modify the License. You may add Your own attribution
1099
+ notices within Derivative Works that You distribute, alongside
1100
+ or as an addendum to the NOTICE text from the Work, provided
1101
+ that such additional attribution notices cannot be construed
1102
+ as modifying the License.
1103
+
1104
+ You may add Your own copyright statement to Your modifications and
1105
+ may provide additional or different license terms and conditions
1106
+ for use, reproduction, or distribution of Your modifications, or
1107
+ for any such Derivative Works as a whole, provided Your use,
1108
+ reproduction, and distribution of the Work otherwise complies with
1109
+ the conditions stated in this License.
1110
+
1111
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
1112
+ any Contribution intentionally submitted for inclusion in the Work
1113
+ by You to the Licensor shall be under the terms and conditions of
1114
+ this License, without any additional terms or conditions.
1115
+ Notwithstanding the above, nothing herein shall supersede or modify
1116
+ the terms of any separate license agreement you may have executed
1117
+ with Licensor regarding such Contributions.
1118
+
1119
+ 6. Trademarks. This License does not grant permission to use the trade
1120
+ names, trademarks, service marks, or product names of the Licensor,
1121
+ except as required for reasonable and customary use in describing the
1122
+ origin of the Work and reproducing the content of the NOTICE file.
1123
+
1124
+ 7. Disclaimer of Warranty. Unless required by applicable law or
1125
+ agreed to in writing, Licensor provides the Work (and each
1126
+ Contributor provides its Contributions) on an "AS IS" BASIS,
1127
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1128
+ implied, including, without limitation, any warranties or conditions
1129
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1130
+ PARTICULAR PURPOSE. You are solely responsible for determining the
1131
+ appropriateness of using or redistributing the Work and assume any
1132
+ risks associated with Your exercise of permissions under this License.
1133
+
1134
+ 8. Limitation of Liability. In no event and under no legal theory,
1135
+ whether in tort (including negligence), contract, or otherwise,
1136
+ unless required by applicable law (such as deliberate and grossly
1137
+ negligent acts) or agreed to in writing, shall any Contributor be
1138
+ liable to You for damages, including any direct, indirect, special,
1139
+ incidental, or consequential damages of any character arising as a
1140
+ result of this License or out of the use or inability to use the
1141
+ Work (including but not limited to damages for loss of goodwill,
1142
+ work stoppage, computer failure or malfunction, or any and all
1143
+ other commercial damages or losses), even if such Contributor
1144
+ has been advised of the possibility of such damages.
1145
+
1146
+ 9. Accepting Warranty or Additional Liability. While redistributing
1147
+ the Work or Derivative Works thereof, You may choose to offer,
1148
+ and charge a fee for, acceptance of support, warranty, indemnity,
1149
+ or other liability obligations and/or rights consistent with this
1150
+ License. However, in accepting such obligations, You may act only
1151
+ on Your own behalf and on Your sole responsibility, not on behalf
1152
+ of any other Contributor, and only if You agree to indemnify,
1153
+ defend, and hold each Contributor harmless for any liability
1154
+ incurred by, or claims asserted against, such Contributor by reason
1155
+ of your accepting any such warranty or additional liability.
1156
+
1157
+ END OF TERMS AND CONDITIONS
1158
+
1159
+ APPENDIX: How to apply the Apache License to your work.
1160
+
1161
+ To apply the Apache License to your work, attach the following
1162
+ boilerplate notice, with the fields enclosed by brackets "[]"
1163
+ replaced with your own identifying information. (Don't include
1164
+ the brackets!) The text should be enclosed in the appropriate
1165
+ comment syntax for the file format. We also recommend that a
1166
+ file or class name and description of purpose be included on the
1167
+ same "printed page" as the copyright notice for easier
1168
+ identification within third-party archives.
1169
+
1170
+ Copyright [yyyy] [name of copyright owner]
1171
+
1172
+ Licensed under the Apache License, Version 2.0 (the "License");
1173
+ you may not use this file except in compliance with the License.
1174
+ You may obtain a copy of the License at
1175
+
1176
+ http://www.apache.org/licenses/LICENSE-2.0
1177
+
1178
+ Unless required by applicable law or agreed to in writing, software
1179
+ distributed under the License is distributed on an "AS IS" BASIS,
1180
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1181
+ See the License for the specific language governing permissions and
1182
+ limitations under the License.
1183
+
1184
+ ```
1185
+
1186
+ ### @opentelemetry/resources
1187
+
1188
+ This product includes source derived from [@opentelemetry/resources](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):
1189
+
1190
+ ```
1191
+ Apache License
1192
+ Version 2.0, January 2004
1193
+ http://www.apache.org/licenses/
1194
+
1195
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1196
+
1197
+ 1. Definitions.
1198
+
1199
+ "License" shall mean the terms and conditions for use, reproduction,
1200
+ and distribution as defined by Sections 1 through 9 of this document.
1201
+
1202
+ "Licensor" shall mean the copyright owner or entity authorized by
1203
+ the copyright owner that is granting the License.
1204
+
1205
+ "Legal Entity" shall mean the union of the acting entity and all
1206
+ other entities that control, are controlled by, or are under common
1207
+ control with that entity. For the purposes of this definition,
1208
+ "control" means (i) the power, direct or indirect, to cause the
1209
+ direction or management of such entity, whether by contract or
1210
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
1211
+ outstanding shares, or (iii) beneficial ownership of such entity.
1212
+
1213
+ "You" (or "Your") shall mean an individual or Legal Entity
1214
+ exercising permissions granted by this License.
1215
+
1216
+ "Source" form shall mean the preferred form for making modifications,
1217
+ including but not limited to software source code, documentation
1218
+ source, and configuration files.
1219
+
1220
+ "Object" form shall mean any form resulting from mechanical
1221
+ transformation or translation of a Source form, including but
1222
+ not limited to compiled object code, generated documentation,
1223
+ and conversions to other media types.
1224
+
1225
+ "Work" shall mean the work of authorship, whether in Source or
1226
+ Object form, made available under the License, as indicated by a
1227
+ copyright notice that is included in or attached to the work
1228
+ (an example is provided in the Appendix below).
1229
+
1230
+ "Derivative Works" shall mean any work, whether in Source or Object
1231
+ form, that is based on (or derived from) the Work and for which the
1232
+ editorial revisions, annotations, elaborations, or other modifications
1233
+ represent, as a whole, an original work of authorship. For the purposes
1234
+ of this License, Derivative Works shall not include works that remain
1235
+ separable from, or merely link (or bind by name) to the interfaces of,
1236
+ the Work and Derivative Works thereof.
1237
+
1238
+ "Contribution" shall mean any work of authorship, including
1239
+ the original version of the Work and any modifications or additions
1240
+ to that Work or Derivative Works thereof, that is intentionally
1241
+ submitted to Licensor for inclusion in the Work by the copyright owner
1242
+ or by an individual or Legal Entity authorized to submit on behalf of
1243
+ the copyright owner. For the purposes of this definition, "submitted"
1244
+ means any form of electronic, verbal, or written communication sent
1245
+ to the Licensor or its representatives, including but not limited to
1246
+ communication on electronic mailing lists, source code control systems,
1247
+ and issue tracking systems that are managed by, or on behalf of, the
1248
+ Licensor for the purpose of discussing and improving the Work, but
1249
+ excluding communication that is conspicuously marked or otherwise
1250
+ designated in writing by the copyright owner as "Not a Contribution."
1251
+
1252
+ "Contributor" shall mean Licensor and any individual or Legal Entity
1253
+ on behalf of whom a Contribution has been received by Licensor and
1254
+ subsequently incorporated within the Work.
1255
+
1256
+ 2. Grant of Copyright License. Subject to the terms and conditions of
1257
+ this License, each Contributor hereby grants to You a perpetual,
1258
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1259
+ copyright license to reproduce, prepare Derivative Works of,
1260
+ publicly display, publicly perform, sublicense, and distribute the
1261
+ Work and such Derivative Works in Source or Object form.
1262
+
1263
+ 3. Grant of Patent License. Subject to the terms and conditions of
1264
+ this License, each Contributor hereby grants to You a perpetual,
1265
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1266
+ (except as stated in this section) patent license to make, have made,
1267
+ use, offer to sell, sell, import, and otherwise transfer the Work,
1268
+ where such license applies only to those patent claims licensable
1269
+ by such Contributor that are necessarily infringed by their
1270
+ Contribution(s) alone or by combination of their Contribution(s)
1271
+ with the Work to which such Contribution(s) was submitted. If You
1272
+ institute patent litigation against any entity (including a
1273
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
1274
+ or a Contribution incorporated within the Work constitutes direct
1275
+ or contributory patent infringement, then any patent licenses
1276
+ granted to You under this License for that Work shall terminate
1277
+ as of the date such litigation is filed.
1278
+
1279
+ 4. Redistribution. You may reproduce and distribute copies of the
1280
+ Work or Derivative Works thereof in any medium, with or without
1281
+ modifications, and in Source or Object form, provided that You
1282
+ meet the following conditions:
1283
+
1284
+ (a) You must give any other recipients of the Work or
1285
+ Derivative Works a copy of this License; and
1286
+
1287
+ (b) You must cause any modified files to carry prominent notices
1288
+ stating that You changed the files; and
1289
+
1290
+ (c) You must retain, in the Source form of any Derivative Works
1291
+ that You distribute, all copyright, patent, trademark, and
1292
+ attribution notices from the Source form of the Work,
1293
+ excluding those notices that do not pertain to any part of
1294
+ the Derivative Works; and
1295
+
1296
+ (d) If the Work includes a "NOTICE" text file as part of its
1297
+ distribution, then any Derivative Works that You distribute must
1298
+ include a readable copy of the attribution notices contained
1299
+ within such NOTICE file, excluding those notices that do not
1300
+ pertain to any part of the Derivative Works, in at least one
1301
+ of the following places: within a NOTICE text file distributed
1302
+ as part of the Derivative Works; within the Source form or
1303
+ documentation, if provided along with the Derivative Works; or,
1304
+ within a display generated by the Derivative Works, if and
1305
+ wherever such third-party notices normally appear. The contents
1306
+ of the NOTICE file are for informational purposes only and
1307
+ do not modify the License. You may add Your own attribution
1308
+ notices within Derivative Works that You distribute, alongside
1309
+ or as an addendum to the NOTICE text from the Work, provided
1310
+ that such additional attribution notices cannot be construed
1311
+ as modifying the License.
1312
+
1313
+ You may add Your own copyright statement to Your modifications and
1314
+ may provide additional or different license terms and conditions
1315
+ for use, reproduction, or distribution of Your modifications, or
1316
+ for any such Derivative Works as a whole, provided Your use,
1317
+ reproduction, and distribution of the Work otherwise complies with
1318
+ the conditions stated in this License.
1319
+
1320
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
1321
+ any Contribution intentionally submitted for inclusion in the Work
1322
+ by You to the Licensor shall be under the terms and conditions of
1323
+ this License, without any additional terms or conditions.
1324
+ Notwithstanding the above, nothing herein shall supersede or modify
1325
+ the terms of any separate license agreement you may have executed
1326
+ with Licensor regarding such Contributions.
1327
+
1328
+ 6. Trademarks. This License does not grant permission to use the trade
1329
+ names, trademarks, service marks, or product names of the Licensor,
1330
+ except as required for reasonable and customary use in describing the
1331
+ origin of the Work and reproducing the content of the NOTICE file.
1332
+
1333
+ 7. Disclaimer of Warranty. Unless required by applicable law or
1334
+ agreed to in writing, Licensor provides the Work (and each
1335
+ Contributor provides its Contributions) on an "AS IS" BASIS,
1336
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1337
+ implied, including, without limitation, any warranties or conditions
1338
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1339
+ PARTICULAR PURPOSE. You are solely responsible for determining the
1340
+ appropriateness of using or redistributing the Work and assume any
1341
+ risks associated with Your exercise of permissions under this License.
1342
+
1343
+ 8. Limitation of Liability. In no event and under no legal theory,
1344
+ whether in tort (including negligence), contract, or otherwise,
1345
+ unless required by applicable law (such as deliberate and grossly
1346
+ negligent acts) or agreed to in writing, shall any Contributor be
1347
+ liable to You for damages, including any direct, indirect, special,
1348
+ incidental, or consequential damages of any character arising as a
1349
+ result of this License or out of the use or inability to use the
1350
+ Work (including but not limited to damages for loss of goodwill,
1351
+ work stoppage, computer failure or malfunction, or any and all
1352
+ other commercial damages or losses), even if such Contributor
1353
+ has been advised of the possibility of such damages.
1354
+
1355
+ 9. Accepting Warranty or Additional Liability. While redistributing
1356
+ the Work or Derivative Works thereof, You may choose to offer,
1357
+ and charge a fee for, acceptance of support, warranty, indemnity,
1358
+ or other liability obligations and/or rights consistent with this
1359
+ License. However, in accepting such obligations, You may act only
1360
+ on Your own behalf and on Your sole responsibility, not on behalf
1361
+ of any other Contributor, and only if You agree to indemnify,
1362
+ defend, and hold each Contributor harmless for any liability
1363
+ incurred by, or claims asserted against, such Contributor by reason
1364
+ of your accepting any such warranty or additional liability.
1365
+
1366
+ END OF TERMS AND CONDITIONS
1367
+
1368
+ APPENDIX: How to apply the Apache License to your work.
1369
+
1370
+ To apply the Apache License to your work, attach the following
1371
+ boilerplate notice, with the fields enclosed by brackets "[]"
1372
+ replaced with your own identifying information. (Don't include
1373
+ the brackets!) The text should be enclosed in the appropriate
1374
+ comment syntax for the file format. We also recommend that a
1375
+ file or class name and description of purpose be included on the
1376
+ same "printed page" as the copyright notice for easier
1377
+ identification within third-party archives.
1378
+
1379
+ Copyright [yyyy] [name of copyright owner]
1380
+
1381
+ Licensed under the Apache License, Version 2.0 (the "License");
1382
+ you may not use this file except in compliance with the License.
1383
+ You may obtain a copy of the License at
1384
+
1385
+ http://www.apache.org/licenses/LICENSE-2.0
1386
+
1387
+ Unless required by applicable law or agreed to in writing, software
1388
+ distributed under the License is distributed on an "AS IS" BASIS,
1389
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1390
+ See the License for the specific language governing permissions and
1391
+ limitations under the License.
1392
+
1393
+ ```
1394
+
1395
+ ### @opentelemetry/sdk-metrics
1396
+
1397
+ 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):
768
1398
 
769
1399
  ```
770
1400
  Apache License
@@ -973,7 +1603,7 @@ This product includes source derived from [@opentelemetry/core](https://github.c
973
1603
 
974
1604
  ### @opentelemetry/sdk-trace-base
975
1605
 
976
- This product includes source derived from [@opentelemetry/sdk-trace-base](https://github.com/open-telemetry/opentelemetry-js) ([v2.0.0](https://github.com/open-telemetry/opentelemetry-js/tree/v2.0.0)), distributed under the [Apache-2.0 License](https://github.com/open-telemetry/opentelemetry-js/blob/v2.0.0/LICENSE):
1606
+ This product includes source derived from [@opentelemetry/sdk-trace-base](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):
977
1607
 
978
1608
  ```
979
1609
  Apache License
@@ -1702,7 +2332,7 @@ SOFTWARE.
1702
2332
 
1703
2333
  ### @aws-sdk/client-s3
1704
2334
 
1705
- 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):
2335
+ This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.810.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.810.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.810.0/LICENSE):
1706
2336
 
1707
2337
  ```
1708
2338
  Apache License
@@ -1911,7 +2541,7 @@ This product includes source derived from [@aws-sdk/client-s3](https://github.co
1911
2541
 
1912
2542
  ### @aws-sdk/s3-request-presigner
1913
2543
 
1914
- 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):
2544
+ This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.810.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.810.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.810.0/LICENSE):
1915
2545
 
1916
2546
  ```
1917
2547
  Apache License
@@ -3739,7 +4369,7 @@ SOFTWARE.
3739
4369
 
3740
4370
  ### eslint-plugin-jsdoc
3741
4371
 
3742
- 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):
4372
+ This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v50.6.17](https://github.com/gajus/eslint-plugin-jsdoc/tree/v50.6.17)), distributed under the [BSD-3-Clause License](https://github.com/gajus/eslint-plugin-jsdoc/blob/v50.6.17/LICENSE):
3743
4373
 
3744
4374
  ```
3745
4375
  Copyright (c) 2018, Gajus Kuizinas (http://gajus.com/)
@@ -4585,7 +5215,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4585
5215
 
4586
5216
  ### @newrelic/native-metrics
4587
5217
 
4588
- This product includes source derived from [@newrelic/native-metrics](https://github.com/newrelic/node-native-metrics) ([v11.0.0](https://github.com/newrelic/node-native-metrics/tree/v11.0.0)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-native-metrics/blob/v11.0.0/LICENSE):
5218
+ 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):
4589
5219
 
4590
5220
  ```
4591
5221
  Apache License
@@ -31,7 +31,11 @@ async function facts(agent, callback, { logger = defaultLogger } = {}) {
31
31
  systemInfo = systemInfo || Object.create(null)
32
32
  environment = environment || []
33
33
 
34
- const hostname = agent.config.getHostnameSafe()
34
+ let hostname = agent.config.getHostnameSafe()
35
+ if (agent.config.gcp_cloud_run.use_instance_as_host && process.env.K_SERVICE) {
36
+ // K_SERVICE is the name of the service in GCP Cloud Run
37
+ hostname = systemInfo.vendors?.gcp?.id
38
+ }
35
39
  const results = {
36
40
  utilization: {
37
41
  metadata_version: 5,
@@ -1231,6 +1231,16 @@ defaultConfig.definition = () => ({
1231
1231
  default: true
1232
1232
  }
1233
1233
  },
1234
+
1235
+ /**
1236
+ * When `true`, the AWS Lambda instrumentation will add the necessary
1237
+ * data to support the new (as of 2025) unified APM UI.
1238
+ */
1239
+ apm_lambda_mode: {
1240
+ default: false,
1241
+ formatter: boolean
1242
+ },
1243
+
1234
1244
  /**
1235
1245
  * Specifies whether the agent will be used to monitor serverless functions.
1236
1246
  * For example: AWS Lambda
@@ -1595,6 +1605,17 @@ defaultConfig.definition = () => ({
1595
1605
  }
1596
1606
  },
1597
1607
 
1608
+ /**
1609
+ * When enabled, it will use GCP metadata id
1610
+ * to set the hostname of the running application
1611
+ */
1612
+ gcp_cloud_run: {
1613
+ use_instance_as_host: {
1614
+ default: true,
1615
+ formatter: boolean
1616
+ }
1617
+ },
1618
+
1598
1619
  /**
1599
1620
  * When enabled, it will allow loading of the agent
1600
1621
  * in worker threads.
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Copyright 2025 New Relic Corporation. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ 'use strict'
7
+
8
+ module.exports = bootstrapOtelMetrics
9
+
10
+ const { metrics } = require('@opentelemetry/api')
11
+ const { resourceFromAttributes } = require('@opentelemetry/resources')
12
+ const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-proto')
13
+ const {
14
+ AggregationTemporality,
15
+ MeterProvider,
16
+ PeriodicExportingMetricReader
17
+ } = require('@opentelemetry/sdk-metrics')
18
+
19
+ function bootstrapOtelMetrics(agent) {
20
+ // We need access to `agent.config.entity_guid` in order to attach metrics
21
+ // to the correct instrumentation entity. But that value is not available
22
+ // until either at least the first firing of `agent.config.on('change')`, or
23
+ // the `agent.on('started')` event. So we need to defer configuring the
24
+ // metrics provider until that point. Which means metrics are not trustworthy
25
+ // until after the agent has finished starting.
26
+ agent.on('started', configureMetrics)
27
+
28
+ function configureMetrics() {
29
+ agent.removeListener('started', configureMetrics)
30
+
31
+ const { config } = agent
32
+ const resource = config.entity_guid
33
+ ? resourceFromAttributes({ 'entity.guid': config.entity_guid })
34
+ : undefined
35
+ const exporter = new OTLPMetricExporter({
36
+ url: `https://${config.host}:${config.port}/v1/metrics`,
37
+ headers: {
38
+ 'api-key': config.license_key
39
+ },
40
+ temporalityPreference: AggregationTemporality.DELTA
41
+ })
42
+ const reader = new PeriodicExportingMetricReader({
43
+ exporter,
44
+ // TODO: make configurable
45
+ exportIntervalMillis: 1_000
46
+ })
47
+ const provider = new MeterProvider({
48
+ readers: [reader],
49
+ resource
50
+ })
51
+
52
+ metrics.setGlobalMeterProvider(provider)
53
+
54
+ agent.metrics
55
+ .getOrCreateMetric('Supportability/Nodejs/OpenTelemetryBridge/Metrics')
56
+ .incrementCallCount()
57
+ }
58
+ }
@@ -24,7 +24,7 @@ module.exports = class OtelContext extends Context {
24
24
  * @returns {OtelContext} a newly constructed context
25
25
  */
26
26
  enterSegment({ segment, transaction = this._transaction }) {
27
- if (transaction?.agent?.otelSpanKey) {
27
+ if (transaction?.agent?.otelSpanKey && segment) {
28
28
  this._otelCtx.set(transaction.agent.otelSpanKey, new FakeSpan(segment, transaction))
29
29
  }
30
30
  return new this.constructor(transaction, segment, this._otelCtx)
package/lib/otel/setup.js CHANGED
@@ -4,16 +4,18 @@
4
4
  */
5
5
 
6
6
  'use strict'
7
+
7
8
  const opentelemetry = require('@opentelemetry/api')
8
9
  const { BasicTracerProvider } = require('@opentelemetry/sdk-trace-base')
10
+
9
11
  const NrSpanProcessor = require('./span-processor')
10
12
  const NrSampler = require('./sampler')
11
13
  const ContextManager = require('./context-manager')
14
+ const TracePropagator = require('./trace-propagator')
12
15
  const defaultLogger = require('../logger').child({ component: 'opentelemetry-bridge' })
13
16
  const createOtelLogger = require('./logger')
14
- const TracePropagator = require('./trace-propagator')
15
-
16
17
  const interceptSpanKey = require('./span-key-interceptor')
18
+ const bootstrapMetrics = require('./bootstrap-metrics')
17
19
 
18
20
  function setupOtel(agent, logger = defaultLogger) {
19
21
  if (agent.config.feature_flag.opentelemetry_bridge !== true) {
@@ -37,6 +39,8 @@ function setupOtel(agent, logger = defaultLogger) {
37
39
  opentelemetry.context.setGlobalContextManager(new ContextManager(agent))
38
40
  opentelemetry.propagation.setGlobalPropagator(new TracePropagator(agent))
39
41
 
42
+ bootstrapMetrics(agent)
43
+
40
44
  agent.metrics
41
45
  .getOrCreateMetric('Supportability/Nodejs/OpenTelemetryBridge/Setup')
42
46
  .incrementCallCount()
@@ -121,7 +121,21 @@ class AwsLambda {
121
121
 
122
122
  createSegment({ event, context, transaction, recorder }) {
123
123
  const shim = this.shim
124
- const functionName = context.functionName
124
+
125
+ const awsAttributes = this._getAwsAgentAttributes(event, context)
126
+ let trigger = ''
127
+ // Lambda environment variables are passed as strings, so a simple truthiness check could be misleading
128
+ if (this.agent.config.apm_lambda_mode === true &&
129
+ awsAttributes &&
130
+ typeof awsAttributes['aws.lambda.eventSource.eventType'] === 'string') {
131
+ // In Lambda APM mode, we prepend the event type (if present) in upper case to
132
+ // the function name segment of the transaction name, so the event type can be
133
+ // displayed properly in the unified APM UI.
134
+
135
+ trigger = awsAttributes['aws.lambda.eventSource.eventType'].toUpperCase() + ' '
136
+ }
137
+
138
+ const functionName = trigger + context.functionName
125
139
  const group = NAMES.FUNCTION.PREFIX
126
140
  const transactionName = group + functionName
127
141
 
@@ -133,7 +147,6 @@ class AwsLambda {
133
147
  transactionEnders.push(txnEnder)
134
148
  const segment = shim.createSegment(functionName, recorder, activeSegment)
135
149
  transaction.baseSegment = segment
136
- const awsAttributes = this._getAwsAgentAttributes(event, context)
137
150
  transaction.trace.attributes.addAttributes(ATTR_DEST.TRANS_COMMON, awsAttributes)
138
151
 
139
152
  shim.agent.setLambdaArn(context.invokedFunctionArn)
@@ -28,7 +28,7 @@ function checkValueString(str) {
28
28
  return true
29
29
  }
30
30
 
31
- exports.getKeys = function getKeys(data, keys) {
31
+ exports.getKeys = function getKeys(data, keys, allValuesMustBeValid = true) {
32
32
  if (!data) {
33
33
  return null
34
34
  }
@@ -38,18 +38,25 @@ exports.getKeys = function getKeys(data, keys) {
38
38
  const key = keys[i]
39
39
  if (!properties.hasOwn(data, key) || !data[key]) {
40
40
  logger.debug('Key %s missing from metadata', key)
41
- return null
41
+ if (allValuesMustBeValid) {
42
+ return null
43
+ }
44
+ continue
42
45
  }
46
+
43
47
  let value = data[key]
44
48
  if (typeof value === 'number') {
45
49
  value = value.toString()
46
50
  }
47
51
 
48
- // If any value is invalid, the whole thing must be trashed.
49
52
  if (!checkValueString(value)) {
50
53
  logger.debug('Invalid metadata value found: %s -> %s', key, value)
51
- return null
54
+ if (allValuesMustBeValid) {
55
+ return null
56
+ }
57
+ continue
52
58
  }
59
+
53
60
  results[key] = value
54
61
  }
55
62
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2020 New Relic Corporation. All rights reserved.
2
+ * Copyright 2025 New Relic Corporation. All rights reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
@@ -21,7 +21,6 @@ function fetchGCPInfo(agent, callback) {
21
21
  logger.trace({ utilization: 'gcp' }, 'Skipping GCP due to being disabled via config.')
22
22
  return setImmediate(callback, null)
23
23
  }
24
-
25
24
  if (resultDict) {
26
25
  logger.trace({ utilization: 'gcp' }, 'Returning previously found results.')
27
26
  return setImmediate(callback, null, resultDict)
@@ -51,16 +50,21 @@ function fetchGCPInfo(agent, callback) {
51
50
  data = null
52
51
  }
53
52
 
54
- const results = common.getKeys(data, ['id', 'machineType', 'name', 'zone'])
55
- if (results == null) {
53
+ // Most GCP services have id, zone, machineType, and name,
54
+ // but GCP Cloud Run only has id and zone.
55
+ // If K_SERVICE is set, we are in GCP Cloud Run.
56
+ const needAllKeys = !process.env.K_SERVICE
57
+ const results = common.getKeys(data, ['id', 'zone', 'machineType', 'name'], needAllKeys)
58
+ if (!results?.id || !results?.zone) {
59
+ // id and zone are required
56
60
  logger.debug({ utilization: 'gcp' }, 'GCP metadata was invalid.')
57
61
  agent.metrics.getOrCreateMetric(NAMES.UTILIZATION.GCP_ERROR).incrementCallCount()
62
+ return callback(null, null)
58
63
  } else {
59
- // normalize
60
- results.machineType = results.machineType.substring(
61
- results.machineType.lastIndexOf('/') + 1
62
- )
63
- results.zone = results.zone.substring(results.zone.lastIndexOf('/') + 1)
64
+ if (results.machineType) {
65
+ results.machineType = results.machineType.split('/').pop()
66
+ }
67
+ results.zone = results.zone.split('/').pop()
64
68
 
65
69
  resultDict = results
66
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "12.19.0",
3
+ "version": "12.20.0",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [
@@ -206,6 +206,9 @@
206
206
  "@newrelic/security-agent": "^2.4.2",
207
207
  "@opentelemetry/api": "^1.9.0",
208
208
  "@opentelemetry/core": "^2.0.0",
209
+ "@opentelemetry/exporter-metrics-otlp-proto": "^0.201.1",
210
+ "@opentelemetry/resources": "^2.0.1",
211
+ "@opentelemetry/sdk-metrics": "^2.0.1",
209
212
  "@opentelemetry/sdk-trace-base": "^2.0.0",
210
213
  "@tyriar/fibonacci-heap": "^2.0.7",
211
214
  "concat-stream": "^2.0.0",