Skip to content
This repository has been archived by the owner on Oct 15, 2021. It is now read-only.

Commit

Permalink
Update opentelemetry deps to version 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
GDegrove committed Dec 9, 2020
1 parent 809b760 commit fc7cfb2
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 24 deletions.
6 changes: 3 additions & 3 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ config :opentelemetry_ecto,

config :opentelemetry_ecto, OpentelemetryEcto.TestRepo,
hostname: "localhost",
username: "postgres",
username: "postrgres",
database: "opentelemetry_ecto_test",
pool: Ecto.Adapters.SQL.Sandbox

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}}]
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 8 additions & 8 deletions lib/opentelemetry_ecto.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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]}
Expand Down
6 changes: 3 additions & 3 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
}
5 changes: 2 additions & 3 deletions test/opentelemetry_ecto_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit fc7cfb2

Please sign in to comment.