diff --git a/LICENSES/github.com/go-logr/logr/LICENSE b/LICENSES/github.com/go-logr/logr/LICENSE new file mode 100644 index 000000000..8dada3eda --- /dev/null +++ b/LICENSES/github.com/go-logr/logr/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSES/github.com/go-logr/stdr/LICENSE b/LICENSES/github.com/go-logr/stdr/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/LICENSES/github.com/go-logr/stdr/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSES/go.opentelemetry.io/otel/metric/LICENSE b/LICENSES/go.opentelemetry.io/otel/metric/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/LICENSES/go.opentelemetry.io/otel/metric/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/internal/controller/controller.go b/internal/controller/controller.go index c57ade248..c696d1e36 100644 --- a/internal/controller/controller.go +++ b/internal/controller/controller.go @@ -71,8 +71,6 @@ func (c *Controller) Start(ctx context.Context) error { return fmt.Errorf("failed to start reporter: %w", err) } - metrics.SetReporter(c.reporter) - // Load the eBPF code and map definitions trc, err := tracer.NewTracer(ctx, &tracer.Config{ Reporter: c.reporter, diff --git a/metrics/ids.go b/metrics/ids.go index 5222ccebf..491c2d4ff 100644 --- a/metrics/ids.go +++ b/metrics/ids.go @@ -11,27 +11,6 @@ const ( // Leave out the 0 value. It's an indication of not explicitly initialized variables. IDInvalid = 0 - // CPU Usage: values are 0-100% - IDCPUUsage = 1 - - // I/O Throughput: values are bytes/s - IDIOThroughput = 2 - - // I/O Duration: values are 'weighted # of milliseconds doing I/O' - IDIODuration = 3 - - // Absolute number of goroutines when the metric was collected. - IDAgentGoRoutines = 4 - - // Absolute number in bytes of allocated heap objects of the agent. - IDAgentHeapAlloc = 5 - - // Difference to previous user CPU time of the agent in Milliseconds. - IDAgentUTime = 6 - - // Difference to previous system CPU time of the agent in Milliseconds. - IDAgentSTime = 7 - // Number of calls to interpreter unwinding in dispatch_interpreters() IDUnwindCallInterpreter = 8 @@ -101,9 +80,6 @@ const ( // Number of times unwind_stop is called without a trace IDErrEmptyStack = 48 - // Current size of the hash map pycodeobject_to_fileid - IDHashmapPyCodeObjectToFileID = 49 - // Number of attempted Hotspot frame unwinds IDUnwindHotspotAttempts = 50 @@ -218,15 +194,6 @@ const ( // Number of cache misses for PHP AddrToFunc IDPHPAddrToFuncMiss = 97 - // Current size in bytes of the local interval cache - IDLocalIntervalCacheSize = 98 - - // Number of cache hits of the local interval cache - IDLocalIntervalCacheHit = 99 - - // Number of cache misses of the local interval cache - IDLocalIntervalCacheMiss = 100 - // Number of times a perf event was received without data (report_events) IDPerfEventNoData = 101 @@ -365,15 +332,6 @@ const ( // Number of cache misses for Hotspot AddrToStubNameID IDHotspotAddrToStubNameIDMiss = 152 - // Outgoing total RPC byte count (payload, uncompressed) - IDRPCBytesOutCount = 153 - - // Incoming total RPC byte count (payload, uncompressed) - IDRPCBytesInCount = 154 - - // Number of times reading /proc/ failed due to missing text section - IDErrProcNoTextSec = 155 - // Number of times reading /proc/ as it does not exist anymore IDErrProcNotExist = 156 @@ -491,9 +449,6 @@ const ( // Number of times updating an element in exeIDToStackDeltas failed IDExeIDToStackDeltasUpdate = 196 - // Number of times deleting an element from exeIDToStackDeltas failed - IDExeIDToStackDeltasDelete = 197 - // Number of times updating an element in stackDeltaPageToInfo failed IDStackDeltaPageToInfoUpdate = 198 @@ -542,15 +497,6 @@ const ( // Total /proc/PID/maps parse time for a single collection interval, in microseconds IDTotalProcParseUsec = 220 - // Number of kubernetes client queries. - IDKubernetesClientQuery = 221 - - // Number of docker client queries. - IDDockerClientQuery = 222 - - // Number of containerd client queries. - IDContainerdClientQuery = 223 - // Number of generic PID events (report_events) IDNumGenericPID = 226 @@ -635,12 +581,6 @@ const ( // Number of times batch deleting elements from pidPageToMappingInfo failed IDPidPageToMappingInfoBatchDelete = 253 - // Outgoing total RPC byte count (on-the-wire, compressed) - IDWireBytesOutCount = 254 - - // Incoming total RPC byte count (on-the-wire, compressed) - IDWireBytesInCount = 255 - // Number of times the Hotspot unwind instructions requested LR unwinding mid-trace IDUnwindHotspotErrLrUnwindingMidTrace = 256 diff --git a/metrics/metrics.go b/metrics/metrics.go index 58cd83b23..1ec2c1b46 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -5,14 +5,19 @@ package metrics // import "go.opentelemetry.io/ebpf-profiler/metrics" import ( "bytes" + "context" _ "embed" "encoding/json" + "fmt" "sync" log "github.com/sirupsen/logrus" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/ebpf-profiler/libpf" - "go.opentelemetry.io/ebpf-profiler/reporter" + "go.opentelemetry.io/ebpf-profiler/vc" ) var ( @@ -37,44 +42,63 @@ var ( // Used in fallback checks, e.g. to avoid sending "counters" with 0 values metricTypes map[MetricID]MetricType + + // OTel metric instrumentation + meter = otel.Meter("go.opentelemetry.io/ebpf-profiler", + metric.WithInstrumentationVersion(vc.Version())) + counters = map[MetricID]metric.Int64Counter{} + gauges = map[MetricID]metric.Int64Gauge{} ) func init() { - defs, err := GetDefinitions() - if err != nil { - panic("extracting definitions from metrics.json") - } - + defs := GetDefinitions() metricTypes = make(map[MetricID]MetricType, len(defs)) for _, md := range defs { + if md.Obsolete { + continue + } metricTypes[md.ID] = md.Type + switch typ := md.Type; typ { + case MetricTypeCounter: + counter, err := meter.Int64Counter(md.Name, + metric.WithDescription(md.Description), + metric.WithUnit(md.Unit)) + if err != nil { + log.Errorf("Creating Int64Counter: %v", err) + continue + } + counters[md.ID] = counter + case MetricTypeGauge: + gauge, err := meter.Int64Gauge(md.Name, + metric.WithDescription(md.Description), + metric.WithUnit(md.Unit)) + if err != nil { + log.Errorf("Creating Int64Gauge: %v", err) + continue + } + gauges[md.ID] = gauge + default: + panic(fmt.Sprintf("Unknown metric type: %v", typ)) + } } } -// reporterImpl allows swapping out the global metrics reporter. -// -// nil is a valid value indicating that metrics should be voided. -var reporterImpl reporter.MetricsReporter - -// SetReporter sets the reporter instance used to send out metrics. -func SetReporter(r reporter.MetricsReporter) { - reporterImpl = r -} - -// report converts and reports collected metrics via the reporter package. +// report converts and reports collected metrics via OTel metrics func report() { - ids := make([]uint32, nMetrics) - values := make([]int64, nMetrics) - + ctx := context.Background() for i := 0; i < nMetrics; i++ { - ids[i] = uint32(metricsBuffer[i].ID) - values[i] = int64(metricsBuffer[i].Value) - } - - if reporterImpl != nil { - reporterImpl.ReportMetrics(uint32(prevTimestamp), ids, values) + metric := metricsBuffer[i] + switch typ := metricTypes[metric.ID]; typ { + case MetricTypeCounter: + if counter, ok := counters[metric.ID]; ok { + counter.Add(ctx, int64(metric.Value)) + } + case MetricTypeGauge: + if gauge, ok := gauges[metric.ID]; ok { + gauge.Record(ctx, int64(metric.Value)) + } + } } - nMetrics = 0 for idx := range metricIDSet { metricIDSet[idx] = 0 @@ -119,6 +143,11 @@ func AddSlice(newMetrics []Metric) { continue } + if _, ok := metricTypes[metric.ID]; !ok { + log.Warnf("Invalid metric id %d, skipping", metric.ID) + continue + } + if metric.Value == 0 && metricTypes[metric.ID] == MetricTypeCounter { continue } @@ -175,15 +204,15 @@ func Add(id MetricID, value MetricValue) { // and earlier. // GetDefinitions returns the metric definitions from the embedded metrics.json file. -func GetDefinitions() ([]MetricDefinition, error) { - var definitions []MetricDefinition +func GetDefinitions() []MetricDefinition { + var defs []MetricDefinition dec := json.NewDecoder(bytes.NewReader(metricsJSON)) dec.DisallowUnknownFields() - err := dec.Decode(&definitions) + err := dec.Decode(&defs) if err != nil { - return nil, err + panic(fmt.Sprintf("extracting definitions from metrics.json: %v", err)) } - return definitions, nil + return defs } diff --git a/metrics/metrics.json b/metrics/metrics.json index 85e2cabe7..285804981 100644 --- a/metrics/metrics.json +++ b/metrics/metrics.json @@ -7,6 +7,7 @@ "id": 0 }, { + "obsolete": true, "description": "CPU Usage: values are 0-100%", "type": "gauge", "name": "CPUUsage", @@ -15,6 +16,7 @@ "id": 1 }, { + "obsolete": true, "description": "I/O Throughput: values are bytes/s", "type": "gauge", "name": "IOThroughput", @@ -23,6 +25,7 @@ "id": 2 }, { + "obsolete": true, "description": "I/O Duration: values are 'weighted # of milliseconds doing I/O'", "type": "gauge", "name": "IODuration", @@ -31,6 +34,7 @@ "id": 3 }, { + "obsolete": true, "description": "Absolute number of goroutines when the metric was collected.", "type": "gauge", "name": "AgentGoRoutines", @@ -38,6 +42,7 @@ "id": 4 }, { + "obsolete": true, "description": "Absolute number in bytes of allocated heap objects of the agent.", "type": "gauge", "name": "AgentHeapAlloc", @@ -46,6 +51,7 @@ "id": 5 }, { + "obsolete": true, "description": "Difference to previous user CPU time of the agent in Milliseconds.", "type": "counter", "name": "AgentUTime", @@ -54,6 +60,7 @@ "id": 6 }, { + "obsolete": true, "description": "Difference to previous system CPU time of the agent in Milliseconds.", "type": "counter", "name": "AgentSTime", @@ -357,6 +364,7 @@ "id": 48 }, { + "obsolete": true, "description": "Current size of the hash map pycodeobject_to_fileid", "type": "gauge", "name": "HashmapPyCodeObjectToFileID", @@ -709,6 +717,7 @@ "id": 97 }, { + "obsolete": true, "description": "Current size in bytes of the local interval cache", "type": "gauge", "name": "LocalIntervalCacheSize", @@ -717,6 +726,7 @@ "id": 98 }, { + "obsolete": true, "description": "Number of cache hits of the local interval cache", "type": "counter", "name": "LocalIntervalCacheHit", @@ -724,6 +734,7 @@ "id": 99 }, { + "obsolete": true, "description": "Number of cache misses of the local interval cache", "type": "counter", "name": "LocalIntervalCacheMiss", @@ -1095,6 +1106,7 @@ "id": 152 }, { + "obsolete": true, "description": "Outgoing total RPC byte count (payload, uncompressed)", "type": "counter", "name": "RPCBytesOutCount", @@ -1103,6 +1115,7 @@ "id": 153 }, { + "obsolete": true, "description": "Incoming total RPC byte count (payload, uncompressed)", "type": "counter", "name": "RPCBytesInCount", @@ -1111,6 +1124,7 @@ "id": 154 }, { + "obsolete": true, "description": "Number of times reading /proc/ failed due to missing text section", "type": "counter", "name": "ErrProcNoTextSec", @@ -1407,6 +1421,7 @@ "id": 196 }, { + "obsolete": true, "description": "Number of times deleting an element from exeIDToStackDeltas failed", "type": "counter", "name": "ExeIDToStackDeltasDelete", @@ -1581,6 +1596,7 @@ "id": 220 }, { + "obsolete": true, "description": "Number of kubernetes client queries.", "type": "counter", "name": "KubernetesClientQuery", @@ -1588,6 +1604,7 @@ "id": 221 }, { + "obsolete": true, "description": "Number of docker client queries.", "type": "counter", "name": "DockerClientQuery", @@ -1595,6 +1612,7 @@ "id": 222 }, { + "obsolete": true, "description": "Number of containerd client queries.", "type": "counter", "name": "ContainerdClientQuery", @@ -1811,6 +1829,7 @@ "id": 253 }, { + "obsolete": true, "description": "Outgoing total RPC byte count (on-the-wire, compressed)", "type": "counter", "name": "WireBytesOutCount", @@ -1819,6 +1838,7 @@ "id": 254 }, { + "obsolete": true, "description": "Incoming total RPC byte count (on-the-wire, compressed)", "type": "counter", "name": "WireBytesInCount", diff --git a/metrics/metrics_test.go b/metrics/metrics_test.go index 664d19b1a..b8be5a225 100644 --- a/metrics/metrics_test.go +++ b/metrics/metrics_test.go @@ -5,42 +5,17 @@ package metrics import ( "testing" - "time" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) -type fakeReporter struct { - result chan []Metric -} - -func (f fakeReporter) ReportMetrics(_ uint32, ids []uint32, values []int64) { - metricsResult := make([]Metric, len(ids)) - - for j := range ids { - metricsResult[j].ID = MetricID(ids[j]) - metricsResult[j].Value = MetricValue(values[j]) - } - - // send the result back for comparison with client-side input - f.result <- metricsResult -} - // TestMetrics func TestMetrics(t *testing.T) { - reporter := &fakeReporter{result: make(chan []Metric, 128)} - SetReporter(reporter) - - // This makes sure that we have enough time to call Add/AddSlice below - // within the same timestamp (second resolution). - time.Sleep(1*time.Second - time.Duration(time.Now().Nanosecond())) - inputMetrics := []Metric{ - {IDCPUUsage, MetricValue(33)}, - {IDIOThroughput, MetricValue(55)}, - {IDIODuration, MetricValue(66)}, - {IDAgentGoRoutines, MetricValue(20)}, + {IDELFInfoCacheHit, MetricValue(33)}, + {IDELFInfoCacheMiss, MetricValue(55)}, + {IDErrProcESRCH, MetricValue(66)}, + {IDErrProcNotExist, MetricValue(20)}, {IDUnwindCallInterpreter, MetricValue(0)}, } @@ -51,26 +26,18 @@ func TestMetrics(t *testing.T) { Add(inputMetrics[0].ID, inputMetrics[0].Value) // 33, dropped AddSlice(inputMetrics[1:3]) // 55, 66 dropped AddSlice(inputMetrics[2:5]) // 66 dropped, 20 dropped, 0 dropped - // Drop counter with 0 value as we don't expect it to appear in output inputMetrics = inputMetrics[:4] - // trigger reporting - time.Sleep(1 * time.Second) - AddSlice(nil) - - timeout := time.NewTimer(3 * time.Second) - select { - case outputMetrics := <-reporter.result: - assert.Equal(t, inputMetrics, outputMetrics) - case <-timeout.C: - // Timeout - assert.Fail(t, "timeout - no metrics received in time") + outputMetrics := make([]Metric, nMetrics) + for j := range nMetrics { + outputMetrics[j].ID = metricsBuffer[j].ID + outputMetrics[j].Value = metricsBuffer[j].Value } + assert.Equal(t, inputMetrics, outputMetrics) } func TestGetDefinitions(t *testing.T) { - defs, err := GetDefinitions() - require.NoError(t, err) + defs := GetDefinitions() assert.Greater(t, len(defs), 1) } diff --git a/reporter/base_reporter.go b/reporter/base_reporter.go index a12323be9..66f5db90d 100644 --- a/reporter/base_reporter.go +++ b/reporter/base_reporter.go @@ -93,8 +93,6 @@ func (b *baseReporter) ExecutableMetadata(args *ExecutableMetadataArgs) { }) } -func (*baseReporter) ReportMetrics(_ uint32, _ []uint32, _ []int64) {} - func (*baseReporter) SupportsReportTraceEvent() bool { return true } func (b *baseReporter) ReportTraceEvent(trace *libpf.Trace, meta *samples.TraceEventMeta) { diff --git a/reporter/collector_reporter.go b/reporter/collector_reporter.go index 481a277df..e986c60ce 100644 --- a/reporter/collector_reporter.go +++ b/reporter/collector_reporter.go @@ -105,10 +105,6 @@ func (r *CollectorReporter) Start(ctx context.Context) error { return nil } -func (r *CollectorReporter) GetMetrics() Metrics { - return Metrics{} -} - // reportProfile creates and sends out a profile. func (r *CollectorReporter) reportProfile(ctx context.Context) error { traceEvents := r.traceEvents.WLock() diff --git a/reporter/iface.go b/reporter/iface.go index ddfaab082..679a61e6d 100644 --- a/reporter/iface.go +++ b/reporter/iface.go @@ -17,7 +17,6 @@ type Reporter interface { TraceReporter SymbolReporter HostMetadataReporter - MetricsReporter // Start starts the reporter in the background. // @@ -28,8 +27,6 @@ type Reporter interface { // Stop triggers a graceful shutdown of the reporter. Stop() - // GetMetrics returns the reporter internal metrics. - GetMetrics() Metrics } type TraceReporter interface { @@ -127,9 +124,3 @@ type HostMetadataReporter interface { ReportHostMetadataBlocking(ctx context.Context, metadataMap map[string]string, maxRetries int, waitRetry time.Duration) error } - -type MetricsReporter interface { - // ReportMetrics accepts an id with a corresponding value and caches this - // information before a periodic reporting to the backend. - ReportMetrics(timestamp uint32, ids []uint32, values []int64) -} diff --git a/reporter/metrics.go b/reporter/metrics.go deleted file mode 100644 index 637d30088..000000000 --- a/reporter/metrics.go +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package reporter // import "go.opentelemetry.io/ebpf-profiler/reporter" - -import ( - "context" - "fmt" - "sync/atomic" - - "google.golang.org/grpc/stats" - - "go.opentelemetry.io/ebpf-profiler/libpf/xsync" -) - -type StatsHandlerImpl struct { - // Total number of uncompressed bytes in/out - numRPCBytesOut atomic.Int64 - numRPCBytesIn atomic.Int64 - - // Total number of on-the-wire (post-compression) bytes in/out - numWireBytesOut atomic.Int64 - numWireBytesIn atomic.Int64 - - // These two maps aggregate total in/out byte counts under each RPC method name - rpcBytesOut xsync.RWMutex[map[string]uint64] - rpcBytesIn xsync.RWMutex[map[string]uint64] - - // These two maps aggregate total in/out byte counts under each RPC method name - wireBytesOut xsync.RWMutex[map[string]uint64] - wireBytesIn xsync.RWMutex[map[string]uint64] -} - -// Make sure that the handler implements stats.Handler. -var _ stats.Handler = (*StatsHandlerImpl)(nil) - -// keyRPCTagInfo is the context key for our state. -// -// This is in a global to avoid having to allocate a new string on every call. -var keyRPCTagInfo = "RPCTagInfo" - -// NewStatsHandler creates a new statistics handler. -func NewStatsHandler() *StatsHandlerImpl { - return &StatsHandlerImpl{ - rpcBytesOut: xsync.NewRWMutex(map[string]uint64{}), - rpcBytesIn: xsync.NewRWMutex(map[string]uint64{}), - wireBytesOut: xsync.NewRWMutex(map[string]uint64{}), - wireBytesIn: xsync.NewRWMutex(map[string]uint64{}), - } -} - -// TagRPC implements the stats.Handler interface. -func (sh *StatsHandlerImpl) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { - return context.WithValue(ctx, &keyRPCTagInfo, info) -} - -// TagConn implements the stats.Handler interface. -func (sh *StatsHandlerImpl) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context { - return ctx -} - -// HandleConn implements the stats.Handler interface. -func (sh *StatsHandlerImpl) HandleConn(context.Context, stats.ConnStats) { -} - -func rpcMethodFromContext(ctx context.Context) (string, error) { - tagInfo, ok := ctx.Value(&keyRPCTagInfo).(*stats.RPCTagInfo) - if !ok { - return "", fmt.Errorf("missing context key: %v", keyRPCTagInfo) - } - return tagInfo.FullMethodName, nil -} - -// HandleRPC implements the stats.Handler interface. -func (sh *StatsHandlerImpl) HandleRPC(ctx context.Context, s stats.RPCStats) { - var wireBytesIn, wireBytesOut, rpcBytesIn, rpcBytesOut int64 - - switch s := s.(type) { - case *stats.InPayload: - // WireLength is the length of data on wire (compressed, signed, encrypted, - // with gRPC framing). - wireBytesIn = int64(s.WireLength) - // Length is the uncompressed payload data - rpcBytesIn = int64(s.Length) - case *stats.OutPayload: - wireBytesOut = int64(s.WireLength) - rpcBytesOut = int64(s.Length) - default: - return - } - - method, err := rpcMethodFromContext(ctx) - if err != nil { - // If this happens, it's a bug and we should visibly exit (context must contain tag) - panic(err) - } - - if wireBytesIn != 0 { - sh.numWireBytesIn.Add(wireBytesIn) - sh.numRPCBytesIn.Add(rpcBytesIn) - wireIn := sh.wireBytesIn.WLock() - rpcIn := sh.rpcBytesIn.WLock() - defer sh.wireBytesIn.WUnlock(&wireIn) - defer sh.rpcBytesIn.WUnlock(&rpcIn) - (*wireIn)[method] += uint64(wireBytesIn) - (*rpcIn)[method] += uint64(rpcBytesIn) - } - - if wireBytesOut != 0 { - sh.numWireBytesOut.Add(wireBytesOut) - wireOut := sh.wireBytesOut.WLock() - rpcOut := sh.rpcBytesOut.WLock() - defer sh.wireBytesOut.WUnlock(&wireOut) - defer sh.rpcBytesOut.WUnlock(&rpcOut) - (*wireOut)[method] += uint64(wireBytesOut) - (*rpcOut)[method] += uint64(rpcBytesOut) - } -} - -func (sh *StatsHandlerImpl) GetWireBytesOut() int64 { - return sh.numWireBytesOut.Swap(0) -} - -func (sh *StatsHandlerImpl) GetWireBytesIn() int64 { - return sh.numWireBytesIn.Swap(0) -} - -func (sh *StatsHandlerImpl) GetRPCBytesOut() int64 { - return sh.numRPCBytesOut.Swap(0) -} - -func (sh *StatsHandlerImpl) GetRPCBytesIn() int64 { - return sh.numRPCBytesIn.Swap(0) -} - -//nolint:unused -func (sh *StatsHandlerImpl) getMethodRPCBytesOut() map[string]uint64 { - rpcOut := sh.rpcBytesOut.RLock() - defer sh.rpcBytesOut.RUnlock(&rpcOut) - res := make(map[string]uint64, len(*rpcOut)) - for k, v := range *rpcOut { - res[k] = v - } - return res -} - -//nolint:unused -func (sh *StatsHandlerImpl) getMethodRPCBytesIn() map[string]uint64 { - rpcIn := sh.rpcBytesIn.RLock() - defer sh.rpcBytesIn.RUnlock(&rpcIn) - res := make(map[string]uint64, len(*rpcIn)) - for k, v := range *rpcIn { - res[k] = v - } - return res -} - -//nolint:unused -func (sh *StatsHandlerImpl) getMethodWireBytesOut() map[string]uint64 { - wireOut := sh.wireBytesOut.RLock() - defer sh.wireBytesOut.RUnlock(&wireOut) - res := make(map[string]uint64, len(*wireOut)) - for k, v := range *wireOut { - res[k] = v - } - return res -} - -//nolint:unused -func (sh *StatsHandlerImpl) getMethodWireBytesIn() map[string]uint64 { - wireIn := sh.wireBytesIn.RLock() - defer sh.wireBytesIn.RUnlock(&wireIn) - res := make(map[string]uint64, len(*wireIn)) - for k, v := range *wireIn { - res[k] = v - } - return res -} - -// Metrics holds the metric counters for the reporter package. -type Metrics struct { - RPCBytesOutCount int64 - RPCBytesInCount int64 - WireBytesOutCount int64 - WireBytesInCount int64 -} diff --git a/reporter/otlp_reporter.go b/reporter/otlp_reporter.go index ee630fe3d..463f7922e 100644 --- a/reporter/otlp_reporter.go +++ b/reporter/otlp_reporter.go @@ -48,9 +48,6 @@ type OTLPReporter struct { // client for the connection to the receiver. client pprofileotlp.GRPCClient - // rpcStats stores gRPC related statistics. - rpcStats *StatsHandlerImpl - // To fill in the OTLP/profiles signal with the relevant information, // this structure holds in long-term storage information that might // be duplicated in other places but not accessible for OTLPReporter. @@ -112,20 +109,9 @@ func NewOTLP(cfg *Config) (*OTLPReporter, error) { hostID: strconv.FormatUint(cfg.HostID, 10), pkgGRPCOperationTimeout: cfg.GRPCOperationTimeout, client: nil, - rpcStats: NewStatsHandler(), }, nil } -// GetMetrics returns internal metrics of OTLPReporter. -func (r *OTLPReporter) GetMetrics() Metrics { - return Metrics{ - RPCBytesOutCount: r.rpcStats.GetRPCBytesOut(), - RPCBytesInCount: r.rpcStats.GetRPCBytesIn(), - WireBytesOutCount: r.rpcStats.GetWireBytesOut(), - WireBytesInCount: r.rpcStats.GetWireBytesIn(), - } -} - // Start sets up and manages the reporting connection to a OTLP backend. func (r *OTLPReporter) Start(ctx context.Context) error { // Create a child context for reporting features @@ -134,7 +120,7 @@ func (r *OTLPReporter) Start(ctx context.Context) error { // Establish the gRPC connection before going on, waiting for a response // from the collectionAgent endpoint. // Use grpc.WithBlock() in setupGrpcConnection() for this to work. - otlpGrpcConn, err := waitGrpcEndpoint(ctx, r.cfg, r.rpcStats) + otlpGrpcConn, err := waitGrpcEndpoint(ctx, r.cfg) if err != nil { cancelReporting() r.runLoop.Stop() @@ -218,15 +204,14 @@ func (r *OTLPReporter) setResource(rp pprofile.ResourceProfiles) { } // waitGrpcEndpoint waits until the gRPC connection is established. -func waitGrpcEndpoint(ctx context.Context, cfg *Config, - statsHandler *StatsHandlerImpl) (*grpc.ClientConn, error) { +func waitGrpcEndpoint(ctx context.Context, cfg *Config) (*grpc.ClientConn, error) { // Sleep with a fixed backoff time added of +/- 20% jitter tick := time.NewTicker(libpf.AddJitter(cfg.GRPCStartupBackoffTime, 0.2)) defer tick.Stop() var retries uint32 for { - if collAgentConn, err := setupGrpcConnection(ctx, cfg, statsHandler); err != nil { + if collAgentConn, err := setupGrpcConnection(ctx, cfg); err != nil { if retries >= cfg.MaxGRPCRetries { return nil, err } @@ -251,11 +236,9 @@ func waitGrpcEndpoint(ctx context.Context, cfg *Config, } // setupGrpcConnection sets up a gRPC connection instrumented with our auth interceptor -func setupGrpcConnection(parent context.Context, cfg *Config, - statsHandler *StatsHandlerImpl) (*grpc.ClientConn, error) { +func setupGrpcConnection(parent context.Context, cfg *Config) (*grpc.ClientConn, error) { //nolint:staticcheck opts := []grpc.DialOption{grpc.WithBlock(), - grpc.WithStatsHandler(statsHandler), grpc.WithUnaryInterceptor(cfg.GRPCClientInterceptor), grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(cfg.MaxRPCMsgSize), diff --git a/reporter/times.go b/reporter/times.go index 2fa33d8b0..40e8e9fbe 100644 --- a/reporter/times.go +++ b/reporter/times.go @@ -15,7 +15,6 @@ var _ Times = (*times.Times)(nil) // Times is a subset of config.IntervalsAndTimers. type Times interface { ReportInterval() time.Duration - ReportMetricsInterval() time.Duration GRPCConnectionTimeout() time.Duration GRPCOperationTimeout() time.Duration GRPCStartupBackoffTime() time.Duration diff --git a/times/times.go b/times/times.go index d7f2c889b..73966fe62 100644 --- a/times/times.go +++ b/times/times.go @@ -43,7 +43,6 @@ type Times struct { monitorInterval time.Duration tracePollInterval time.Duration reportInterval time.Duration - reportMetricsInterval time.Duration grpcConnectionTimeout time.Duration grpcOperationTimeout time.Duration grpcStartupBackoffTimeout time.Duration @@ -60,9 +59,6 @@ type IntervalsAndTimers interface { TracePollInterval() time.Duration // ReportInterval defines the interval at which collected data is sent to collection agent. ReportInterval() time.Duration - // ReportMetricsInterval defines the interval at which collected metrics are sent - // to collection agent. - ReportMetricsInterval() time.Duration // GRPCConnectionTimeout defines the timeout for each established gRPC connection. GRPCConnectionTimeout() time.Duration // GRPCOperationTimeout defines the timeout for each gRPC operation. @@ -87,8 +83,6 @@ func (t *Times) TracePollInterval() time.Duration { return t.tracePollInterval } func (t *Times) ReportInterval() time.Duration { return t.reportInterval } -func (t *Times) ReportMetricsInterval() time.Duration { return t.reportMetricsInterval } - func (t *Times) GRPCConnectionTimeout() time.Duration { return t.grpcConnectionTimeout } func (t *Times) GRPCOperationTimeout() time.Duration { return t.grpcOperationTimeout } @@ -117,7 +111,6 @@ func StartRealtimeSync(ctx context.Context, syncInterval time.Duration) { // New returns a new Times instance. func New(reportInterval, monitorInterval, probabilisticInterval time.Duration) *Times { return &Times{ - reportMetricsInterval: 1 * time.Minute, grpcAuthErrorDelay: GRPCAuthErrorDelay, grpcConnectionTimeout: GRPCConnectionTimeout, grpcOperationTimeout: GRPCOperationTimeout,