Back to guidesGuide

Use OpenTelemetry Java agent extensions without hiding incident traces

Filter noise, normalize routes, and tune sampling in the Java agent without changing the application or breaking incident investigations.

A practical guide to rolling out OpenTelemetry Java agent extensions with guardrails: baseline, a minimal extension, canary checks, Collector metrics, and proof that errors remain visible.

Created: August 22, 2026

Published: August 22, 2026

Estimated time45 min
LevelAdvanced
Before you startA Java application already instrumented with the OpenTelemetry Java agent
PlatformsLinux / Docker
WhatsAppXLinkedIn

Linux

Build a minimal Java agent extension, run it in a canary, and validate volume, errors, queues, and trace search before promoting it.

JDK 17+Maven or Gradlecurloptional promtoolkubectl if the service runs on Kubernetes
Build the extension
mvn -q -DskipTests=false package
Start the canary with the extension
java -javaagent:/otel/opentelemetry-javaagent.jar -Dotel.javaagent.extensions=/otel/extensions/incident-trace-guardrails.jar -Dotel.service.name=checkout-api -jar app.jar
Check Collector metrics
curl -s localhost:8888/metrics | egrep "otelcol_receiver_accepted_spans|otelcol_exporter_sent_spans|otelcol_exporter_send_failed|otelcol_exporter_queue"

Content locked

This guide requires both steps before full content is available.

  • Click “Like” on this guide.
  • Share on WhatsApp, X, LinkedIn, or copy the link.

Access is automatically unlocked as soon as both steps are completed.