Skip to content

Tesla Middleware for Spandex that supports distributed tracing

Notifications You must be signed in to change notification settings

smartrent/spandex_tesla_distributed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpandexTeslaDistributed

Tesla Middleware for Spandex that supports distributed tracing

Installation

def deps do
  [
    {:spandex_tesla_distributed, github: "smartrent/spandex_tesla_distributed", tag: "0.3.1"}
  ]
end

Add the following to your config.exs where YourApp.Tracer is your implementation of the Spandex.Tracer

config :spandex_tesla_distributed,
  service: :your_app_tesla,
  tracer: YourApp.Tracer

Usage: It's recommended to have SpandexTeslaDistributed as the first middleware in your request.

Tesla.client([
  # SpandexTeslaDistributed should come before the Timeout middleware as that creates an async process which loses the trace context
  {SpandexTeslaDistributed, []},
  {Tesla.Middleware.Timeout, [timeout: timeout]}
])

or as a Plug

  defmodule MyClient do
    use Tesla

    plug SpandexTeslaDistributed, tracer: YourApp.Tracer
  end

About

Tesla Middleware for Spandex that supports distributed tracing

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages