Tracing integration between tesla and spandex. It leverages telemetry to get the tesla events and trace them with spandex.
The package can be installed
by adding spandex_tesla
to your list of dependencies in mix.exs
:
def deps do
[
{:spandex_tesla, "~> 1.0.0"}
]
end
Configure the correct tracer to be used:
config :spandex_tesla
service: :tesla, # Optional
tracer: MyApp.Tracer, # Required
Include the telemetry middleware in your tesla client:
defmodule MyClient do
use Tesla
plug Tesla.Middleware.Telemetry
end
Attach the telemetry handler:
# in application.ex
:telemetry.attach(
"spandex-tesla-tracer",
[:tesla, :request],
&SpandexTesla.handle_event/4,
nil
)
The docs can be found at https://hexdocs.pm/spandex_tesla.