smartrent / spandex_tesla

Tracing integration between tesla and spandex

Home Page:https://hex.pm/packages/spandex_tesla

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SpandexTesla

Build Status

Tracing integration between tesla and spandex. It leverages telemetry to get the tesla events and trace them with spandex.

Installation

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

Usage

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.

License

Apache License, Version 2.0 © Thiago Santos

About

Tracing integration between tesla and spandex

https://hex.pm/packages/spandex_tesla

License:Other


Languages

Language:Elixir 100.0%