Telepoison

Telepoison is a opentelemetry-instrumented wrapper around HTTPPoison.

Usage

Simply replace HTTPoison with Telepoison when calling one of the request methods (get(), get!(), post(), request(), etc.)

# before
HTTPoison.get!(url, headers, opts)

# after
Telepoison.get!(url, headers, opts)

Additionally, telepoison adds some options that can be passed in the opts HTTPoison argument to set OpenTelemetry-related stuff. These start with :ot_

Example:

Telepoison.get!(
  "en.wikipedia.org",
  [],
  ot_span_name: "fetch wikipedia homepage",
  ot_attributes: [{"wikipedia.language", "en"}]
)

How it works

Telepoison, when executing an HTTP request to an external service, creates an OpenTelemetry span, injects the trace context propagation headers in the request headers, and ends the span once the response is received. It automatically sets some of the HTTP span attributes like http.status, http.host etc, based on the request and response data.

Telepoison by itself is not particularly useful: it becomes useful when used in conjuction with a "server-side" opentelemetry-instrumented library, e.g. opentelemetry_plug. These do the opposite work: they take the trace context information from the request headers, and they create a SERVER span which becomes the currently active span.

Using the two libraries together, it's possible to propagate trace information across several microservices and through HTTP "jumps".

Keep in mind

What's missing