SigNoz Cloud - This page is relevant for SigNoz Cloud editions.
Self-Host - This page is relevant for self-hosted SigNoz editions.

Java / Spring Boot OpenTelemetry Instrumentation

This guide walks you through instrumenting your Java or Spring Boot application with OpenTelemetry and sending traces to SigNoz. The Java agent handles most popular libraries and frameworks automatically—Spring, JDBC, HTTP clients, message queues, and more.

Prerequisites

  • Java 8 or higher
  • A SigNoz Cloud account or self-hosted SigNoz instance

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>"
export OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.<region>.signoz.cloud:443"
export OTEL_EXPORTER_OTLP_HEADERS="signoz-ingestion-key=<your-ingestion-key>"

Replace the following:

  • <region>: Your SigNoz Cloud region (us, eu, or in). See endpoints.
  • <your-ingestion-key>: Your SigNoz ingestion key.
  • <service-name>: A descriptive name for your service (e.g., payment-service).

Step 3. Run your application

For Spring Boot applications:

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

For generic Java applications, you can also pass config as system properties:

java -javaagent:./opentelemetry-javaagent.jar \
  -Dotel.service.name=my-service \
  -Dotel.exporter.otlp.endpoint=https://ingest.us.signoz.cloud:443 \
  -Dotel.exporter.otlp.headers=signoz-ingestion-key=<key> \
  -jar your-app.jar

Validate

With your application running, verify traces are being sent to SigNoz:

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

Troubleshooting

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

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

Configuring the agent (Optional)

What can you configure?

The Java agent auto-instruments most libraries out of the box. Configuration lets you fine-tune what gets captured and how traces are exported.

Why configure?

  • Reduce noise — Disable instrumentation for internal health checks or chatty libraries
  • Control costs — Sample a percentage of traces instead of capturing everything
  • Add context — Tag traces with environment, version, or team info for easier filtering

Common options

Disable specific instrumentations:

-Dotel.instrumentation.jdbc-datasource.enabled=false

Some instrumentations are disabled by default because they're noisy:

  • jdbc-datasource — creates spans for every DataSource.getConnection() call
  • dropwizard-metrics — limited attribute support in Dropwizard's metrics API

Sample traces:

export OTEL_TRACES_SAMPLER=parentbased_traceidratio
export OTEL_TRACES_SAMPLER_ARG=0.1  # Sample 10% of traces

Add resource attributes:

export OTEL_RESOURCE_ATTRIBUTES="service.name=my-app,deployment.environment=production,service.version=1.2.3"

See the full configuration reference for all available options.

Setup OpenTelemetry Collector (Optional)

What is the OpenTelemetry Collector?

The Collector sits between your app and SigNoz. Your app sends traces to the Collector, which then forwards them to SigNoz.

Why use it?

  • Filter and transform - Drop noisy traces or redact sensitive data before it leaves your network
  • Reduce app overhead - Let the Collector handle batching, retries, and compression
  • Add metadata - Automatically tag traces with Kubernetes pod info, cloud region, etc.
  • Multi-backend - Send to multiple observability tools without changing your app

See Switch from direct export to Collector for setup instructions.

Next steps

Sample applications:

Last updated: January 3, 2026

Edit on GitHub

Was this page helpful?