otel4s
Telemetry meets higher-kinded types
otel4s is an OpenTelemetry implementation for Scala. The design goal is to fully and faithfully implement the OpenTelemetry Specification atop Cats Effect.Quickstart
Get up and running with otel4s in minutes
Module structure
Learn about the modular architecture
Tracing guide
Instrument your application with distributed tracing
Metrics guide
Collect and export application metrics
Key features
Simple and idiomatic API
Provides a user-friendly and idiomatic API for telemetry, designed with Typelevel ecosystem best practices. Intuitive interfaces for metrics, tracing, and context propagation.Minimal overhead
The library utilizes metaprogramming techniques to reduce runtime costs and allocations. Near-zero overhead when telemetry is disabled, ensuring production performance is unaffected when tracing or metrics collection is not required.Modularity
A modular architecture allows you to include only the required components:- Core modules - Designed for library instrumentation, offering a lightweight dependency footprint
- Selective integration - Use only the metrics or tracing functionality without requiring the other
Cross-platform
All modules are available for Scala 2.13 and Scala 3. Core modules are available on all platforms: JVM, Scala.js, and Scala Native.OpenTelemetry Java SDK backend
The OTel Java backend utilizes OpenTelemetry Java SDK under the hood, offering production-ready telemetry:- Low memory overhead
- Extensive instrumentation ecosystem
- Well-tested implementation
SDK backend
The SDK backend is implemented in Scala from scratch and available for JVM, Scala.js, and Scala Native. While the implementation is compliant with the OpenTelemetry specification, it remains experimental and some functionality may be lacking.Testkit
A testkit simplifies the validation of telemetry behavior in applications and libraries:- Framework-agnostic, works with any test framework (weaver, munit, scalatest)
- Ideal for testing instrumented applications in end-to-end or unit tests
- Available for OpenTelemetry Java and SDK backends
Platform support
| Module / Platform | JVM | Scala Native | Scala.js |
|---|---|---|---|
otel4s-core | ✅ | ✅ | ✅ |
otel4s-sdk | ✅ | ✅ | ✅ |
otel4s-oteljava | ✅ | ❌ | ❌ |
How to choose a backend
For most cases,otel4s-oteljava is the recommended backend. It utilizes the OpenTelemetry Java library under the hood, allowing you to benefit from various integrations and low memory overhead.
otel4s-sdk is an experimental implementation of the OpenTelemetry specification in pure Scala, available for all platforms: JVM, Scala.js, and Scala Native. However, some features are missing, and the memory overhead may be noticeable.
Status
Get started
Quickstart
Install otel4s and create your first instrumented application
Examples
Explore working examples with Jaeger, Honeycomb, and more
API reference
Browse the complete API documentation
Ecosystem
Discover libraries and integrations