opentelemetry-erlang-contrib/instrumentation/opentelemetry_tesla
Guilherme de Maio 901b571b07
[opentelemetry_tesla] Conditionally override propagator (#176)
* Optionally disable trace propagation for Tesla

While we always want spans being produced, trace progation is not
desirable in all cases - namely, when calling external parties, as that
may leak sensitive information, like one present on Baggage.

This patch introduces a new option `:propagate`, that defaults to
`true`.

Some tweaks are made to existing propagation test, fixing how options
are used. The approach here is closer to what we see in some middleware
tests of Tesla itself.

* change to propagator override

* change propagator to it uses global default

* mix format

* improve docs

---------

Co-authored-by: Andrew Rosa <dev@andrewhr.io>
2023-05-29 04:53:21 -06:00
..
lib/middleware [opentelemetry_tesla] Conditionally override propagator (#176) 2023-05-29 04:53:21 -06:00
test [opentelemetry_tesla] Conditionally override propagator (#176) 2023-05-29 04:53:21 -06:00
.formatter.exs Fix CI errors, update GHA deps, update versions (#125) 2022-11-15 16:22:28 -07:00
LICENSE Add otel tesla library (#90) 2022-08-25 12:47:59 -06:00
README.md Make exdocs settings a bit more similar between different packages (#168) 2023-04-30 12:10:03 -06:00
mix.exs Make exdocs settings a bit more similar between different packages (#168) 2023-04-30 12:10:03 -06:00
mix.lock Phoenix Plug.Cowboy adapter support (#144) 2023-01-06 13:46:06 -07:00

README.md

OpenTelemetryTesla

Tesla middleware that creates OpenTelemetry spans and injects tracing headers into HTTP requests for Tesla clients.

Installation

The package is available in Hex and can be installed by adding opentelemetry_tesla to your list of dependencies in mix.exs:

def deps do
  [
    {:opentelemetry_tesla, "~> 2.1.0"}
  ]
end

Setup

Whilst using this middleware is as simple as adding it to your Tesla middlewares configuration, It's very important to set the correct order of the middlewares

The is crucial to correctly get the parameterized version of the URL, something like /api/users/:id instead of /api/users/3.

OpenTelemetry comes first, PathParams (if you're using it) comes after.

Tesla.Middleware.OpenTelemetry
Tesla.Middleware.PathParams