-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat: add metadata to telemetry events"
This reverts commit 88846fb.
- Loading branch information
Showing
4 changed files
with
28 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,6 @@ defmodule Stripe.APITest do | |
import Mox | ||
use Stripe.StripeCase | ||
|
||
def telemetry_handler_fn(name, measurements, metadata, _config) do | ||
send(self(), {:telemetry_event, name, measurements, metadata}) | ||
end | ||
|
||
test "works with non existent responses without issue" do | ||
{:error, %Stripe.Error{extra: %{http_status: 404}}} = | ||
Stripe.API.request(%{}, :get, "/", %{}, []) | ||
|
@@ -91,41 +87,6 @@ defmodule Stripe.APITest do | |
end | ||
end | ||
|
||
describe "telemetry" do | ||
test "requests emit :start, :stop telemetry events", %{test: test} do | ||
:telemetry.attach_many( | ||
"#{test}", | ||
[[:stripe, :request, :start], [:stripe, :request, :stop]], | ||
&__MODULE__.telemetry_handler_fn/4, | ||
nil | ||
) | ||
|
||
%{query: ~s|email: "[email protected]"|} | ||
|> Stripe.API.request(:get, "/v1/customers/search", %{}, []) | ||
|
||
assert_received({ | ||
:telemetry_event, | ||
[:stripe, :request, :start], | ||
%{monotonic_time: _}, | ||
%{telemetry_span_context: _} | ||
}) | ||
|
||
assert_received({ | ||
:telemetry_event, | ||
[:stripe, :request, :stop], | ||
%{monotonic_time: _, duration: _}, | ||
%{ | ||
telemetry_span_context: _, | ||
endpoint: "/v1/customers/search", | ||
attempt: 0, | ||
method: :get, | ||
status: 200, | ||
stripe_api_version: _ | ||
} | ||
}) | ||
end | ||
end | ||
|
||
@tag :skip | ||
test "gets default api version" do | ||
Stripe.API.request(%{}, :get, "products", %{}, []) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters