Scala OpenTelemetry Setup Guide

SigNoz Cloud - This page applies to SigNoz Cloud editions.
Self-Host - This page applies to self-hosted SigNoz editions.

This guide walks you through instrumenting your Scala application with OpenTelemetry and sending traces to SigNoz. Scala runs on the JVM, so the OpenTelemetry Java agent works directly—no additional SDK or Scala-specific library required.

Prerequisites

Auto-instrumented frameworks

The OpenTelemetry Java agent instruments these Scala frameworks automatically—no code changes required:

FrameworkMin versionWhat's instrumented
Play MVC2.4HTTP routes, controller spans
Play WS1.0HTTP client spans and metrics
Akka HTTP10.0Server spans, client spans, metrics, routes
Akka Actors2.3Context propagation
Apache Pekko1.0Context propagation, HTTP instrumentation
ZIO2.0Context propagation
ZIO HTTP3.0Route span naming
Scala ForkJoinPool2.8Context propagation

See the full supported libraries list for all frameworks and versions.

Send traces to SigNoz

Step 1. Download the OpenTelemetry Java agent

wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar

Step 2. Set environment variables

export OTEL_RESOURCE_ATTRIBUTES="service.name=<service-name>,service.version=<service-version>"
export OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.<region>.signoz.cloud:443"
export OTEL_EXPORTER_OTLP_HEADERS="signoz-ingestion-key=<your-ingestion-key>"
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_METRICS_EXPORTER="none"
export OTEL_LOGS_EXPORTER="none"

Verify these values:

  • <region>: Your SigNoz Cloud region.
  • <your-ingestion-key>: Your SigNoz ingestion key.
  • <service-name>: A descriptive name for your service (e.g., checkout-service).
  • <service-version> (optional): Your release version, image tag, or git SHA (e.g., 1.4.2, a01dbef8).

Set service.version to a per-build value, not a static string. SigNoz detects a deployment each time this value changes. Common sources:

  • Bash / shell: service.version=$(git rev-parse --short HEAD)
  • GitHub Actions: service.version=${{ github.sha }}
  • GitLab CI: service.version=$CI_COMMIT_SHORT_SHA
  • Kubernetes: inject from your Helm chart image tag or CI variable

Step 3. Run your application

SBT (recommended)

SBT runs tasks in the same JVM process by default, so the agent can't attach. Enable forking in your build.sbt:

build.sbt
fork := true
run / javaOptions += "-javaagent:/path/to/opentelemetry-javaagent.jar"

Then run:

sbt run

Assembly or fat JAR

If you package your application with sbt-assembly or a similar plugin, attach the agent at startup:

java -javaagent:./opentelemetry-javaagent.jar -jar your-app-assembly.jar

Validate

With your application running, verify traces are flowing to SigNoz:

  1. Send a few requests to your application.
  2. In SigNoz, open the Services tab and click Refresh. Your service should appear.
  3. Go to the Traces tab to see your application's traces.

Troubleshooting

No traces in SigNoz after sbt run

The most common cause: SBT shares its JVM with your application by default, so the agent flag in javaOptions has no effect.

Fix: add fork := true to your build.sbt:

build.sbt
fork := true
run / javaOptions += "-javaagent:/path/to/opentelemetry-javaagent.jar"

Traces not showing up in SigNoz

Check environment variables:

echo $OTEL_EXPORTER_OTLP_ENDPOINT
echo $OTEL_RESOURCE_ATTRIBUTES

Enable debug logging:

OTEL_LOG_LEVEL=debug java -javaagent:./opentelemetry-javaagent.jar -jar app.jar

Look for span output in stdout. If spans appear locally but not in SigNoz, check your endpoint URL and ingestion key.

Test connectivity:

curl -v https://ingest.<region>.signoz.cloud:443/v1/traces

"Sharing is only supported for boot loader classes" warning

SBT prints this as [error] but it is harmless:

[error] OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

The Java agent modifies the bootstrap classpath, which disables JVM class-data sharing (CDS). It does not affect instrumentation or trace collection.

Agent not attaching

Make sure -javaagent comes before -jar:

# Correct
java -javaagent:./agent.jar -jar app.jar

# Wrong — agent flag after -jar is ignored
java -jar app.jar -javaagent:./agent.jar

Setup OpenTelemetry Collector (Optional)

The Collector sits between your app and SigNoz. Your app sends traces to the Collector, which then forwards them to SigNoz. Use it to filter noisy spans, redact sensitive data, or fan out to multiple backends.

See Switch from direct export to Collector for setup instructions.

Next steps

Get Help

If you need help with the steps in this topic, please reach out to us on SigNoz Community Slack.

If you are a SigNoz Cloud user, please use in product chat support located at the bottom right corner of your SigNoz instance or contact us at cloud-support@signoz.io.

Last updated: May 19, 2026

Edit on GitHub

Was this page helpful?

Your response helps us improve this page.