From 47fb328604e7db9bee6b21980ca52f8ec2158397 Mon Sep 17 00:00:00 2001 From: Georgy Sychev Date: Tue, 5 Sep 2023 20:48:14 +0400 Subject: [PATCH] Telemetry --- lib/stripe/api.ex | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/stripe/api.ex b/lib/stripe/api.ex index cbb3981a..d642f0d9 100644 --- a/lib/stripe/api.ex +++ b/lib/stripe/api.ex @@ -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,