http4s-otel4s-middleware
OpenTelemetry metrics and tracing for http4s clients and servers, built on otel4s. Record spans and metrics for streaming requests and responses. Request and response body effects keep the HTTP context, even when they run later.
Start here
- Getting started: add dependencies and send your first request.
- Client instrumentation or Server instrumentation: wrap your client or app.
- Streaming lifecycle: learn when requests finish and where to place the middleware.
Choose a module
| Need | Artifact suffix | Entry point |
|---|---|---|
| Client metrics and tracing | client |
ClientInstrumentation |
| Server metrics and tracing | server |
ServerInstrumentation |
| Client metrics only | metrics-client |
ClientMetrics |
| Server metrics only | metrics-server |
ServerMetrics |
| Client tracing only | trace-client |
ClientMiddleware |
| Server tracing only | trace-server |
ServerMiddleware |
All artifact names start with http4s-otel4s-middleware-. Scala 2.13 and Scala 3 are supported
on JVM, Scala.js and Scala Native. Choose a telemetry backend that supports your platform. The
OtelJava example in this guide runs on the JVM.
Explore
- Metrics: available metrics, body sizes, labels and links to traces.
- Tracing and propagation: context, span attributes and redaction.
- Filtering and errors: choose which requests to record and which responses count as errors.
- Lifecycle explorer: watch spans, metrics and headers change one step at a time.
Source and API reference: GitHub ยท API reference.