Skip to main content
The SDK modules provide an alternative to the otel4s-oteljava implementation. All modules are implemented in pure Scala and available for all platforms: JVM, Scala Native, and Scala.js.
The SDK implementation remains experimental and some functionality may be lacking.

New Location

The SDK modules have been moved to a separate repository and documentation site.

otel4s-sdk Documentation

Visit the dedicated otel4s-sdk documentation for installation, configuration, and usage guides.

Why Use the SDK Backend?

The pure Scala SDK implementation offers several advantages:

Cross-Platform Support

  • JVM - Full compatibility with Java ecosystem
  • Scala Native - Native executables with minimal overhead
  • Scala.js - Browser-based and Node.js applications

Pure Scala Implementation

  • No Java dependencies required
  • Better integration with Scala ecosystem
  • Idiomatic Scala APIs

Lightweight

  • Minimal dependencies
  • Smaller binary size
  • Suitable for resource-constrained environments

When to Use Each Backend

Use otel4s-oteljava when:

  • Running on the JVM
  • Need access to Java instrumentation ecosystem
  • Require production-ready, battle-tested implementation
  • Want to use the Java Agent for zero-code instrumentation
  • Need to integrate with Java libraries

Use otel4s-sdk when:

  • Targeting Scala Native or Scala.js
  • Want a pure Scala implementation
  • Need cross-platform compatibility
  • Building lightweight services
  • Willing to work with experimental features

Migration Path

The otel4s API remains consistent across backends, making it straightforward to switch:
libraryDependencies ++= Seq(
  "org.typelevel" %% "otel4s-oteljava" % "0.15.0",
  "io.opentelemetry" % "opentelemetry-exporter-otlp" % "1.59.0" % Runtime,
  "io.opentelemetry" % "opentelemetry-sdk-extension-autoconfigure" % "1.59.0" % Runtime
)
The application code using the otel4s API typically requires minimal changes:
import cats.effect.{IO, IOApp}
import org.typelevel.otel4s.trace.Tracer

// This code works with both backends
def program(implicit tracer: Tracer[IO]): IO[Unit] =
  tracer.span("operation").use { span =>
    span.addAttribute("key", "value") >>
      IO.println("Hello, OpenTelemetry!")
  }

Feature Comparison

Featureotel4s-oteljavaotel4s-sdk
PlatformsJVM onlyJVM, Native, Scala.js
StabilityProduction-readyExperimental
Java InteropFull supportLimited
Java AgentSupportedNot supported
DependenciesOpenTelemetry JavaPure Scala
EcosystemJava instrumentationScala-native
Binary SizeLargerSmaller
PerformanceHighly optimizedGood

Getting Started with SDK

For detailed documentation on using the SDK backend, visit:

SDK Overview

Installation and basic usage

SDK Configuration

Configure exporters and processors

Tracing

Implement distributed tracing

Metrics

Collect and export metrics

Platform-Specific Guides

Scala Native

The SDK enables OpenTelemetry for native executables:
  • Minimal runtime overhead
  • Fast startup times
  • Small binary size
  • Suitable for CLI tools and microservices

Scala.js

Run OpenTelemetry in the browser or Node.js:
  • Frontend observability
  • Full-stack tracing
  • Browser performance monitoring
  • Node.js backend services

Community and Support

The SDK backend is actively developed by the Typelevel community:

Next Steps

Visit SDK Documentation

Explore the full SDK documentation

OTel Java Backend

Learn about the JVM-focused backend

Build docs developers (and LLMs) love