diff --git a/lib/absinthe/middleware/batch.ex b/lib/absinthe/middleware/batch.ex index 8e1f2add83..e6334feafc 100644 --- a/lib/absinthe/middleware/batch.ex +++ b/lib/absinthe/middleware/batch.ex @@ -149,8 +149,9 @@ defmodule Absinthe.Middleware.Batch do timeout = Keyword.get(batch_opts, :timeout, 5_000) result = Task.await(task, timeout) - duration = System.monotonic_time() - start_time_mono - emit_stop_event(duration, metadata, result) + end_time_mono = System.monotonic_time() + duration = end_time_mono - start_time_mono + emit_stop_event(duration, end_time_mono, metadata, result) result end) @@ -178,10 +179,10 @@ defmodule Absinthe.Middleware.Batch do metadata end - defp emit_stop_event(duration, metadata, result) do + defp emit_stop_event(duration, end_time_mono, metadata, result) do :telemetry.execute( @batch_stop, - %{duration: duration}, + %{duration: duration, end_time_mono: end_time_mono}, Map.put(metadata, :result, result) ) end diff --git a/lib/absinthe/middleware/telemetry.ex b/lib/absinthe/middleware/telemetry.ex index e85e4c9c72..0bcdec8b72 100644 --- a/lib/absinthe/middleware/telemetry.ex +++ b/lib/absinthe/middleware/telemetry.ex @@ -46,7 +46,7 @@ defmodule Absinthe.Middleware.Telemetry do :telemetry.execute( @field_stop, - %{duration: end_time_mono - start_time_mono}, + %{duration: end_time_mono - start_time_mono, end_time_mono: end_time_mono}, %{ id: id, telemetry_span_context: id, diff --git a/lib/absinthe/phase/telemetry.ex b/lib/absinthe/phase/telemetry.ex index 797da6d8ce..a767816c7b 100644 --- a/lib/absinthe/phase/telemetry.ex +++ b/lib/absinthe/phase/telemetry.ex @@ -58,7 +58,7 @@ defmodule Absinthe.Phase.Telemetry do with %{id: id, start_time_mono: start_time_mono} <- blueprint.telemetry do :telemetry.execute( @subscription_stop, - %{duration: end_time_mono - start_time_mono}, + %{duration: end_time_mono - start_time_mono, end_time_mono: end_time_mono}, %{id: id, telemetry_span_context: id, blueprint: blueprint, options: options} ) end @@ -72,7 +72,7 @@ defmodule Absinthe.Phase.Telemetry do with %{id: id, start_time_mono: start_time_mono} <- blueprint.telemetry do :telemetry.execute( @operation_stop, - %{duration: end_time_mono - start_time_mono}, + %{duration: end_time_mono - start_time_mono, end_time_mono: end_time_mono}, %{id: id, telemetry_span_context: id, blueprint: blueprint, options: options} ) end