From a5958478e493ed0bdbd8214d8edc7e34dbc9dc77 Mon Sep 17 00:00:00 2001 From: Dan Schultzer <1254724+danschultzer@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:39:29 -0800 Subject: [PATCH] Move total time into measurements --- .../opentelemetry_ecto/lib/opentelemetry_ecto.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex b/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex index 6dfc52b8..6ec1be78 100644 --- a/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex +++ b/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex @@ -93,6 +93,7 @@ defmodule OpentelemetryEcto do total_time = measurements.total_time end_time = :opentelemetry.timestamp() start_time = end_time - total_time + measurements = Map.put(measurements, :total_time, total_time) database = repo.config()[:database] url = @@ -130,8 +131,7 @@ defmodule OpentelemetryEcto do :"db.instance" => database, :"db.type" => db_type, unquote(DBAttributes.db_name()) => database, - :"db.url" => url, - :"total_time_#{time_unit}s" => System.convert_time_unit(total_time, :native, time_unit) + :"db.url" => url } db_statement_config = Keyword.get(config, :db_statement, :disabled) @@ -191,7 +191,7 @@ defmodule OpentelemetryEcto do measurements |> Enum.reduce(attributes, fn {k, v}, acc - when not is_nil(v) and k in [:decode_time, :query_time, :queue_time, :idle_time] -> + when not is_nil(v) and k in [:total_time, :decode_time, :query_time, :queue_time, :idle_time] -> Map.put( acc, String.to_atom("#{k}_#{time_unit}s"),