From 7c77b7cffd0c7f3d8f9d93080801cd847d13a4e4 Mon Sep 17 00:00:00 2001 From: Marc Delagrammatikas Date: Sat, 28 Oct 2023 21:13:44 -0700 Subject: [PATCH 01/14] fixes a bug where the attribute prefix was being added twice --- lib/open_telemetry_decorator/attributes.ex | 7 ++++- test/open_telemetry_decorator_test.exs | 32 +++++++++++++--------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/lib/open_telemetry_decorator/attributes.ex b/lib/open_telemetry_decorator/attributes.ex index f250a39..89e574b 100644 --- a/lib/open_telemetry_decorator/attributes.ex +++ b/lib/open_telemetry_decorator/attributes.ex @@ -86,7 +86,12 @@ defmodule OpenTelemetryDecorator.Attributes do defp prefix_name(name) when is_binary(name) do prefix = Application.get_env(:open_telemetry_decorator, :attr_prefix) || "" - String.to_atom(prefix <> name) + + if String.starts_with?(name, prefix) do + String.to_atom(name) + else + String.to_atom(prefix <> name) + end end defp remove_underscore(name) when is_atom(name) do diff --git a/test/open_telemetry_decorator_test.exs b/test/open_telemetry_decorator_test.exs index 279e292..1a5ef08 100644 --- a/test/open_telemetry_decorator_test.exs +++ b/test/open_telemetry_decorator_test.exs @@ -6,13 +6,19 @@ defmodule OpenTelemetryDecoratorTest do setup [:otel_pid_reporter] - describe "trace" do + describe "with_span" do setup do prev = Application.get_env(:open_telemetry_decorator, :attr_joiner) Application.put_env(:open_telemetry_decorator, :attr_joiner, "_") on_exit(fn -> Application.put_env(:open_telemetry_decorator, :attr_joiner, prev) end) end + setup do + prev = Application.get_env(:open_telemetry_decorator, :attr_prefix) + Application.put_env(:open_telemetry_decorator, :attr_prefix, "app.") + on_exit(fn -> Application.put_env(:open_telemetry_decorator, :attr_prefix, prev) end) + end + defmodule Example do use OpenTelemetryDecorator @@ -73,7 +79,7 @@ defmodule OpenTelemetryDecoratorTest do attributes: attrs )} - assert %{"count" => 2} = get_span_attributes(attrs) + assert %{"app.count" => 2} = get_span_attributes(attrs) assert_receive {:span, span( @@ -82,7 +88,7 @@ defmodule OpenTelemetryDecoratorTest do attributes: attrs )} - assert %{"id" => 1} = get_span_attributes(attrs) + assert %{"app.id" => 1} = get_span_attributes(attrs) assert_receive {:span, span( @@ -91,37 +97,37 @@ defmodule OpenTelemetryDecoratorTest do attributes: attrs )} - assert %{"id" => 2} = get_span_attributes(attrs) + assert %{"app.id" => 2} = get_span_attributes(attrs) end test "handles simple attributes" do Example.find(1) assert_receive {:span, span(name: "Example.find", attributes: attrs)} - assert %{"id" => 1} = get_span_attributes(attrs) + assert %{"app.id" => 1} = get_span_attributes(attrs) end test "handles nested attributes" do Example.find(1) assert_receive {:span, span(name: "Example.find", attributes: attrs)} - assert %{"user_name" => "my user"} = get_span_attributes(attrs) + assert %{"app.user_name" => "my user"} = get_span_attributes(attrs) end test "handles maps with string keys" do Example.parse_params(%{"id" => 12}) assert_receive {:span, span(name: "Example.parse_params", attributes: attrs)} - assert %{"params_id" => 12} = get_span_attributes(attrs) + assert %{"app.params_id" => 12} = get_span_attributes(attrs) end test "handles handles underscored attributes" do Example.find(2) assert_receive {:span, span(name: "Example.find", attributes: attrs)} - assert %{"even" => true} = get_span_attributes(attrs) + assert %{"app.even" => true} = get_span_attributes(attrs) end test "converts atoms to strings" do Example.step(:two) assert_receive {:span, span(name: "Example.step", attributes: attrs)} - assert %{"id" => ":two"} = get_span_attributes(attrs) + assert %{"app.id" => ":two"} = get_span_attributes(attrs) end test "does not include result unless asked for" do @@ -151,7 +157,7 @@ defmodule OpenTelemetryDecoratorTest do assert {:ok, 3} = OverwriteExample.param_override(1, 1) assert_receive {:span, span(name: "param_override", attributes: attrs)} - assert Map.get(get_span_attributes(attrs), "x") == 1 + assert Map.get(get_span_attributes(attrs), "app.x") == 1 end test "overwrites the default result value" do @@ -166,7 +172,7 @@ defmodule OpenTelemetryDecoratorTest do ExampleResult.add(5, 5) assert_receive {:span, span(name: "ExampleResult.add", attributes: attrs)} - assert Map.get(get_span_attributes(attrs), "result") == 10 + assert Map.get(get_span_attributes(attrs), "app.result") == 10 end test "supports nested results" do @@ -181,7 +187,7 @@ defmodule OpenTelemetryDecoratorTest do NestedResult.make_struct(5, 5) assert_receive {:span, span(name: "ExampleResult.make_struct", attributes: attrs)} - assert Map.get(get_span_attributes(attrs), "result_sum") == 10 + assert Map.get(get_span_attributes(attrs), "app.result_sum") == 10 end test "does not include anything unless specified" do @@ -208,7 +214,7 @@ defmodule OpenTelemetryDecoratorTest do flunk("Should have re-raised a File.read!/1 exception") rescue _ -> - expected = %{"file_name" => "fake file"} + expected = %{"app.file_name" => "fake file"} assert_receive {:span, span(name: "Example.with_exception", attributes: attrs)} assert get_span_attributes(attrs) == expected end From e38b5c2cd41fbe1bf9b1a3a1215eb44ece4da0da Mon Sep 17 00:00:00 2001 From: Marc Delagrammatikas Date: Sat, 28 Oct 2023 21:20:26 -0700 Subject: [PATCH 02/14] bump dialyxir, ex_doc, and excoveralls versions --- mix.exs | 2 +- mix.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mix.exs b/mix.exs index feb01ae..f95bc24 100644 --- a/mix.exs +++ b/mix.exs @@ -40,7 +40,7 @@ defmodule OpenTelemetryDecorator.MixProject do {:decorator, "~> 1.4"}, {:dialyxir, "~> 1.2", only: :dev, runtime: false}, {:ex_doc, "~> 0.30.3", only: :dev, runtime: false}, - {:excoveralls, "~> 0.17.0", only: :test, runtime: false}, + {:excoveralls, "~> 0.18.0", only: :test, runtime: false}, {:opentelemetry_exporter, "~> 1.4", only: :test}, {:opentelemetry_api, "~> 1.2"}, {:opentelemetry, "~> 1.3", only: :test} diff --git a/mix.lock b/mix.lock index e5ac554..a0d74ec 100644 --- a/mix.lock +++ b/mix.lock @@ -6,11 +6,11 @@ "credo": {:hex, :credo, "1.7.1", "6e26bbcc9e22eefbff7e43188e69924e78818e2fe6282487d0703652bc20fd62", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e9871c6095a4c0381c89b6aa98bc6260a8ba6addccf7f6a53da8849c748a58a2"}, "ctx": {:hex, :ctx, "0.6.0", "8ff88b70e6400c4df90142e7f130625b82086077a45364a78d208ed3ed53c7fe", [:rebar3], [], "hexpm", "a14ed2d1b67723dbebbe423b28d7615eb0bdcba6ff28f2d1f1b0a7e1d4aa5fc2"}, "decorator": {:hex, :decorator, "1.4.0", "a57ac32c823ea7e4e67f5af56412d12b33274661bb7640ec7fc882f8d23ac419", [:mix], [], "hexpm", "0a07cedd9083da875c7418dea95b78361197cf2bf3211d743f6f7ce39656597f"}, - "dialyxir": {:hex, :dialyxir, "1.4.1", "a22ed1e7bd3a3e3f197b68d806ef66acb61ee8f57b3ac85fc5d57354c5482a93", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "84b795d6d7796297cca5a3118444b80c7d94f7ce247d49886e7c291e1ae49801"}, + "dialyxir": {:hex, :dialyxir, "1.4.2", "764a6e8e7a354f0ba95d58418178d486065ead1f69ad89782817c296d0d746a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "516603d8067b2fd585319e4b13d3674ad4f314a5902ba8130cd97dc902ce6bbd"}, "earmark_parser": {:hex, :earmark_parser, "1.4.37", "2ad73550e27c8946648b06905a57e4d454e4d7229c2dafa72a0348c99d8be5f7", [:mix], [], "hexpm", "6b19783f2802f039806f375610faa22da130b8edc21209d0bff47918bb48360e"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, - "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"}, - "excoveralls": {:hex, :excoveralls, "0.17.1", "83fa7906ef23aa7fc8ad7ee469c357a63b1b3d55dd701ff5b9ce1f72442b2874", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "95bc6fda953e84c60f14da4a198880336205464e75383ec0f570180567985ae0"}, + "ex_doc": {:hex, :ex_doc, "0.30.9", "d691453495c47434c0f2052b08dd91cc32bc4e1a218f86884563448ee2502dd2", [: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", "d7aaaf21e95dc5cddabf89063327e96867d00013963eadf2c6ad135506a8bc10"}, + "excoveralls": {:hex, :excoveralls, "0.18.0", "b92497e69465dc51bc37a6422226ee690ab437e4c06877e836f1c18daeb35da9", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "1109bb911f3cb583401760be49c02cbbd16aed66ea9509fc5479335d284da60b"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, "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"}, From 46df322c9ee55538ccc10ccdb2d193bd83376331 Mon Sep 17 00:00:00 2001 From: Marc Delagrammatikas Date: Sat, 28 Oct 2023 21:44:04 -0700 Subject: [PATCH 03/14] remove unused dependencies --- Makefile | 1 + mix.lock | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index b5ae8e2..604e7a4 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ TEST := $(shell find test -name \*.ex) check: _build/dev _build/test mix test mix credo --strict + mix deps.unlock --check-unused mix hex.outdated mix dialyzer mix format diff --git a/mix.lock b/mix.lock index a0d74ec..2bf804d 100644 --- a/mix.lock +++ b/mix.lock @@ -1,7 +1,6 @@ %{ "acceptor_pool": {:hex, :acceptor_pool, "1.0.0", "43c20d2acae35f0c2bcd64f9d2bde267e459f0f3fd23dab26485bf518c281b21", [:rebar3], [], "hexpm", "0cbcd83fdc8b9ad2eee2067ef8b91a14858a5883cb7cd800e6fcd5803e158788"}, "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, - "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, "chatterbox": {:hex, :ts_chatterbox, "0.13.0", "6f059d97bcaa758b8ea6fffe2b3b81362bd06b639d3ea2bb088335511d691ebf", [:rebar3], [{:hpack, "~> 0.2.3", [hex: :hpack_erl, repo: "hexpm", optional: false]}], "hexpm", "b93d19104d86af0b3f2566c4cba2a57d2e06d103728246ba1ac6c3c0ff010aa7"}, "credo": {:hex, :credo, "1.7.1", "6e26bbcc9e22eefbff7e43188e69924e78818e2fe6282487d0703652bc20fd62", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e9871c6095a4c0381c89b6aa98bc6260a8ba6addccf7f6a53da8849c748a58a2"}, "ctx": {:hex, :ctx, "0.6.0", "8ff88b70e6400c4df90142e7f130625b82086077a45364a78d208ed3ed53c7fe", [:rebar3], [], "hexpm", "a14ed2d1b67723dbebbe423b28d7615eb0bdcba6ff28f2d1f1b0a7e1d4aa5fc2"}, @@ -14,22 +13,16 @@ "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, "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"}, - "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~> 2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, "hpack": {:hex, :hpack_erl, "0.2.3", "17670f83ff984ae6cd74b1c456edde906d27ff013740ee4d9efaa4f1bf999633", [:rebar3], [], "hexpm", "06f580167c4b8b8a6429040df36cc93bba6d571faeaec1b28816523379cbb23a"}, - "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, "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.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"}, - "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, - "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, "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"}, - "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, - "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"}, - "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, + "tls_certificate_check": {:hex, :tls_certificate_check, "1.20.0", "1ac0c53f95e201feb8d398ef9d764ae74175231289d89f166ba88a7f50cd8e73", [:rebar3], [{:ssl_verify_fun, "~> 1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "ab57b74b1a63dc5775650699a3ec032ec0065005eff1f020818742b7312a8426"}, } From 825b27fa1a7e4385433655b8912db6f552debc9b Mon Sep 17 00:00:00 2001 From: Marc Delagrammatikas Date: Sat, 28 Oct 2023 21:59:04 -0700 Subject: [PATCH 04/14] v1.4.7 --- CHANGELOG.md | 4 ++++ mix.exs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7369092..3dde873 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # OpenTelemetryDecorator +## v1.4.7 +- Fixes a bug causing the attribute prefix to be appended twice when using the include option +- Update and remove unused dependencies + ## v1.4.6 - Updates dependencies, notably minor versions of the opentelemetry api and sdk ```shell diff --git a/mix.exs b/mix.exs index f95bc24..fdf3efb 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule OpenTelemetryDecorator.MixProject do use Mix.Project - @version "1.4.6" + @version "1.4.7" @github_page "https://github.com/marcdel/open_telemetry_decorator" def project do From 64abb0899fb2e4be64f2ab218f2f6b1f1f43248f Mon Sep 17 00:00:00 2001 From: Jeff Deville Date: Mon, 6 Nov 2023 17:01:37 -0500 Subject: [PATCH 05/14] update tool-versions --- .tool-versions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.tool-versions b/.tool-versions index 60f0fd0..fa9578d 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -elixir 1.14.4 -erlang 25.3.1 \ No newline at end of file +elixir 1.15.7-otp-25 +erlang 25.3.1 From c96839fc09dc7ecf8fc7f371b509cbb1ba6c5eac Mon Sep 17 00:00:00 2001 From: Jeff Deville Date: Mon, 6 Nov 2023 17:02:20 -0500 Subject: [PATCH 06/14] add .history/ to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6ff06dc..39ec585 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,5 @@ open_telemetry_decorator-*.tar # Intellij nonsense .idea/ -*.iml \ No newline at end of file +*.iml +.history/ From 66f3455ce46c06b12095a1ed9d7086150b46163b Mon Sep 17 00:00:00 2001 From: Jeff Deville Date: Mon, 6 Nov 2023 17:20:39 -0500 Subject: [PATCH 07/14] Make tests synchronous Creating/Destroying the otel_exporter_pid for each test was not cooperating with all the tests running simultaneously. Almost certainly due to the race condition in OtelHlper.otel_pid_reporter altering the global state to configure where the spans were being sent Co-authored-by: Gray --- test/open_telemetry_decorator_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/open_telemetry_decorator_test.exs b/test/open_telemetry_decorator_test.exs index 1a5ef08..0a4d853 100644 --- a/test/open_telemetry_decorator_test.exs +++ b/test/open_telemetry_decorator_test.exs @@ -1,5 +1,5 @@ defmodule OpenTelemetryDecoratorTest do - use ExUnit.Case, async: true + use ExUnit.Case, async: false use OtelHelper doctest OpenTelemetryDecorator From b0a39cf426506a3e91a19b4901abf013077d932e Mon Sep 17 00:00:00 2001 From: Jeff Deville Date: Mon, 6 Nov 2023 17:29:57 -0500 Subject: [PATCH 08/14] Allow user to specify the span.kind in the with_span decorator --- lib/open_telemetry_decorator.ex | 10 ++++- test/open_telemetry_decorator_test.exs | 55 ++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/lib/open_telemetry_decorator.ex b/lib/open_telemetry_decorator.ex index e48ac51..12da208 100644 --- a/lib/open_telemetry_decorator.ex +++ b/lib/open_telemetry_decorator.ex @@ -40,13 +40,14 @@ defmodule OpenTelemetryDecorator do """ def with_span(span_name, opts \\ [], body, context) do include = Keyword.get(opts, :include, []) + kind = get_kind(opts) Validator.validate_args(span_name, include) quote location: :keep do require OpenTelemetry.Tracer, as: Tracer require OpenTelemetry.Span, as: Span - Tracer.with_span unquote(span_name) do + Tracer.with_span unquote(span_name), %{kind: unquote(kind)} do span_context = Tracer.current_span_ctx() input_params = @@ -83,4 +84,11 @@ defmodule OpenTelemetryDecorator do target = "#{inspect(context.module)}.#{context.name}/#{context.arity} @decorate telemetry" reraise %ArgumentError{message: "#{target} #{e.message}"}, __STACKTRACE__ end + + def get_kind(opts) do + case Keyword.get(opts, :kind, :internal) do + kind when kind in [:internal, :server, :client, :producer, :consumer] -> kind + _ -> :internal + end + end end diff --git a/test/open_telemetry_decorator_test.exs b/test/open_telemetry_decorator_test.exs index 0a4d853..119fcdb 100644 --- a/test/open_telemetry_decorator_test.exs +++ b/test/open_telemetry_decorator_test.exs @@ -239,5 +239,60 @@ defmodule OpenTelemetryDecoratorTest do expected = %{"error" => "ruh roh!"} assert get_span_attributes(attrs) == expected end + + test "can set the span.kind on the span" do + defmodule SpanKinds do + use OpenTelemetryDecorator + + @decorate with_span("SpanKinds.producer", kind: :producer) + def producer() do + :ok + end + + @decorate with_span("SpanKinds.consumer", kind: :consumer) + def consumer() do + :ok + end + + @decorate with_span("SpanKinds.internal", kind: :internal) + def internal() do + :ok + end + + @decorate with_span("SpanKinds.client", kind: :client) + def client() do + :ok + end + + @decorate with_span("SpanKinds.server", kind: :server) + def server() do + :ok + end + + @decorate with_span("SpanKinds.invalid", kind: :invalid) + def invalid() do + :ok + end + end + + SpanKinds.producer() + assert_receive {:span, span(name: "SpanKinds.producer", kind: :producer)} + + SpanKinds.consumer() + assert_receive {:span, span(name: "SpanKinds.consumer", kind: :consumer)} + + SpanKinds.client() + assert_receive {:span, span(name: "SpanKinds.client", kind: :client)} + + SpanKinds.server() + assert_receive {:span, span(name: "SpanKinds.server", kind: :server)} + + SpanKinds.internal() + assert_receive {:span, span(name: "SpanKinds.internal", kind: :internal)} + + # using an invalid span.kind will default to :internal + SpanKinds.invalid() + assert_receive {:span, span(name: "SpanKinds.invalid", kind: :internal)} + end end end From ab0ad10f8ba50f6ebcf1822d046a566ecd037583 Mon Sep 17 00:00:00 2001 From: Jeff Deville Date: Tue, 7 Nov 2023 12:49:50 -0500 Subject: [PATCH 09/14] Stop opentelemetry from starting in test Did this because the first test was always failing Co-authored-by: Gray --- test/open_telemetry_decorator/attributes_test.exs | 2 +- test/test_helper.exs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/open_telemetry_decorator/attributes_test.exs b/test/open_telemetry_decorator/attributes_test.exs index d3eb269..e6c2ba9 100644 --- a/test/open_telemetry_decorator/attributes_test.exs +++ b/test/open_telemetry_decorator/attributes_test.exs @@ -1,5 +1,5 @@ defmodule OpenTelemetryDecorator.AttributesTest do - use ExUnit.Case, async: true + use ExUnit.Case, async: false use OtelHelper alias OpenTelemetryDecorator.Attributes diff --git a/test/test_helper.exs b/test/test_helper.exs index 869559e..6b8ecd6 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1 +1,3 @@ +Application.stop(:opentelemetry) +Application.unload(:opentelemetry) ExUnit.start() From b57dbc9276666b4491c356319f064b141dfcf89b Mon Sep 17 00:00:00 2001 From: Jeff Deville Date: Tue, 7 Nov 2023 12:50:41 -0500 Subject: [PATCH 10/14] Added the ability to set span attributes in the decorator --- lib/open_telemetry_decorator.ex | 3 +++ test/open_telemetry_decorator_test.exs | 35 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/lib/open_telemetry_decorator.ex b/lib/open_telemetry_decorator.ex index 12da208..2eae002 100644 --- a/lib/open_telemetry_decorator.ex +++ b/lib/open_telemetry_decorator.ex @@ -41,6 +41,8 @@ defmodule OpenTelemetryDecorator do def with_span(span_name, opts \\ [], body, context) do include = Keyword.get(opts, :include, []) kind = get_kind(opts) + decorator_attributes = Keyword.get(opts, :attributes, []) + Validator.validate_args(span_name, include) quote location: :keep do @@ -69,6 +71,7 @@ defmodule OpenTelemetryDecorator do # Called functions can mess up Tracer's current span context, so ensure we at least write to ours Attributes.set(span_context, attrs) + Attributes.set(span_context, unquote(decorator_attributes)) result rescue diff --git a/test/open_telemetry_decorator_test.exs b/test/open_telemetry_decorator_test.exs index 119fcdb..fafe662 100644 --- a/test/open_telemetry_decorator_test.exs +++ b/test/open_telemetry_decorator_test.exs @@ -63,6 +63,21 @@ defmodule OpenTelemetryDecoratorTest do @decorate with_span("Example.with_error") def with_error, do: OpenTelemetryDecorator.Attributes.set(:error, "ruh roh!") + + @decorate with_span("Example.with_attributes", attributes: [foo: "bar", baz: "qux"]) + def with_attributes, do: :ok + + @decorate with_span("Example.with_attrs_and_include", + attributes: [foo: "bar", baz: "qux"], + include: [:opts] + ) + def with_attrs_and_include(opts), do: {:ok, opts} + + @decorate with_span("Example.with_attrs_and_conflicts", + attributes: [foo: "bar"], + include: [:foo] + ) + def with_attrs_and_conflicts(foo), do: {:ok, foo} end test "does not modify inputs or function result" do @@ -294,5 +309,25 @@ defmodule OpenTelemetryDecoratorTest do SpanKinds.invalid() assert_receive {:span, span(name: "SpanKinds.invalid", kind: :internal)} end + + test "can set attributes on the span" do + Example.with_attributes() + assert_receive {:span, span(name: "Example.with_attributes", attributes: attrs)} + assert %{"app.baz" => "qux", "app.foo" => "bar"} == get_span_attributes(attrs) + end + + test "can set attributes and input params on the span" do + Example.with_attrs_and_include(:include_me) + assert_receive {:span, span(name: "Example.with_attrs_and_include", attributes: attrs)} + + assert %{"app.baz" => "qux", "app.foo" => "bar", "app.opts" => ":include_me"} == + get_span_attributes(attrs) + end + + test "can set attributes and input params on the span, where attributes win with conflicting names" do + Example.with_attrs_and_conflicts("not_bar") + assert_receive {:span, span(name: "Example.with_attrs_and_conflicts", attributes: attrs)} + assert %{"app.foo" => "bar"} == get_span_attributes(attrs) + end end end From 5927bd083b5874b7eee88f12a224a07165ae1c29 Mon Sep 17 00:00:00 2001 From: Jeff Deville Date: Mon, 6 Nov 2023 17:38:13 -0500 Subject: [PATCH 11/14] Squashed commit of the following: commit 6eea73289a70174a6f4bf5c730a0eb2024561299 Merge: 30b17ec b37f1b1 Author: Kevin Tayah Date: Mon Oct 23 10:07:42 2023 -0400 Merge branch 'feature/add-expand-all-maps-opt' commit b37f1b1c37e61b5d5adad8743194048b8927874a Author: Kevin Tayah Date: Sat Oct 21 11:34:58 2023 -0400 Added default to expand_maps commit 30b17ec091affb0a7b69c493ae445fa657afdbe6 Merge: af35d6e 299d0f6 Author: Kevin Tayah Date: Mon Oct 16 11:05:48 2023 -0400 Merge branch 'feature/add-expand-all-maps-opt' commit af35d6e1c0d48ea94ea939b8ca31f22f7f0b2f9e Author: Kevin Tayah <32495802+ktayah@users.noreply.github.com> Date: Sun Oct 15 19:47:12 2023 -0400 Feature/add expand all maps opt (#1) * Add ability to expand_all_maps from requested_attributes * Add test for with_span w/ expand_map option * Add documentation * Fix error introduced * Format commit 299d0f6adf78b4b24cc4d14af1a8d58a9e25b203 Author: Kevin Tayah Date: Sun Oct 15 19:42:59 2023 -0400 Format commit 012c8a240c74e657d470771357b1b08b38bb5545 Author: Kevin Tayah Date: Sun Oct 15 19:42:56 2023 -0400 Fix error introduced commit c759d36631bb5154043852bc17dd41bff01bb19a Author: Kevin Tayah Date: Sun Oct 15 19:41:33 2023 -0400 Add documentation commit 66fa9957e5f6947b96e6caf80eecdb9f8717a23d Author: Kevin Tayah Date: Sun Oct 15 16:03:00 2023 -0400 Add test for with_span w/ expand_map option commit 6e853491bbd774e6e96f82b0773c706c5f50743b Author: Kevin Tayah Date: Sun Oct 15 15:46:01 2023 -0400 Add ability to expand_all_maps from requested_attributes --- README.md | 21 ++++++++++++++++ config/config.exs | 1 + lib/open_telemetry_decorator.ex | 8 ++++--- lib/open_telemetry_decorator/attributes.ex | 24 +++++++++++++++---- .../attributes_test.exs | 21 ++++++++++++++++ test/open_telemetry_decorator_test.exs | 20 ++++++++++++++++ 6 files changed, 88 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a50a76d..30d494f 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,13 @@ config :open_telemetry_decorator, attr_joiner: "." ``` Thanks to @benregn for the examples and inspiration for these two options! + +### Changing the default behavior for expanding nested maps +By default, nested attributes need to be explicitly selected in the `with_span/3` macro (See additional examples to see this in action). However if you want the default behavior across your application to always expand variables that are maps/structs, you can specify the following config +```elixir +config :open_telemetry_decorator, expand_maps: true +``` + ### Additional Examples @@ -176,6 +183,20 @@ defmodule MyApp.Worker do end ``` +Grab all nested map/struct properties: + +```elixir +defmodule MyApp.Worker do + use OpenTelemetryDecorator + + @decorate with_span("my_app.worker.do_work", include: [:arg1, :arg2], expand_maps: true) + def do_work(arg1, arg2) do + total = some_calculation(arg1.count, arg2.count) + {:ok, total} + end +end +``` + ```elixir defmodule MyApp.Worker do use OpenTelemetryDecorator diff --git a/config/config.exs b/config/config.exs index 41984ff..9205912 100644 --- a/config/config.exs +++ b/config/config.exs @@ -9,6 +9,7 @@ import Config config :open_telemetry_decorator, attr_prefix: "" config :open_telemetry_decorator, attr_joiner: "." +config :open_telemetry_decorator, expand_maps: false # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. diff --git a/lib/open_telemetry_decorator.ex b/lib/open_telemetry_decorator.ex index 2eae002..5552a30 100644 --- a/lib/open_telemetry_decorator.ex +++ b/lib/open_telemetry_decorator.ex @@ -14,6 +14,8 @@ defmodule OpenTelemetryDecorator do alias OpenTelemetryDecorator.Attributes alias OpenTelemetryDecorator.Validator + @default_expand_maps Application.compile_env(:open_telemetry_decorator, :expand_maps, false) + def trace(span_name, opts \\ [], body, context), do: with_span(span_name, opts, body, context) @doc """ @@ -42,7 +44,7 @@ defmodule OpenTelemetryDecorator do include = Keyword.get(opts, :include, []) kind = get_kind(opts) decorator_attributes = Keyword.get(opts, :attributes, []) - + expand_maps = Keyword.get(opts, :expand_maps, @default_expand_maps) Validator.validate_args(span_name, include) quote location: :keep do @@ -54,7 +56,7 @@ defmodule OpenTelemetryDecorator do input_params = Kernel.binding() - |> Attributes.get(unquote(include)) + |> Attributes.get(unquote(include), unquote(expand_maps)) |> Keyword.delete(:result) Attributes.set(input_params) @@ -65,7 +67,7 @@ defmodule OpenTelemetryDecorator do attrs = Kernel.binding() |> Keyword.put(:result, result) - |> Attributes.get(unquote(include)) + |> Attributes.get(unquote(include), unquote(expand_maps)) |> Keyword.merge(input_params) |> Enum.map(fn {k, v} -> {Atom.to_string(k), v} end) diff --git a/lib/open_telemetry_decorator/attributes.ex b/lib/open_telemetry_decorator/attributes.ex index 89e574b..4054e4a 100644 --- a/lib/open_telemetry_decorator/attributes.ex +++ b/lib/open_telemetry_decorator/attributes.ex @@ -27,16 +27,32 @@ defmodule OpenTelemetryDecorator.Attributes do set(Tracer.current_span_ctx(), attributes) end - def get(all_attributes, requested_attributes) do + def get(all_attributes, requested_attributes, expand_maps \\ false) do Enum.reduce(requested_attributes, [], fn requested_attribute, taken_attributes -> - case get_attribute(all_attributes, requested_attribute) do + case get_attribute(all_attributes, requested_attribute, expand_maps) do + attributes when is_list(attributes) -> taken_attributes ++ attributes {name, value} -> Keyword.put(taken_attributes, name, value) _ -> taken_attributes end end) end - defp get_attribute(attributes, [attribute_name | nested_keys]) do + defp get_attribute(attributes, attribute_name, true) do + requested_attribute = recursive_get_in(attributes, List.wrap(attribute_name)) + + if is_map(requested_attribute) do + requested_attribute + |> as_map() + |> Map.keys() + |> Enum.map(&get_attribute(attributes, List.wrap(attribute_name) ++ [&1], true)) + |> Enum.reject(&(&1 == nil)) + |> List.flatten() + else + get_attribute(attributes, attribute_name, false) + end + end + + defp get_attribute(attributes, [attribute_name | nested_keys], false) do requested_obj = attributes |> Keyword.get(attribute_name) |> as_map() if value = recursive_get_in(requested_obj, nested_keys) do @@ -44,7 +60,7 @@ defmodule OpenTelemetryDecorator.Attributes do end end - defp get_attribute(attributes, attribute_name) do + defp get_attribute(attributes, attribute_name, false) do if value = Keyword.get(attributes, attribute_name) do {derived_name(attribute_name), to_otlp_value(value)} end diff --git a/test/open_telemetry_decorator/attributes_test.exs b/test/open_telemetry_decorator/attributes_test.exs index e6c2ba9..27aecb6 100644 --- a/test/open_telemetry_decorator/attributes_test.exs +++ b/test/open_telemetry_decorator/attributes_test.exs @@ -156,12 +156,33 @@ defmodule OpenTelemetryDecorator.AttributesTest do assert Attributes.get([obj: %{id: 1}], [[:obj, :id]]) == [obj_id: 1] end + test "handles expanding map" do + attributes = Attributes.get([obj: %{id: 1, foo: 2}], [:obj], true) + assert {:obj_id, 1} in attributes + assert {:obj_foo, 2} in attributes + + attributes = + Attributes.get( + [obj: %{id: 1, foo: 2, foop: %{id: 3}}, obj_b: %{id: 4}], + [:obj, :obj_b], + true + ) + + assert {:obj_id, 1} in attributes + assert {:obj_foo, 2} in attributes + assert {:obj_foop_id, 3} in attributes + assert {:obj_b_id, 4} in attributes + end + test "handles nested structs" do one_level = %SomeStruct{beep: "boop"} assert Attributes.get([obj: one_level], [[:obj, :beep]]) == [obj_beep: "boop"] two_levels = %SomeStruct{failed: %SomeStruct{count: 3}} assert Attributes.get([obj: two_levels], [[:obj, :failed, :count]]) == [obj_failed_count: 3] + + # Use expand_all_maps functionality + assert Attributes.get([obj: two_levels], [:obj], true) == [obj_failed_count: 3] end test "handles invalid requests for nested structs" do diff --git a/test/open_telemetry_decorator_test.exs b/test/open_telemetry_decorator_test.exs index fafe662..b9085bb 100644 --- a/test/open_telemetry_decorator_test.exs +++ b/test/open_telemetry_decorator_test.exs @@ -45,6 +45,20 @@ defmodule OpenTelemetryDecoratorTest do end end + @decorate with_span("Example.find_expand", include: [:user], expand_maps: true) + def find_expand(id) do + _even = rem(id, 2) == 0 + user = %{id: id, name: "my user"} + + case id do + 1 -> + {:ok, user} + + error -> + {:error, error} + end + end + @decorate with_span("Example.parse_params", include: [[:params, "id"]]) def parse_params(params) do %{"id" => id} = params @@ -127,6 +141,12 @@ defmodule OpenTelemetryDecoratorTest do assert %{"app.user_name" => "my user"} = get_span_attributes(attrs) end + test "handles nested attributes when expand_maps is set" do + Example.find_expand(1) + assert_receive {:span, span(name: "Example.find_expand", attributes: attrs)} + assert %{"app.user_id" => 1, "app.user_name" => "my user"} = get_span_attributes(attrs) + end + test "handles maps with string keys" do Example.parse_params(%{"id" => 12}) assert_receive {:span, span(name: "Example.parse_params", attributes: attrs)} From a542c8fa48cbfefe64a1ec56cee24ff103e095a8 Mon Sep 17 00:00:00 2001 From: leggebroten Date: Fri, 9 Feb 2024 13:41:25 -0700 Subject: [PATCH 12/14] Changed dependencies for `@decorator` --- .tool-versions | 2 +- mix.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.tool-versions b/.tool-versions index fa9578d..95ad2c7 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ +erlang 25.3.2.7 elixir 1.15.7-otp-25 -erlang 25.3.1 diff --git a/mix.exs b/mix.exs index fdf3efb..7c15143 100644 --- a/mix.exs +++ b/mix.exs @@ -37,7 +37,7 @@ defmodule OpenTelemetryDecorator.MixProject do defp deps do [ {:credo, "~> 1.6", only: [:dev, :test], runtime: false}, - {:decorator, "~> 1.4"}, + {:decorator, github: "/withbelay/decorator", tag: "v1.4.1"}, {:dialyxir, "~> 1.2", only: :dev, runtime: false}, {:ex_doc, "~> 0.30.3", only: :dev, runtime: false}, {:excoveralls, "~> 0.18.0", only: :test, runtime: false}, From 8c61d6ca98fe87a3e511e01cfe8786a460889537 Mon Sep 17 00:00:00 2001 From: leggebroten Date: Fri, 9 Feb 2024 13:42:46 -0700 Subject: [PATCH 13/14] Changed dependencies for `@decorator` --- mix.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.lock b/mix.lock index 2bf804d..045e585 100644 --- a/mix.lock +++ b/mix.lock @@ -4,7 +4,7 @@ "chatterbox": {:hex, :ts_chatterbox, "0.13.0", "6f059d97bcaa758b8ea6fffe2b3b81362bd06b639d3ea2bb088335511d691ebf", [:rebar3], [{:hpack, "~> 0.2.3", [hex: :hpack_erl, repo: "hexpm", optional: false]}], "hexpm", "b93d19104d86af0b3f2566c4cba2a57d2e06d103728246ba1ac6c3c0ff010aa7"}, "credo": {:hex, :credo, "1.7.1", "6e26bbcc9e22eefbff7e43188e69924e78818e2fe6282487d0703652bc20fd62", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e9871c6095a4c0381c89b6aa98bc6260a8ba6addccf7f6a53da8849c748a58a2"}, "ctx": {:hex, :ctx, "0.6.0", "8ff88b70e6400c4df90142e7f130625b82086077a45364a78d208ed3ed53c7fe", [:rebar3], [], "hexpm", "a14ed2d1b67723dbebbe423b28d7615eb0bdcba6ff28f2d1f1b0a7e1d4aa5fc2"}, - "decorator": {:hex, :decorator, "1.4.0", "a57ac32c823ea7e4e67f5af56412d12b33274661bb7640ec7fc882f8d23ac419", [:mix], [], "hexpm", "0a07cedd9083da875c7418dea95b78361197cf2bf3211d743f6f7ce39656597f"}, + "decorator": {:git, "https://github.com//withbelay/decorator.git", "4e7022f43987bcbbdbda4013344c6429bb4fed67", [tag: "v1.4.1"]}, "dialyxir": {:hex, :dialyxir, "1.4.2", "764a6e8e7a354f0ba95d58418178d486065ead1f69ad89782817c296d0d746a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "516603d8067b2fd585319e4b13d3674ad4f314a5902ba8130cd97dc902ce6bbd"}, "earmark_parser": {:hex, :earmark_parser, "1.4.37", "2ad73550e27c8946648b06905a57e4d454e4d7229c2dafa72a0348c99d8be5f7", [:mix], [], "hexpm", "6b19783f2802f039806f375610faa22da130b8edc21209d0bff47918bb48360e"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, From fac7d214d92ac58c3b1c760cbf667f6fbeff5e51 Mon Sep 17 00:00:00 2001 From: leggebroten Date: Sun, 11 Feb 2024 17:36:24 -0700 Subject: [PATCH 14/14] Updated `deps` to removed unneeded option --- mix.exs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mix.exs b/mix.exs index 7c15143..5fc6af8 100644 --- a/mix.exs +++ b/mix.exs @@ -36,12 +36,12 @@ defmodule OpenTelemetryDecorator.MixProject do # Run "mix help deps" to learn about dependencies. defp deps do [ - {:credo, "~> 1.6", only: [:dev, :test], runtime: false}, + {:credo, "~> 1.6", only: [:dev, :test]}, {:decorator, github: "/withbelay/decorator", tag: "v1.4.1"}, - {:dialyxir, "~> 1.2", only: :dev, runtime: false}, - {:ex_doc, "~> 0.30.3", only: :dev, runtime: false}, - {:excoveralls, "~> 0.18.0", only: :test, runtime: false}, - {:opentelemetry_exporter, "~> 1.4", only: :test}, + {:dialyxir, "~> 1.2", only: [:dev, :test]}, + {:ex_doc, "~> 0.30.3", only: [:dev, :test]}, + {:excoveralls, "~> 0.18.0", only: [:dev, :test]}, + {:opentelemetry_exporter, "~> 1.4", only: [:dev, :test]}, {:opentelemetry_api, "~> 1.2"}, {:opentelemetry, "~> 1.3", only: :test} ]