Diagnosing Missing or Malformed HTTP Client Spans in OpenTelemetry Java Auto‑Instrumentation
Missing HTTP client spans in OpenTelemetry Java can stem from agent mis‑configuration, exporter limits, or network issues. This diagnostic guide walks through symptoms, checks, fixes, and escalation steps to help you restore full trace visibility.
13 Jan 2026, 06:14 UTC

What’s the Problem?
When you run a Java service with the OpenTelemetry Java agent, you expect every outbound HTTP call to appear as a client.http span in your trace viewer. In production you may notice:
- No HTTP client spans at all.
- Spans that lack
http.methodorhttp.urlattributes. - Spans that are truncated or missing child spans.
- Spans that are created but never reach the backend.
- High‑volume traffic where many spans are silently dropped.
These symptoms usually point to one of three layers: the agent configuration, the exporter/collector pipeline, or network/credential issues.
Recognizable Symptoms & Causes
| Symptom | Typical Cause |
|---|---|
| No HTTP client spans | Agent not activated or httpclient instrumentation disabled |
Missing attributes (e.g., http.method) | Attribute filters or older instrumentation version |
| Truncated spans or missing children | Exporter batch size or timeout too small; collector buffer overflow |
| Spans never reach backend | Incorrect OTLP endpoint, TLS handshake failure, or missing auth token |
| Spans dropped under load | Collector or exporter buffer overflow; default 512‑span batch size exceeded |
Ordered Diagnostic Checks
- Verify Agent Activation
- Run the application with
OTEL_LOG_LEVEL=debug.java -Dotel.javaagent.enabled=true -Dotel.javaagent.path=/opt/otel-javaagent.jar -jar myapp.jar - Search the logs for
Instrumentation library activatedand confirmclient.httpis listed. - If missing, ensure
OTEL_AUTO_INSTRUMENTATION_ENABLED=trueand that the agent JAR is on the classpath.
- Run the application with
- Check Instrumentation Configuration
- Inspect
OTEL_INSTRUMENTATION_HTTPCLIENT_ENABLED(defaults totrue). - Verify any attribute exclusion patterns, e.g.,
OTEL_INSTRUMENTATION_HTTPCLIENT_ATTRIBUTES_EXCLUDE=*.password, do not striphttp.methodorhttp.url. - If you upgraded the agent, confirm the instrumentation version matches the
otel.instrumentation.httpclient.versionproperty.
- Inspect
- Validate Exporter Settings
- Confirm
OTEL_EXPORTER_OTLP_ENDPOINTpoints to a reachable collector. Test withcurl -v https://$OTEL_EXPORTER_OTLP_ENDPOINT(for HTTPS) orgrpcurl -plaintext $OTEL_EXPORTER_OTLP_ENDPOINT v1.TracesService/Export. - Check TLS handshake: ensure the collector’s certificate is trusted or set
OTEL_EXPORTER_OTLP_INSECURE=truefor local testing. - Review batch size:
OTEL_EXPORTER_OTLP_BATCH_SIZE=512is default. Increase temporarily to1024and watch collector metrics.
- Confirm
- Examine Collector Health
- Run a local OTLP collector with
--log-level debug.otelcol --config otelcol.yaml --log-level debug - Check the collector’s metrics endpoint (
/metrics) forotelcol_exporter_otlp_sent_spans_totalandotelcol_exporter_otlp_failed_spans_total. - Look for
Failed to export spanserrors in the logs indicating network or auth problems.
- Run a local OTLP collector with
- Test a Minimal HTTP Call
- Add a simple
HttpClientrequest in your code or usecurl http://localhost:8080/healthif the service exposes a health endpoint. - Query the trace backend (e.g., Jaeger UI) for a span with
http.method=GETandhttp.url=/health. - If the span appears but attributes are missing, revisit attribute filter settings.
- Add a simple
Fixes Tied to Findings
- Agent not active: Add
-Dotel.javaagent.enabled=trueto the JVM options or setOTEL_AUTO_INSTRUMENTATION_ENABLED=truein the environment. - Instrumentation disabled: Remove or set
OTEL_INSTRUMENTATION_HTTPCLIENT_ENABLED=falsetotrue. - Attribute filters mis‑configured: Clear exclusion patterns or explicitly include
http.methodandhttp.urlviaOTEL_INSTRUMENTATION_HTTPCLIENT_ATTRIBUTES_INCLUDE=http.method,http.url. - Exporter batch too small: Increase
OTEL_EXPORTER_OTLP_BATCH_SIZEand monitor memory usage. Also adjustOTEL_EXPORTER_OTLP_TIMEOUTif network latency is high. OTEL_EXPORTER_OTLP_ENDPOINTwrong or unreachable: Correct the URL, ensure DNS resolution, and verify TLS certificates. If using a token, setOTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer <token>.- Collector buffer overflow: Scale the collector (more workers or larger buffers) or enable
OTEL_EXPORTER_OTLP_BATCH_TIMEOUTto allow larger batches. - High‑volume drop: Enable
OTEL_EXPORTER_OTLP_LOG_LEVEL=debugin the collector, then increaseOTEL_EXPORTER_OTLP_BATCH_SIZEor add a dedicated queue service.
Escalation Criteria
If after completing the above checks the HTTP client spans remain missing or malformed:
- Open a ticket with your observability or DevOps team, providing the agent logs, collector logs, and the environment variables used.
- Include metrics snapshots:
otelcol_exporter_otlp_sent_spans_total,otelcol_exporter_otlp_failed_spans_total, and JVM heap usage. - Request a deeper network trace or a temporary increase in collector resources to capture the missing payload.
Limitations & Practical Checks
- Enabling the agent in production may double the number of spans generated; monitor for increased egress traffic.
- Increasing batch size or buffer limits can raise memory consumption; validate heap metrics during testing.
- Changing the OTLP endpoint or credentials without updating the service’s environment can cause silent failures; always test connectivity with
grpcurlbefore deploying. - Some cloud providers auto‑rotate TLS certificates; if you see handshake errors, verify the collector’s cert chain is up‑to‑date.
Concrete Example
Below is a minimal application.yml snippet that enables HTTP client instrumentation, sets a custom endpoint, and ensures key attributes are exported.
# application.yml
otel:
instrumentation:
httpclient:
enabled: true
attributes:
include: http.method,http.url
exporter:
otlp:
endpoint: https://otel-collector:4317
headers:
Authorization: Bearer <YOUR_TOKEN>
batch-size: 1024
timeout: 30s
Deploy this configuration and restart the service. Verify the span appears in the backend with the expected attributes. If not, follow the diagnostics above.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.