Skip to content

Commit

Permalink
Telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
Georgy Sychev authored and gsychev committed Sep 6, 2023
1 parent 9fcb839 commit 47fb328
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/stripe/api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,16 @@ defmodule Stripe.API do
end

defp do_perform_request_and_retry(method, url, headers, body, opts, {:attempts, attempts}) do
response = http_module().request(method, url, headers |> Map.to_list(), body, opts)
response =
:telemetry.span(~w[stripe request]a, %{url: url, method: method}, fn ->
case http_module().request(method, url, Map.to_list(headers), body, opts) do
{:ok, status, _, _} = resp ->
{resp, %{status: status}}

error ->
{error, %{}}
end
end)

do_perform_request_and_retry(
method,
Expand Down

0 comments on commit 47fb328

Please sign in to comment.