API observability: narrow request failures with traces, metrics, and logs
API observability connects signals so you can explain where latency, errors, or traffic changes arise across a request path and its services—not merely whether a request succeeded. In OpenTelemetry, metrics reveal aggregate changes in service behavior, traces follow a request across services, and logs provide event detail. Correlating them with trace context and consistent route, status, and error attributes makes API incidents easier to narrow.
API observability connects signals so you can explain where latency, errors, or traffic changes arise across a request path and its services—not merely whether a request succeeded. In OpenTelemetry, metrics reveal aggregate changes in service behavior, traces follow a request across services, and logs provide event detail. Correlating them with trace context and consistent route, status, and error attributes makes API incidents easier to narrow.
Give each signal a question
| Signal | Question for API operations | Example |
|---|---|---|
| Metric | How broad and persistent is the problem? | Request rate, error ratio, latency distribution, concurrent requests |
| Trace | Which part of a particular request was slow or failed? | API server → identity service → database span |
| Log | What event or input condition occurred there? | Validation failure, dependency timeout, retry |
Metrics quickly show aggregate state but not an individual cause. Traces show causal paths, but not every request is necessarily collected. Logs record specific events, but without shared context such as trace IDs they are hard to search across services. Use the signals together; none replaces the others.
Connect OpenTelemetry traces to an API
An OpenTelemetry span represents a unit of work and records trace ID, span ID, parent relationship, timestamps, attributes, events, and status. Instrument the inbound server request and outbound HTTP calls so each call has a client span. Request context can cross service boundaries in propagation headers such as W3C Trace Context's traceparent. First verify that existing auto-instrumentation propagates context; custom propagation injects context on the sender and extracts it on the receiver.
Follow OpenTelemetry HTTP semantic conventions. Name server spans with a low-cardinality route template where available, such as GET /orders/{order_id}, rather than a concrete user path like /orders/392817. Concrete IDs create many distinct series or trace groups, increasing aggregation cost and search difficulty. HTTP 5xx responses are generally recorded as span errors; server 4xx responses are not automatically errors because a 404 may be an expected existence check. Interpret errors in application context.
Narrow down an incident
**Find anomalies in metrics.** Compare route-level traffic, error rate, and latency distribution to tell whether the issue affects one path or the whole service. Avoid labels with unbounded values such as request or user IDs.
**Open a slow or failed trace.** Follow the root server span and child spans to find the downstream call consuming time. Distinguish physical HTTP attempts from the logical operation when retries occur.
**Search logs in the same context.** Include trace and span IDs to find related errors and validation outcomes. Incoming trace context can be forged, so validate or ignore it at untrusted boundaries. Never put PII, credentials, or API keys in baggage.
**Interpret HTTP results in context.** Determine whether a 4xx reflects user input or an internal dependency. OpenTelemetry's HTTP conventions recommend not recording intentional cancellation as an error.
**Check collection coverage.** Sampling or export failures may hide traces; absence of a trace alone does not show that a request never ran.
Instrumentation and safety checks
Set service name, environment, and deployment version consistently as resource attributes.
Use stable attributes such as route template, method, status code, and error type; avoid personal identifiers.
Do not capture request/response bodies or every HTTP header by default. They may contain tokens, passwords, or personal data; explicitly select needed fields and apply masking and size limits.
Verify that API metrics and traces use the same context and route conventions by following a known test request in your telemetry interface. This is a recommended check, not a test claimed to have been performed here.
Sources and scope
OpenTelemetry, [Signals](https://opentelemetry.io/docs/concepts/signals/)
OpenTelemetry, [Traces](https://opentelemetry.io/docs/concepts/signals/traces/)
OpenTelemetry, [Context propagation](https://opentelemetry.io/docs/concepts/context-propagation/)
OpenTelemetry, [HTTP semantic conventions](https://opentelemetry.io/docs/specs/semconv/http/http-spans/)
OpenTelemetry, [Logs](https://opentelemetry.io/docs/concepts/signals/logs/)
Based on OpenTelemetry official documentation read on 2026-11-19. Instrumentation support and HTTP semantic-convention migration settings vary by language and version; check the SDK and instrumentation you adopt. This guide covers signal correlation and safe instrumentation for API diagnosis, not a specific backend or universal SLO values.