Introduction to ZIO Telemetry
ZIO telemetry is purely-functional and type-safe. It provides clients for OpenTracing, OpenCensus and OpenTelemetry.
ZIO Telemetry consists of the following projects:
Introduction​
In monolithic architecture, everything is in one place, and we know when a request starts and then how it goes through the components and when it finishes. We can obviously see what is happening with our request and where is it going. But, in distributed systems like microservice architecture, we cannot find out the story of a request through various services easily. This is where distributed tracing comes into play.
ZIO Telemetry is a purely functional client which helps up propagate context between services in a distributed environment.
Installation​
In order to use this library, we need to add the following line in our build.sbt
file if we want to use OpenTelemetry client:
libraryDependencies += "dev.zio" %% "zio-opentelemetry" % "<version>"
If you're using ZIO Logging you can combine OpenTelemetry with ZIO Logging using:
libraryDependencies += "dev.zio" %% "zio-opentelemetry-zio-logging" % "<version>"
For using OpenTracing client we should add the following line in our build.sbt
file:
libraryDependencies += "dev.zio" %% "zio-opentracing" % "<version>"
And for using OpenCensus client we should add the following line in our build.sbt
file:
libraryDependencies += "dev.zio" %% "zio-opencensus" % "<version>"
Examples​
You can find examples with full source code and instructions of how to run by following the links:
- OpenTelemetry Example
- OpenTelemetry Instrumentation Example
- OpenTelemetry ZIO Logging Example
- OpenTracing Example
Articles​
- Trace your microservices with ZIO by Marek Kadek (September 2021)