From c5e8b883ea0bdbd12a83fff52aa11df55f99607f Mon Sep 17 00:00:00 2001 From: Alex Loukissas Date: Thu, 8 Aug 2024 12:49:20 +0300 Subject: [PATCH] feat: merge start metadata in stop metadata, include attempts --- lib/stripe/api.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/stripe/api.ex b/lib/stripe/api.ex index d642f0d91..864f367ad 100644 --- a/lib/stripe/api.ex +++ b/lib/stripe/api.ex @@ -376,11 +376,13 @@ defmodule Stripe.API do end defp do_perform_request_and_retry(method, url, headers, body, opts, {:attempts, attempts}) do + start_metadata = %{url: url, method: method, attempts: attempts} + response = - :telemetry.span(~w[stripe request]a, %{url: url, method: method}, fn -> + :telemetry.span(~w[stripe request]a, start_metadata, fn -> case http_module().request(method, url, Map.to_list(headers), body, opts) do {:ok, status, _, _} = resp -> - {resp, %{status: status}} + {resp, Map.merge(start_metadata, %{status: status})} error -> {error, %{}}