Tesla.Middleware.Tapper

Build StatusHex.pmDocumentation

https://github.com/Financial-Times/tapper distributed request tracing integration for Tesla.

Installation

The package can be installed by adding tesla_middleware_tapper to your list of dependencies in mix.exs:

If you are using Tesla version 0.x:

def deps do
  [
    {:tesla_middleware_tapper, "~> 0.1.0"}
  ]
end

If you are using Tesla version 1.0 or higher

def deps do
  [
    {:tesla_middleware_tapper, "~> 0.2.0"}
  ]
end

Documentation can be found at https://hexdocs.pm/tesla_middleware_tapper.

Usage

First add and configure https://github.com/Financial-Times/tapper. After that you only need to add plug Tesla.Middleware.Tapper when you wish to trace outgoing http requests.

defmodule CartService do
  use Tesla

  plug Tesla.Middleware.BaseUrl, "https://cart.example.com"
  plug Tesla.Middleware.Headers, [{"authorization", "token xyz"}]
  plug Tesla.Middleware.JSON
  plug Tesla.Middleware.Tapper

  def fetch_items() do
    get("/items")
  end
end

License

MIT License, Copyright (c) 2018 SaleMove