ZIO Telemetry is a purely functional, type-safe client for distributed tracing, metrics, logs, and baggage in ZIO applications. Its main module wraps OpenTelemetry; older modules wrap OpenTracing and OpenCensus, both deprecated upstream.
In a monolith, a request starts, passes through a few components, and finishes in one place. In a distributed system, the story of a request is spread across many services, and no single log tells it. Distributed tracing connects those pieces: every service records spans that share a trace, and the trace context travels between services with the request. ZIO Telemetry lets a ZIO effect be the scope of a span, correlates metrics and logs with the surrounding span, and propagates context across service boundaries.
The OpenTelemetry module is all most applications need. It is published for the JVM only, for Scala 2.12, 2.13, and 3:
libraryDependencies ++= Seq(
// ZIO Telemetry for OpenTelemetry (JVM, Scala 2.12, 2.13, 3)
"dev.zio" %% "zio-opentelemetry" % "3.1.22"
)The module depends only on the OpenTelemetry API. To produce and export signals, an application also needs the OpenTelemetry SDK and an exporter; see Getting Started for a working setup.
The remaining modules are optional.
To add trace and span ids to ZIO Logging output, use the logging integration:
libraryDependencies ++= Seq(
// Span and trace id log formats for ZIO Logging (JVM, Scala 2.12, 2.13, 3)
"dev.zio" %% "zio-opentelemetry-zio-logging" % "3.1.22"
)See OpenTelemetry ZIO Logging.
OpenTracing is archived and OpenCensus is deprecated upstream, and new applications should use the OpenTelemetry module. These modules remain for existing code:
libraryDependencies ++= Seq(
// ZIO Telemetry for OpenTracing (JVM, Scala 2.12, 2.13, 3)
"dev.zio" %% "zio-opentracing" % "3.1.22",
// ZIO Telemetry for OpenCensus (JVM, Scala 2.12, 2.13, 3)
"dev.zio" %% "zio-opencensus" % "3.1.22"
)See OpenTracing and OpenCensus.
Learn more on the ZIO Telemetry homepage!
For the general guidelines, see ZIO contributor's guide.
See the Code of Conduct