From 462a1e1d52ae1f41d41eaad78ae39e5d99371b90 Mon Sep 17 00:00:00 2001 From: Gil De Grove Date: Wed, 9 Dec 2020 10:37:51 +0100 Subject: [PATCH] Update opentelemetry deps to version 0.5.0 --- config/test.exs | 4 ++-- docker-compose.yml | 4 ++-- lib/opentelemetry_ecto.ex | 16 ++++++++-------- mix.exs | 6 +++--- mix.lock | 6 +++--- test/opentelemetry_ecto_test.exs | 5 ++--- test/test_helper.exs | 4 ++-- 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/config/test.exs b/config/test.exs index 571dc2b..c4517f9 100644 --- a/config/test.exs +++ b/config/test.exs @@ -11,5 +11,5 @@ config :opentelemetry_ecto, OpentelemetryEcto.TestRepo, config :opentelemetry, sampler: {:always_on, %{}}, - tracer: :ot_tracer_default, - processors: [{:ot_batch_processor, %{scheduled_delay_ms: 1}}] + tracer: :otel_tracer_default, + processors: [{:otel_batch_processor, %{scheduled_delay_ms: 1}}] diff --git a/docker-compose.yml b/docker-compose.yml index 1d4e00f..8263969 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,10 @@ -version: '3.7' +version: "3.7" services: postgres: image: circleci/postgres:11.3-alpine-ram environment: - - POSTGRES_USER=otel_ecto + - POSTGRES_USER=postgres - POSTGRES_DB=opentelemetry_ecto_test ports: - 5432:5432 diff --git a/lib/opentelemetry_ecto.ex b/lib/opentelemetry_ecto.ex index b7e622a..9e52456 100644 --- a/lib/opentelemetry_ecto.ex +++ b/lib/opentelemetry_ecto.ex @@ -32,11 +32,12 @@ defmodule OpentelemetryEcto do end @doc false - def handle_event(event, measurements, %{query: query, - source: source, - result: query_result, - repo: repo, - type: type}, config) do + def handle_event( + event, + measurements, + %{query: query, source: source, result: query_result, repo: repo, type: type}, + config + ) do # Doing all this even if the span isn't sampled so the sampler # could technically use the attributes to decide if it should sample or not @@ -96,9 +97,8 @@ defmodule OpentelemetryEcto do {String.to_atom("#{k}_#{time_unit}s"), System.convert_time_unit(v, :native, time_unit)} end) - OpenTelemetry.Tracer.start_span(span_name, %{start_time: start_time, - attributes: attributes ++ base_attributes}) + s = OpenTelemetry.Tracer.start_span(span_name, %{start_time: start_time, attributes: attributes ++ base_attributes}) - OpenTelemetry.Tracer.end_span() + OpenTelemetry.Span.end_span(s) end end diff --git a/mix.exs b/mix.exs index 6dd2084..986aece 100644 --- a/mix.exs +++ b/mix.exs @@ -40,9 +40,9 @@ defmodule OpentelemetryEcto.MixProject do defp deps do [ - {:telemetry, "~> 0.4.0"}, - {:opentelemetry_api, "~> 0.4.1"}, - {:opentelemetry, "~> 0.4.1"}, + {:telemetry, "~> 0.4.2"}, + {:opentelemetry_api, "~> 0.5.0"}, + {:opentelemetry, "~> 0.5.0"}, {:ex_doc, "~> 0.21.0", only: [:dev], runtime: false}, {:ecto_sql, ">= 3.0.0", only: [:test]}, {:postgrex, ">= 0.15.0", only: [:test]} diff --git a/mix.lock b/mix.lock index ee7fd5a..1842761 100644 --- a/mix.lock +++ b/mix.lock @@ -9,8 +9,8 @@ "makeup": {:hex, :makeup, "1.0.1", "82f332e461dc6c79dbd82fbe2a9c10d48ed07146f0a478286e590c83c52010b5", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "49736fe5b66a08d8575bf5321d716bac5da20c8e6b97714fec2bcd6febcfa1f8"}, "makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "d4b316c7222a85bbaa2fd7c6e90e37e953257ad196dc229505137c5e505e9eff"}, "nimble_parsec": {:hex, :nimble_parsec, "0.5.3", "def21c10a9ed70ce22754fdeea0810dafd53c2db3219a0cd54cf5526377af1c6", [:mix], [], "hexpm", "589b5af56f4afca65217a1f3eb3fee7e79b09c40c742fddc1c312b3ac0b3399f"}, - "opentelemetry": {:hex, :opentelemetry, "0.4.1", "519f0e2daa89d1c4a0fb37310db9828ee89181e6cff349f6b1fdbda2fc4441e5", [:rebar3], [{:opentelemetry_api, "~> 0.4.0", [hex: :opentelemetry_api, repo: "hexpm", optional: false]}], "hexpm", "afba124ebe368fd530db30347ec3bf41f489a3d9b245bfd8397d5753b83e3aae"}, - "opentelemetry_api": {:hex, :opentelemetry_api, "0.4.1", "afce47063e099407daa105bf25e2aae75822f3c25b61a213f9328ff40ae6c448", [:mix, :rebar3], [], "hexpm", "7b057ca9bd5f2220d02fe2337630979df27c8d0fefc6eba371fb3cb202eb618e"}, + "opentelemetry": {:hex, :opentelemetry, "0.5.0", "6a7072a6f54b8be07a42dd2aaca1ee0389038681405d0a27c4c5e5325b6c1a82", [:rebar3], [{:opentelemetry_api, "~>0.5.0", [hex: :opentelemetry_api, repo: "hexpm", optional: false]}], "hexpm", "a45261c421240199184d55447108f1d9f49c6b2b0e0e2056aaaa1a1fe77d2eda"}, + "opentelemetry_api": {:hex, :opentelemetry_api, "0.5.0", "29ecaa7bb86df4dbd44b14fd71fd4faadff5c08d178545b66b3861bd350be28a", [:mix, :rebar3], [], "hexpm", "fa3c23198e84d6d1cdb8a4408374c8d73c9d2ee7a9e587a6d539def15851ffad"}, "postgrex": {:hex, :postgrex, "0.15.3", "5806baa8a19a68c4d07c7a624ccdb9b57e89cbc573f1b98099e3741214746ae4", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "4737ce62a31747b4c63c12b20c62307e51bb4fcd730ca0c32c280991e0606c90"}, - "telemetry": {:hex, :telemetry, "0.4.1", "ae2718484892448a24470e6aa341bc847c3277bfb8d4e9289f7474d752c09c7f", [:rebar3], [], "hexpm", "4738382e36a0a9a2b6e25d67c960e40e1a2c95560b9f936d8e29de8cd858480f"}, + "telemetry": {:hex, :telemetry, "0.4.2", "2808c992455e08d6177322f14d3bdb6b625fbcfd233a73505870d8738a2f4599", [:rebar3], [], "hexpm", "2d1419bd9dda6a206d7b5852179511722e2b18812310d304620c7bd92a13fcef"}, } diff --git a/test/opentelemetry_ecto_test.exs b/test/opentelemetry_ecto_test.exs index b26db6a..8b12990 100644 --- a/test/opentelemetry_ecto_test.exs +++ b/test/opentelemetry_ecto_test.exs @@ -8,14 +8,13 @@ defmodule OpentelemetryEctoTest do require Record - for {name, spec} <- Record.extract_all(from_lib: "opentelemetry/include/ot_span.hrl") do + for {name, spec} <- Record.extract_all(from_lib: "opentelemetry/include/otel_span.hrl") do Record.defrecord(name, spec) end setup do :ok = Ecto.Adapters.SQL.Sandbox.checkout(OpentelemetryEcto.TestRepo) - - :ot_batch_processor.set_exporter(:ot_exporter_pid, self()) + :otel_batch_processor.set_exporter(:otel_exporter_pid, self()) OpenTelemetry.Tracer.start_span("test") diff --git a/test/test_helper.exs b/test/test_helper.exs index 2421be6..f3417a8 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,8 +1,8 @@ :application.load(:opentelemetry) -:application.set_env(:opentelemetry, :tracer, :ot_tracer_default) +:application.set_env(:opentelemetry, :tracer, :otel_tracer_default) :application.set_env(:opentelemetry, :processors, [ - {:ot_batch_processor, %{scheduled_delay_ms: 1}} + {:otel_batch_processor, %{scheduled_delay_ms: 1}} ]) Application.ensure_all_started(:opentelemetry)