Skip to content

Commit

Permalink
feat: merge start metadata in stop metadata, include attempts (#850)
Browse files Browse the repository at this point in the history
  • Loading branch information
aloukissas authored Aug 8, 2024
1 parent 44cf0e4 commit 7207c02
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/stripe/api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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, %{}}
Expand Down

0 comments on commit 7207c02

Please sign in to comment.