-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move telemetry tests to use message based helper from Bandit * Use async tests
- Loading branch information
Showing
8 changed files
with
251 additions
and
263 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
defmodule TelemetryHelpers do | ||
@moduledoc false | ||
|
||
@events [ | ||
[:thousand_island, :listener, :start], | ||
[:thousand_island, :listener, :stop], | ||
[:thousand_island, :acceptor, :start], | ||
[:thousand_island, :acceptor, :stop], | ||
[:thousand_island, :acceptor, :spawn_error], | ||
[:thousand_island, :acceptor, :econnaborted], | ||
[:thousand_island, :connection, :start], | ||
[:thousand_island, :connection, :stop], | ||
[:thousand_island, :connection, :ready], | ||
[:thousand_island, :connection, :async_recv], | ||
[:thousand_island, :connection, :recv], | ||
[:thousand_island, :connection, :recv_error], | ||
[:thousand_island, :connection, :send], | ||
[:thousand_island, :connection, :send_error], | ||
[:thousand_island, :connection, :sendfile], | ||
[:thousand_island, :connection, :sendfile_error], | ||
[:thousand_island, :connection, :socket_shutdown] | ||
] | ||
|
||
def attach_all_events(handler) do | ||
ref = make_ref() | ||
_ = :telemetry.attach_many(ref, @events, &__MODULE__.handle_event/4, {self(), handler}) | ||
fn -> :telemetry.detach(ref) end | ||
end | ||
|
||
def handle_event(event, measurements, %{handler: handler} = metadata, {pid, handler}), | ||
do: send(pid, {:telemetry, event, measurements, metadata}) | ||
|
||
def handle_event(_event, _measurements, _metadata, {_pid, _handler}), do: :ok | ||
end |
Oops, something went wrong.