From 725a891035c4babe493fe0702bdcdc5036e510c7 Mon Sep 17 00:00:00 2001 From: Jonadabe Nascimento Date: Thu, 10 Feb 2022 13:40:52 -0300 Subject: [PATCH] Drop db.type attribute from opentelemetry_ecto --- .../opentelemetry_ecto/lib/opentelemetry_ecto.ex | 9 +-------- .../opentelemetry_ecto/test/opentelemetry_ecto_test.exs | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex b/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex index 91edfaef..b0ad6a3a 100644 --- a/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex +++ b/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex @@ -54,7 +54,7 @@ defmodule OpentelemetryEcto do def handle_event( event, measurements, - %{query: query, source: source, result: query_result, repo: repo, type: type}, + %{query: query, source: source, result: query_result, repo: repo}, config ) do # Doing all this even if the span isn't sampled so the sampler @@ -78,12 +78,6 @@ defmodule OpentelemetryEcto do time_unit = Keyword.get(config, :time_unit, :microsecond) additional_attributes = Keyword.get(config, :additional_attributes, %{}) - db_type = - case type do - :ecto_sql_query -> :sql - _ -> type - end - # TODO: need connection information to complete the required attributes # net.peer.name or net.peer.ip and net.peer.port base_attributes = %{ @@ -91,7 +85,6 @@ defmodule OpentelemetryEcto do "db.name": database, "db.sql.table": source, "db.statement": query, - "db.type": db_type, "total_time_#{time_unit}s": System.convert_time_unit(total_time, :native, time_unit) } diff --git a/instrumentation/opentelemetry_ecto/test/opentelemetry_ecto_test.exs b/instrumentation/opentelemetry_ecto/test/opentelemetry_ecto_test.exs index ad28e61e..18c4348f 100644 --- a/instrumentation/opentelemetry_ecto/test/opentelemetry_ecto_test.exs +++ b/instrumentation/opentelemetry_ecto/test/opentelemetry_ecto_test.exs @@ -53,6 +53,7 @@ defmodule OpentelemetryEctoTest do "db.name": "opentelemetry_ecto_test", "db.sql.table": "users", "db.system": :postgresql, + "db.statement": "SELECT u0.\"id\", u0.\"email\" FROM \"users\" AS u0", decode_time_microseconds: _, query_time_microseconds: _, queue_time_microseconds: _, @@ -116,7 +117,6 @@ defmodule OpentelemetryEctoTest do "db.sql.table": "posts", "db.system": :postgresql, "db.statement": "SELECT p0.\"id\", p0.\"body\", p0.\"user_id\" FROM \"posts\" AS p0", - "db.type": :sql, decode_time_milliseconds: _, query_time_milliseconds: _, queue_time_milliseconds: _,