From b1692804242ad1126cfee7330157165dbeed2e15 Mon Sep 17 00:00:00 2001 From: Bryan Naegele Date: Tue, 12 Sep 2023 22:28:20 -0600 Subject: [PATCH] Remove telemetry registry, fix broken log, update tests --- .../_checkouts/test_app/.gitignore | 20 -- .../_checkouts/test_app/LICENSE | 191 ------------------ .../_checkouts/test_app/README.md | 9 - .../_checkouts/test_app/rebar.config | 33 --- .../_checkouts/test_app/rebar.lock | 1 - .../_checkouts/test_app/src/test_app.app.src | 16 -- .../_checkouts/test_app/src/test_app.erl | 82 -------- .../_checkouts/test_app/src/test_app_app.erl | 26 --- .../_checkouts/test_app/src/test_app_sup.erl | 38 ---- .../_checkouts/test_child_app/.gitignore | 19 -- .../_checkouts/test_child_app/LICENSE | 191 ------------------ .../_checkouts/test_child_app/README.md | 9 - .../_checkouts/test_child_app/rebar.config | 7 - .../_checkouts/test_child_app/rebar.lock | 1 - .../test_child_app/src/test_child_app.app.src | 15 -- .../test_child_app/src/test_child_app.erl | 27 --- .../test_child_app/src/test_child_app_app.erl | 26 --- .../test_child_app/src/test_child_app_sup.erl | 38 ---- utilities/opentelemetry_telemetry/mix.lock | 14 +- .../opentelemetry_telemetry/rebar.config | 6 +- utilities/opentelemetry_telemetry/rebar.lock | 20 +- .../src/opentelemetry_telemetry.app.src | 3 +- .../src/otel_telemetry.erl | 39 +--- .../test/otel_telemetry_SUITE.erl | 83 +++++++- 24 files changed, 98 insertions(+), 816 deletions(-) delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_app/.gitignore delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_app/LICENSE delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_app/README.md delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_app/rebar.config delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_app/rebar.lock delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app.app.src delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app.erl delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app_app.erl delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app_sup.erl delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_child_app/.gitignore delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_child_app/LICENSE delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_child_app/README.md delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_child_app/rebar.config delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_child_app/rebar.lock delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app.app.src delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app.erl delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app_app.erl delete mode 100644 utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app_sup.erl diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_app/.gitignore b/utilities/opentelemetry_telemetry/_checkouts/test_app/.gitignore deleted file mode 100644 index 96f7b51b..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_app/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -.rebar3 -_* -.eunit -*.o -*.beam -*.plt -*.swp -*.swo -.erlang.cookie -ebin -log -erl_crash.dump -.rebar -logs -_build -.idea -*.iml -rebar3.crashdump -*~ -!_checkouts diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_app/LICENSE b/utilities/opentelemetry_telemetry/_checkouts/test_app/LICENSE deleted file mode 100644 index 01f8d07e..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_app/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ - 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 - - Copyright 2020, Bryan Naegele . - - 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/utilities/opentelemetry_telemetry/_checkouts/test_app/README.md b/utilities/opentelemetry_telemetry/_checkouts/test_app/README.md deleted file mode 100644 index c89e88ce..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_app/README.md +++ /dev/null @@ -1,9 +0,0 @@ -test_app -===== - -An OTP application - -Build ------ - - $ rebar3 compile diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_app/rebar.config b/utilities/opentelemetry_telemetry/_checkouts/test_app/rebar.config deleted file mode 100644 index a76d53b4..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_app/rebar.config +++ /dev/null @@ -1,33 +0,0 @@ -{erl_opts, [debug_info]}. -{deps, [ - {test_child_app, "~> 0.1"} -]}. - -{profiles, [ - {test, [{erl_opts, [nowarn_export_all]}, - {deps, [ - {test_child_app, "~> 0.1"}, - {telemetry, "~> 1.0"} - ]}, - %% create junit xml for circleci - {ct_opts, [{ct_hooks, [cth_surefire]}]}, - {cover_enabled, true}, - {cover_opts, [verbose]}, - {paths, ["src", "test/support"]}, - %% convert to data codecov understands - {plugins, [covertool]}, - {covertool, [{coverdata_files, ["ct.coverdata"]}]} - ]}, - {docs, [{edoc_opts, [{preprocess, true}, - {title, "Test App"}]} - ]} -]}. - -{shell, [ - % {config, "config/sys.config"}, - {apps, [test_app]} -]}. - -%% take out warnings for unused exported functions -{xref_checks,[undefined_function_calls, undefined_functions, locals_not_used, - deprecated_function_calls, deprecated_functions]}. \ No newline at end of file diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_app/rebar.lock b/utilities/opentelemetry_telemetry/_checkouts/test_app/rebar.lock deleted file mode 100644 index 57afcca0..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_app/rebar.lock +++ /dev/null @@ -1 +0,0 @@ -[]. diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app.app.src b/utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app.app.src deleted file mode 100644 index 7e833bdb..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app.app.src +++ /dev/null @@ -1,16 +0,0 @@ -{application, test_app, - [{description, "An OTP application"}, - {vsn, "0.1.0"}, - {registered, []}, - {mod, {test_app_app, []}}, - {applications, - [kernel, - stdlib, - test_child_app - ]}, - {env,[]}, - {modules, []}, - - {licenses, ["Apache 2.0"]}, - {links, []} - ]}. diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app.erl b/utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app.erl deleted file mode 100644 index dd90eb2d..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app.erl +++ /dev/null @@ -1,82 +0,0 @@ --module(test_app). - --export([handler/1]). - --telemetry_event #{ - event => [test_app, handler, start], - description => <<"Emitted at the start of the handler">>, - measurements => <<"#{system_time => non_neg_integer()}">>, - metadata => <<"#{}">> - }. --telemetry_event #{ - event => [test_app, handler, stop], - description => <<"Emitted at the end of the handler">>, - measurements => <<"#{duration => non_neg_integer()}">>, - metadata => <<"#{}">> - }. --telemetry_event #{ - event => [test_app, handler, exception], - description => <<"The handler raised an exception">>, - measurements => <<"#{duration => non_neg_integer()}">>, - metadata => <<"#{kind => atom(), reason => atom(), stacktrace => term()}">> - }. - --telemetry_event #{ - event => [test_app, nested_span, start], - description => <<"Emitted at the start of the handler">>, - measurements => <<"#{system_time => non_neg_integer()}">>, - metadata => <<"#{}">> - }. --telemetry_event #{ - event => [test_app, nested_span, stop], - description => <<"Emitted at the end of the handler">>, - measurements => <<"#{duration => non_neg_integer()}">>, - metadata => <<"#{}">> - }. --telemetry_event #{ - event => [test_app, nested_span, exception], - description => <<"The handler raised an exception">>, - measurements => <<"#{duration => non_neg_integer()}">>, - metadata => <<"#{kind => atom(), reason => atom(), stacktrace => term()}">> - }. - - --telemetry_event #{ - event => [test_app, only, stop], - description => <<"The handler raised an exception">>, - measurements => <<"#{duration => non_neg_integer()}">>, - metadata => <<"#{kind => atom(), reason => atom(), stacktrace => term()}">> - }. - --telemetry_event #{ - event => [test_app, cache, miss], - description => <<"Emitted at the start of the handler">>, - measurements => <<"#{system_time => non_neg_integer()}">>, - metadata => <<"#{}">> - }. --telemetry_event #{ - event => [test_app, cache, hit], - description => <<"Emitted at the end of the handler">>, - measurements => <<"#{duration => non_neg_integer()}">>, - metadata => <<"#{}">> - }. - -handler(Args) -> - _ = telemetry:span( - [test_app, handler], - #{}, - fun() -> - case Args of - raise_exception -> - binary_to_list("heh, already a list"); - _ -> {nested_span(), #{}} - end - end). - -nested_span() -> - _ = telemetry:span( - [test_app, nested_span], - #{}, - fun() -> - {ok, #{}} - end). diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app_app.erl b/utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app_app.erl deleted file mode 100644 index 5cb1987b..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app_app.erl +++ /dev/null @@ -1,26 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc test_app public API -%% @end -%%%------------------------------------------------------------------- - --module(test_app_app). - --behaviour(application). - -%% Application callbacks --export([start/2, stop/1]). - -%%==================================================================== -%% API -%%==================================================================== - -start(_StartType, _StartArgs) -> - test_app_sup:start_link(). - -%%-------------------------------------------------------------------- -stop(_State) -> - ok. - -%%==================================================================== -%% Internal functions -%%==================================================================== diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app_sup.erl b/utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app_sup.erl deleted file mode 100644 index 5a66cf5a..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_app/src/test_app_sup.erl +++ /dev/null @@ -1,38 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc test_app top level supervisor. -%% @end -%%%------------------------------------------------------------------- - --module(test_app_sup). - --behaviour(supervisor). - -%% API --export([start_link/0]). - -%% Supervisor callbacks --export([init/1]). - --define(SERVER, ?MODULE). - -%%==================================================================== -%% API functions -%%==================================================================== - -start_link() -> - supervisor:start_link({local, ?SERVER}, ?MODULE, []). - -%%==================================================================== -%% Supervisor callbacks -%%==================================================================== - -%% Child :: #{id => Id, start => {M, F, A}} -%% Optional keys are restart, shutdown, type, modules. -%% Before OTP 18 tuples must be used to specify a child. e.g. -%% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules} -init([]) -> - {ok, {{one_for_all, 0, 1}, []}}. - -%%==================================================================== -%% Internal functions -%%==================================================================== diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/.gitignore b/utilities/opentelemetry_telemetry/_checkouts/test_child_app/.gitignore deleted file mode 100644 index f1c45545..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -.rebar3 -_* -.eunit -*.o -*.beam -*.plt -*.swp -*.swo -.erlang.cookie -ebin -log -erl_crash.dump -.rebar -logs -_build -.idea -*.iml -rebar3.crashdump -*~ diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/LICENSE b/utilities/opentelemetry_telemetry/_checkouts/test_child_app/LICENSE deleted file mode 100644 index 01f8d07e..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ - 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 - - Copyright 2020, Bryan Naegele . - - 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/utilities/opentelemetry_telemetry/_checkouts/test_child_app/README.md b/utilities/opentelemetry_telemetry/_checkouts/test_child_app/README.md deleted file mode 100644 index e8a41a39..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/README.md +++ /dev/null @@ -1,9 +0,0 @@ -test_child_app -===== - -An OTP application - -Build ------ - - $ rebar3 compile diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/rebar.config b/utilities/opentelemetry_telemetry/_checkouts/test_child_app/rebar.config deleted file mode 100644 index 16cf5d5c..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/rebar.config +++ /dev/null @@ -1,7 +0,0 @@ -{erl_opts, [debug_info]}. -{deps, []}. - -{shell, [ - % {config, "config/sys.config"}, - {apps, [test_child_app]} -]}. diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/rebar.lock b/utilities/opentelemetry_telemetry/_checkouts/test_child_app/rebar.lock deleted file mode 100644 index 57afcca0..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/rebar.lock +++ /dev/null @@ -1 +0,0 @@ -[]. diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app.app.src b/utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app.app.src deleted file mode 100644 index 54d3c137..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app.app.src +++ /dev/null @@ -1,15 +0,0 @@ -{application, test_child_app, - [{description, "An OTP application"}, - {vsn, "0.1.0"}, - {registered, []}, - {mod, {test_child_app_app, []}}, - {applications, - [kernel, - stdlib - ]}, - {env,[]}, - {modules, []}, - - {licenses, ["Apache 2.0"]}, - {links, []} - ]}. diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app.erl b/utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app.erl deleted file mode 100644 index 73bcf990..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app.erl +++ /dev/null @@ -1,27 +0,0 @@ --module(test_child_app). - --telemetry_event #{ - event => [test_child_app, extra_long, start], - description => <<"Emitted at the start of the handler">>, - measurements => <<"#{system_time => non_neg_integer()}">>, - metadata => <<"#{}">> - }. --telemetry_event #{ - event => [test_child_app, extra_long, stop], - description => <<"Emitted at the end of the handler">>, - measurements => <<"#{duration => non_neg_integer()}">>, - metadata => <<"#{}">> - }. - --telemetry_event #{ - event => [test_child_app, cache, hit], - description => <<"Emitted at the start of the handler">>, - measurements => <<"#{system_time => non_neg_integer()}">>, - metadata => <<"#{}">> - }. --telemetry_event #{ - event => [test_child_app, cache, miss], - description => <<"Emitted at the end of the handler">>, - measurements => <<"#{duration => non_neg_integer()}">>, - metadata => <<"#{}">> - }. diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app_app.erl b/utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app_app.erl deleted file mode 100644 index fbc806fe..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app_app.erl +++ /dev/null @@ -1,26 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc test_child_app public API -%% @end -%%%------------------------------------------------------------------- - --module(test_child_app_app). - --behaviour(application). - -%% Application callbacks --export([start/2, stop/1]). - -%%==================================================================== -%% API -%%==================================================================== - -start(_StartType, _StartArgs) -> - test_child_app_sup:start_link(). - -%%-------------------------------------------------------------------- -stop(_State) -> - ok. - -%%==================================================================== -%% Internal functions -%%==================================================================== diff --git a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app_sup.erl b/utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app_sup.erl deleted file mode 100644 index b3df3914..00000000 --- a/utilities/opentelemetry_telemetry/_checkouts/test_child_app/src/test_child_app_sup.erl +++ /dev/null @@ -1,38 +0,0 @@ -%%%------------------------------------------------------------------- -%% @doc test_child_app top level supervisor. -%% @end -%%%------------------------------------------------------------------- - --module(test_child_app_sup). - --behaviour(supervisor). - -%% API --export([start_link/0]). - -%% Supervisor callbacks --export([init/1]). - --define(SERVER, ?MODULE). - -%%==================================================================== -%% API functions -%%==================================================================== - -start_link() -> - supervisor:start_link({local, ?SERVER}, ?MODULE, []). - -%%==================================================================== -%% Supervisor callbacks -%%==================================================================== - -%% Child :: #{id => Id, start => {M, F, A}} -%% Optional keys are restart, shutdown, type, modules. -%% Before OTP 18 tuples must be used to specify a child. e.g. -%% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules} -init([]) -> - {ok, {{one_for_all, 0, 1}, []}}. - -%%==================================================================== -%% Internal functions -%%==================================================================== diff --git a/utilities/opentelemetry_telemetry/mix.lock b/utilities/opentelemetry_telemetry/mix.lock index 5df8a123..31cacd98 100644 --- a/utilities/opentelemetry_telemetry/mix.lock +++ b/utilities/opentelemetry_telemetry/mix.lock @@ -3,25 +3,25 @@ "chatterbox": {:hex, :ts_chatterbox, "0.13.0", "6f059d97bcaa758b8ea6fffe2b3b81362bd06b639d3ea2bb088335511d691ebf", [:rebar3], [{:hpack, "~>0.2.3", [hex: :hpack_erl, repo: "hexpm", optional: false]}], "hexpm", "b93d19104d86af0b3f2566c4cba2a57d2e06d103728246ba1ac6c3c0ff010aa7"}, "cmark": {:hex, :cmark, "0.9.0", "c0e673019e125eb5878b6c5610af919d737e881369e0cd2247c89e767f42c029", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "0cfb4d8888bc801f2decc23eee3b3b756b682dff976d15a46861a596fdb00079"}, "ctx": {:hex, :ctx, "0.6.0", "8ff88b70e6400c4df90142e7f130625b82086077a45364a78d208ed3ed53c7fe", [:rebar3], [], "hexpm", "a14ed2d1b67723dbebbe423b28d7615eb0bdcba6ff28f2d1f1b0a7e1d4aa5fc2"}, - "dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"}, + "dialyxir": {:hex, :dialyxir, "1.4.1", "a22ed1e7bd3a3e3f197b68d806ef66acb61ee8f57b3ac85fc5d57354c5482a93", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "84b795d6d7796297cca5a3118444b80c7d94f7ce247d49886e7c291e1ae49801"}, "earmark": {:hex, :earmark, "1.4.5", "62ffd3bd7722fb7a7b1ecd2419ea0b458c356e7168c1f5d65caf09b4fbdd13c8", [:mix], [], "hexpm", "b7d0e6263d83dc27141a523467799a685965bf8b13b6743413f19a7079843f4f"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.29", "149d50dcb3a93d9f3d6f3ecf18c918fb5a2d3c001b5d3305c926cddfbd33355b", [:mix], [], "hexpm", "4902af1b3eb139016aed210888748db8070b8125c2342ce3dcae4f38dcc63503"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.35", "437773ca9384edf69830e26e9e7b2e0d22d2596c4a6b17094a3b29f01ea65bb8", [:mix], [], "hexpm", "8652ba3cb85608d0d7aa2d21b45c6fad4ddc9a1f9a1f1b30ca3a246f0acc33f6"}, "elixir_make": {:hex, :elixir_make, "0.6.0", "38349f3e29aff4864352084fc736fa7fa0f2995a819a737554f7ebd28b85aaab", [:mix], [], "hexpm", "d522695b93b7f0b4c0fcb2dfe73a6b905b1c301226a5a55cb42e5b14d509e050"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, - "ex_doc": {:hex, :ex_doc, "0.29.0", "4a1cb903ce746aceef9c1f9ae8a6c12b742a5461e6959b9d3b24d813ffbea146", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "f096adb8bbca677d35d278223361c7792d496b3fc0d0224c9d4bc2f651af5db1"}, + "ex_doc": {:hex, :ex_doc, "0.30.6", "5f8b54854b240a2b55c9734c4b1d0dd7bdd41f71a095d42a70445c03cf05a281", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "bd48f2ddacf4e482c727f9293d9498e0881597eae6ddc3d9562bd7923375109f"}, "gproc": {:hex, :gproc, "0.8.0", "cea02c578589c61e5341fce149ea36ccef236cc2ecac8691fba408e7ea77ec2f", [:rebar3], [], "hexpm", "580adafa56463b75263ef5a5df4c86af321f68694e7786cb057fd805d1e2a7de"}, "grpcbox": {:hex, :grpcbox, "0.16.0", "b83f37c62d6eeca347b77f9b1ec7e9f62231690cdfeb3a31be07cd4002ba9c82", [:rebar3], [{:acceptor_pool, "~>1.0.0", [hex: :acceptor_pool, repo: "hexpm", optional: false]}, {:chatterbox, "~>0.13.0", [hex: :ts_chatterbox, repo: "hexpm", optional: false]}, {:ctx, "~>0.6.0", [hex: :ctx, repo: "hexpm", optional: false]}, {:gproc, "~>0.8.0", [hex: :gproc, repo: "hexpm", optional: false]}], "hexpm", "294df743ae20a7e030889f00644001370a4f7ce0121f3bbdaf13cf3169c62913"}, "hpack": {:hex, :hpack_erl, "0.2.3", "17670f83ff984ae6cd74b1c456edde906d27ff013740ee4d9efaa4f1bf999633", [:rebar3], [], "hexpm", "06f580167c4b8b8a6429040df36cc93bba6d571faeaec1b28816523379cbb23a"}, "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"}, - "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"}, + "makeup_erlang": {:hex, :makeup_erlang, "0.1.2", "ad87296a092a46e03b7e9b0be7631ddcf64c790fa68a9ef5323b6cbb36affc72", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f3f5a1ca93ce6e092d92b6d9c049bcda58a3b617a8d888f8e7231c85630e8108"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, "opentelemetry": {:hex, :opentelemetry, "1.3.1", "f0a342a74379e3540a634e7047967733da4bc8b873ec9026e224b2bd7369b1fc", [:rebar3], [{:opentelemetry_api, "~> 1.2.2", [hex: :opentelemetry_api, repo: "hexpm", optional: false]}, {:opentelemetry_semantic_conventions, "~> 0.2", [hex: :opentelemetry_semantic_conventions, repo: "hexpm", optional: false]}], "hexpm", "de476b2ac4faad3e3fe3d6e18b35dec9cb338c3b9910c2ce9317836dacad3483"}, "opentelemetry_api": {:hex, :opentelemetry_api, "1.2.2", "693f47b0d8c76da2095fe858204cfd6350c27fe85d00e4b763deecc9588cf27a", [:mix, :rebar3], [{:opentelemetry_semantic_conventions, "~> 0.2", [hex: :opentelemetry_semantic_conventions, repo: "hexpm", optional: false]}], "hexpm", "dc77b9a00f137a858e60a852f14007bb66eda1ffbeb6c05d5fe6c9e678b05e9d"}, "opentelemetry_exporter": {:hex, :opentelemetry_exporter, "1.6.0", "f4fbf69aa9f1541b253813221b82b48a9863bc1570d8ecc517bc510c0d1d3d8c", [:rebar3], [{:grpcbox, ">= 0.0.0", [hex: :grpcbox, repo: "hexpm", optional: false]}, {:opentelemetry, "~> 1.3", [hex: :opentelemetry, repo: "hexpm", optional: false]}, {:opentelemetry_api, "~> 1.2", [hex: :opentelemetry_api, repo: "hexpm", optional: false]}, {:tls_certificate_check, "~> 1.18", [hex: :tls_certificate_check, repo: "hexpm", optional: false]}], "hexpm", "1802d1dca297e46f21e5832ecf843c451121e875f73f04db87355a6cb2ba1710"}, "opentelemetry_semantic_conventions": {:hex, :opentelemetry_semantic_conventions, "0.2.0", "b67fe459c2938fcab341cb0951c44860c62347c005ace1b50f8402576f241435", [:mix, :rebar3], [], "hexpm", "d61fa1f5639ee8668d74b527e6806e0503efc55a42db7b5f39939d84c07d6895"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, - "telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"}, + "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, "telemetry_registry": {:hex, :telemetry_registry, "0.3.0", "6768f151ea53fc0fbca70dbff5b20a8d663ee4e0c0b2ae589590e08658e76f1e", [:mix, :rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "492e2adbc609f3e79ece7f29fec363a97a2c484ac78a83098535d6564781e917"}, "tls_certificate_check": {:hex, :tls_certificate_check, "1.19.0", "c76c4c5d79ee79a2b11c84f910c825d6f024a78427c854f515748e9bd025e987", [:rebar3], [{:ssl_verify_fun, "~> 1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "4083b4a298add534c96125337cb01161c358bb32dd870d5a893aae685fd91d70"}, } diff --git a/utilities/opentelemetry_telemetry/rebar.config b/utilities/opentelemetry_telemetry/rebar.config index 32251bf2..faba560b 100644 --- a/utilities/opentelemetry_telemetry/rebar.config +++ b/utilities/opentelemetry_telemetry/rebar.config @@ -1,8 +1,7 @@ {erl_opts, [debug_info]}. {deps, [ {opentelemetry_api, "~> 1.0"}, - {telemetry, "~> 1.0"}, - {telemetry_registry, "~> 0.3.0"} + {telemetry, "~> 1.0"} ]}. {project_plugins, [covertool, @@ -17,8 +16,7 @@ {test, [{erl_opts, [nowarn_export_all]}, {deps, [ {opentelemetry, "~> 1.0"}, - {opentelemetry_exporter, "~> 1.0"}, - {test_app, "~> 0.1"} + {opentelemetry_exporter, "~> 1.0"} ]}, {paths, ["src", "test/support"]}, {ct_opts, [{ct_hooks, [cth_surefire]}]}]}]}. diff --git a/utilities/opentelemetry_telemetry/rebar.lock b/utilities/opentelemetry_telemetry/rebar.lock index 76b89f40..c1686a9c 100644 --- a/utilities/opentelemetry_telemetry/rebar.lock +++ b/utilities/opentelemetry_telemetry/rebar.lock @@ -1,14 +1,16 @@ {"1.2.0", -[{<<"opentelemetry_api">>,{pkg,<<"opentelemetry_api">>,<<"1.0.2">>},0}, - {<<"telemetry">>,{pkg,<<"telemetry">>,<<"1.1.0">>},0}, - {<<"telemetry_registry">>,{pkg,<<"telemetry_registry">>,<<"0.3.0">>},0}]}. +[{<<"opentelemetry_api">>,{pkg,<<"opentelemetry_api">>,<<"1.2.2">>},0}, + {<<"opentelemetry_semantic_conventions">>, + {pkg,<<"opentelemetry_semantic_conventions">>,<<"0.2.0">>}, + 1}, + {<<"telemetry">>,{pkg,<<"telemetry">>,<<"1.2.1">>},0}]}. [ {pkg_hash,[ - {<<"opentelemetry_api">>, <<"91353EE40583B1D4F07D7B13ED62642ABFEC6AAA0D8A2114F07EDAFB2DF781C5">>}, - {<<"telemetry">>, <<"A589817034A27EAB11144AD24D5C0F9FAB1F58173274B1E9BAE7074AF9CBEE51">>}, - {<<"telemetry_registry">>, <<"6768F151EA53FC0FBCA70DBFF5B20A8D663EE4E0C0B2AE589590E08658E76F1E">>}]}, + {<<"opentelemetry_api">>, <<"693F47B0D8C76DA2095FE858204CFD6350C27FE85D00E4B763DEECC9588CF27A">>}, + {<<"opentelemetry_semantic_conventions">>, <<"B67FE459C2938FCAB341CB0951C44860C62347C005ACE1B50F8402576F241435">>}, + {<<"telemetry">>, <<"68FDFE8D8F05A8428483A97D7AAB2F268AAFF24B49E0F599FAA091F1D4E7F61C">>}]}, {pkg_hash_ext,[ - {<<"opentelemetry_api">>, <<"2A8247F85C44216B883900067478D59955D11E58E5CFCA7C884CD4F203ACE3AC">>}, - {<<"telemetry">>, <<"B727B2A1F75614774CFF2D7565B64D0DFA5BD52BA517F16543E6FC7EFCC0DF48">>}, - {<<"telemetry_registry">>, <<"492E2ADBC609F3E79ECE7F29FEC363A97A2C484AC78A83098535D6564781E917">>}]} + {<<"opentelemetry_api">>, <<"DC77B9A00F137A858E60A852F14007BB66EDA1FFBEB6C05D5FE6C9E678B05E9D">>}, + {<<"opentelemetry_semantic_conventions">>, <<"D61FA1F5639EE8668D74B527E6806E0503EFC55A42DB7B5F39939D84C07D6895">>}, + {<<"telemetry">>, <<"DAD9CE9D8EFFC621708F99EAC538EF1CBE05D6A874DD741DE2E689C47FEAFED5">>}]} ]. diff --git a/utilities/opentelemetry_telemetry/src/opentelemetry_telemetry.app.src b/utilities/opentelemetry_telemetry/src/opentelemetry_telemetry.app.src index 5bfd5a8c..69018592 100644 --- a/utilities/opentelemetry_telemetry/src/opentelemetry_telemetry.app.src +++ b/utilities/opentelemetry_telemetry/src/opentelemetry_telemetry.app.src @@ -7,8 +7,7 @@ stdlib, opentelemetry, opentelemetry_api, - telemetry, - telemetry_registry + telemetry ]}, {env,[]}, {modules, []}, diff --git a/utilities/opentelemetry_telemetry/src/otel_telemetry.erl b/utilities/opentelemetry_telemetry/src/otel_telemetry.erl index 9c1beee2..b4671a5a 100644 --- a/utilities/opentelemetry_telemetry/src/otel_telemetry.erl +++ b/utilities/opentelemetry_telemetry/src/otel_telemetry.erl @@ -1,5 +1,6 @@ -module(otel_telemetry). +-include_lib("kernel/include/logger.hrl"). -include_lib("opentelemetry_api/include/opentelemetry.hrl"). -export([ @@ -8,9 +9,8 @@ handle_event/4, start_telemetry_span/4, set_current_telemetry_span/2, - end_telemetry_span/2, - trace_application/1, - trace_application/2]). + end_telemetry_span/2 +]). -type telemetry_span_ctx() :: opentelemetry:span_ctx(). -type parent_span_ctx() :: opentelemetry:span_ctx(). @@ -25,16 +25,6 @@ init(Application) -> init(_Application, _Opts) -> ok. -trace_application(Application) -> - trace_application(Application, []). - -trace_application(Application, _Opts) -> - _ = telemetry_registry:discover_all([Application]), - AllEvents = telemetry_registry:list_events(), - SpannableEvents = telemetry_registry:spannable_events(), - _ = register_event_handlers(SpannableEvents, AllEvents), - ok. - -spec start_telemetry_span(atom(), opentelemetry:span_name(), telemetry:event_metadata(), otel_span:start_opts()) -> opentelemetry:span_ctx(). start_telemetry_span(TracerId, SpanName, EventMetadata, Opts) -> ParentCtx = otel_tracer:current_span_ctx(), @@ -125,29 +115,6 @@ pop_from_tracer_stack(TracerId) -> SpanCtxSet end. -register_event_handlers(SpannableEvents, AllEvents) -> - lists:foldl(fun ({Prefix, Suffixes}, Handlers) -> - TracerId = tracer_id_for_events(Prefix, Suffixes, AllEvents), - NewHandlers = [attach_handler(Prefix, Suffix, TracerId) - || Suffix <- Suffixes], - NewHandlers ++ Handlers - end, - [], - SpannableEvents). - -attach_handler(Prefix, Suffix, TracerId) -> - Event = Prefix ++ [Suffix], - SpanName = list_to_binary(lists:join("_", - [atom_to_binary(Segment, utf8) || Segment <- Prefix])), - Config = #{tracer_id => TracerId, type => Suffix, span_name => SpanName}, - Handler = fun ?MODULE:handle_event/4, - telemetry:attach({?MODULE, Event}, Event, Handler, Config). - -tracer_id_for_events(Prefix, [Suffix | _], AllEvents) -> - Event = Prefix ++ [Suffix], - {Event, Module, _Metadata} = lists:keyfind(Event, 1, AllEvents), - Module. - handle_event(_Event, _Measurements, Metadata, diff --git a/utilities/opentelemetry_telemetry/test/otel_telemetry_SUITE.erl b/utilities/opentelemetry_telemetry/test/otel_telemetry_SUITE.erl index f7865161..2cb91553 100644 --- a/utilities/opentelemetry_telemetry/test/otel_telemetry_SUITE.erl +++ b/utilities/opentelemetry_telemetry/test/otel_telemetry_SUITE.erl @@ -24,17 +24,13 @@ end_per_suite(_Config) -> init_per_testcase(_, Config) -> {ok, _} = application:ensure_all_started(telemetry), - {ok, _} = application:ensure_all_started(telemetry_registry), - {ok, _} = application:ensure_all_started(test_app), {ok, _} = application:ensure_all_started(opentelemetry_telemetry), otel_batch_processor:set_exporter(otel_exporter_pid, self()), - otel_telemetry:trace_application(test_app), + attach_event_handlers(), Config. end_per_testcase(_, Config) -> application:stop(telemetry), - application:stop(telemetry_registry), - application:stop(test_app), application:stop(opentelemetry_telemetry), application:stop(opentelemetry), Config. @@ -42,9 +38,9 @@ end_per_testcase(_, Config) -> telemetry_span_handling(_Config) -> SpanCtx1 = ?start_span(<<"span-1">>), ?set_current_span(SpanCtx1), - _Result = test_app:handler(ok), + _Result = handler(ok), ?assertMatch(SpanCtx1, ?current_span_ctx), - try test_app:handler(raise_exception) of + try handler(raise_exception) of _ -> ok catch error:badarg -> ok @@ -72,11 +68,80 @@ successful_span_listener(Name) -> exception_span_listener(Name) -> receive - {span, #span{name=Name,events=Events,status=Status,parent_span_id=ParentId,span_id=Id}} -> - ?assertEqual({status,error,<<"badarg">>}, Status), + {span, #span{name=Name,events=Events,status={status,error,Reason},parent_span_id=ParentId,span_id=Id} = Span} -> + ?assertEqual(<<"badarg">>, Reason), ?assertEqual(1, erlang:length(otel_events:list(Events))), {Id, ParentId} after 5000 -> error(timeout) end. + +handler(Args) -> + _ = telemetry:span( + [test_app, handler], + #{}, + fun() -> + case Args of + raise_exception -> + binary_to_list("heh, already a list"); + _ -> {nested_span(), #{}} + end + end). + +nested_span() -> + _ = telemetry:span( + [test_app, nested_span], + #{}, + fun() -> + {ok, #{}} + end). + +-define(TRACER_ID, ?MODULE). + +attach_event_handlers() -> + Events = [ + [test_app, handler, start], + [test_app, handler, stop], + [test_app, handler, exception], + [test_app, nested_span, start], + [test_app, nested_span, stop], + [test_app, nested_span, exception] + ], + telemetry:attach_many(otel_telemetry_test_handlers, Events, fun ?TRACER_ID:handle_event/4, #{}). + +handle_event([test_app, handler, start], _, Meta, _) -> + otel_telemetry:start_telemetry_span(?TRACER_ID, <<"test_app_handler">>, Meta, #{}); + +handle_event([test_app, handler, stop], _, Meta, _) -> + otel_telemetry:set_current_telemetry_span(?TRACER_ID, Meta), + otel_telemetry:end_telemetry_span(?TRACER_ID, Meta); + +handle_event([test_app, handler, exception], _, Meta, _) -> + Ctx = otel_telemetry:set_current_telemetry_span(?TRACER_ID, Meta), + #{ + kind := Kind, + reason := Reason, + stacktrace := Stacktrace + } = Meta, + otel_span:record_exception(Ctx, Kind, Reason, Stacktrace, []), + otel_span:set_status(Ctx, opentelemetry:status(?OTEL_STATUS_ERROR, atom_to_binary(Reason))), + otel_telemetry:end_telemetry_span(?TRACER_ID, Meta); + +handle_event([test_app, nested_span, start], _, Meta, _) -> + otel_telemetry:start_telemetry_span(?TRACER_ID, <<"test_app_nested_span">>, Meta, #{}); + +handle_event([test_app, nested_span, stop], _, Meta, _) -> + otel_telemetry:set_current_telemetry_span(?TRACER_ID, Meta), + otel_telemetry:end_telemetry_span(?TRACER_ID, Meta); + +handle_event([test_app, nested_span, exception], _, Meta, _) -> + Ctx = otel_telemetry:set_current_telemetry_span(?TRACER_ID, Meta), + #{ + kind := Kind, + reason := Reason, + stacktrace := Stacktrace + } = Meta, + otel_span:set_status(Ctx, opentelemetry:status(?OTEL_STATUS_ERROR, <<"">>)), + otel_span:record_exception(Ctx, Kind, Reason, Stacktrace, []), + otel_telemetry:end_telemetry_span(?TRACER_ID, Meta).