Comprehensive guide to observability testing for production observability and monitoring systems.
When a distributed system is instrumented but nobody validates that the data actually arrives, the instrumentation is noise—not observability. This page covers the concrete steps of testing observability pipelines: confirming that traces, logs, and metrics are emitted, propagated, and stored as expected. It matters anytime new services are added, dependencies change, or a backend upgrade reshapes the data flow. If you cannot answer “is this request visible end-to-end?” with confidence, you need observability testing.
The first step is ensuring that instrumented code actually emits data into the pipeline. Without this, downstream validation is moot.
Most modern instrumentation sends data via the OpenTelemetry Protocol (OTLP) to a collector. The simplest verification is a direct curl POST to the collector’s gRPC or HTTP endpoint.
# HTTP/JSON mode
curl -s -X POST http://localhost:4318/v1/logs \
-H "Content-Type: application/json" \
-d '{"resource":{"attributes":[],"schema_url":""},"scope":{"attributes":[],"name":"test"},"records":[{"body":"observability test log","attributes":{}}]}' | jq .
# gRPC mode (requires proto-aware client; simpler to test HTTP)
curl -s --basic -u "user:pass" http://localhost:4318/v1/traces -d @- <<'EOF'
{
"resource": {"attributes": [], "schema_url": ""},
"instrumentationLibrary": {"name": "test", "version": "1.0"},
"spans": [{"name": "test-span", "context": {"trace_id": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-1", "span_id": "00f067aa0ba902b7"}, "start_time": "1620000000000000", "end_time": "1620000001000000", "attributes": [{"key": "http.method", "value": {"string_value": "GET"}}]}]
}
EOF
If the collector is healthy, both commands return 200 OK with an empty body. A 400 or 500 indicates the pipeline is not receiving—check collector configuration, network policies, or SDK exporter settings.
The OpenTelemetry Collector exposes a /debug/stats endpoint that reports received and processed counts. This is useful for quiet verification after a deployment.
curl -s http://localhost:13133/debug/stats | jq .
Typical output includes receivers.{name}.count and exporters.{name}.count. Zero counts for a configured receiver mean the SDK is not connected, the endpoint is misconfigured, or a firewall is blocking traffic.
If the collector’s batch processor fills faster than it can export, spans are dropped without an error returned to the SDK. This is the most common silent failure in production observability pipelines. To detect it, monitor the collector’s spans.dropped metric or check the processor’s queue_length attribute. A sustained rise without a corresponding rise in spans.processed signals backpressure that the system does not surface to callers.
Once emission is confirmed, the next question is whether traces cross service boundaries correctly. This is where most observability gaps live.
Inject a trace context into an HTTP request and verify it appears in the backend.
# Request with a traceparent header
curl -s -w "\nHTTP_CODE:%{http_code}\n" \
-H "Traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-1-1" \
http://svc-a:8080/endpoint | head -5
If the service propagates the context, the downstream service will receive the same traceparent header and create a child span. Absent a propagated header, the downstream span will have a new trace ID, breaking the end-to-end chain.
After injection, query the tracing backend (Jaeger, Zipkin, or similar) for the trace ID.
# Jaeger UI API (HTTP mode)
curl -s "http://localhost:16686/api/traces?lookback=1m&service=svc-a" | jq -r '.data[0].spans[] | select(.operationName=="endpoint") | .traceId' | head -3
Or, if using the Jaeger jaeger-client pattern, the span should appear with parent_id set to the injected span ID. A missing parent link means propagation failed.
propagate vs traceparentA frequent misconfiguration occurs when a service’s HTTP middleware enables traceparent injection but the downstream service expects b3 or x-b3-traceid (common in Zipkin/brave-based ecosystems). The result is a new trace ID at each hop, fragmenting the trace. Test both header formats if your stack spans multiple tracing libraries.
Traces alone often cannot diagnose stateful failures; correlated logs provide the narrative. The test here is whether every span has an associated structured log entry with the same trace ID.
Many SDKs allow injecting the current span’s trace ID into log output. Here’s a pattern using the OpenTelemetry Python SDK:
import os
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.grpc.log_exporter import OTLPLogExporter
trace.set_tracer_provider(TracerProvider())
tracer = trace.get_tracer(__name__)
# Configure OTLP log exporter (real OTel config key: exporters.otlp.log)
otlp_log_exporter = OTLPLogExporter(endpoint="localhost:4317")
span_processor = BatchSpanProcessor(otlp_log_exporter)
trace.get_tracer_provider().add_span_processor(span_processor)
with tracer.start_as_current_span("test-op") as span:
span.set_attribute("http.method", "GET")
# Log with correlation—most structured log frameworks accept a trace_id kwarg
print({"msg": "observability test", "trace_id": span.get_span_context().trace_id})
Run the script, then query the log backend.
# Assuming Loki with Promtail, query by label
curl -s 'http://localhost:3100/loki/api/v1/query?query={trace_id="00f067aa0ba902b7"} | json' | jq .
If no entries appear, the logging integration is not capturing the trace ID. Common causes: the log formatter does not include the OTel context, or the log exporter is configured without a correlation processor.
Structured logs often truncate large attribute maps. If a trace ID is passed as a top-level attribute, and the log backend indexes only the first N characters, subsequent queries by full trace ID fail. This is invisible in dev environments with short IDs but surfaces in production where trace IDs are 32+ hex characters.
Metrics provide the aggregated view that alerts depend on. Testing focuses on whether the expected metric shapes arrive with the correct labels and thresholds.
# Is the `http_requests_total` metric reaching Prometheus?
curl -s 'http://localhost:9090/api/v1/query?query=http_requests_total{method="get"}' | jq .
A result vector with value pairs indicates the metric is being scraped. An empty result means the exporter is not reaching the Pushgateway, the scrape config does not include the target, or the metric name is misspelled.
After a service change that adds a new label (e.g., region), confirm the label appears in the metric series.
curl -s 'http://localhost:9090/api/v1/query?query=http_requests_total{region="us-east-1"}' | jq .
If the query returns vector(0) or an error about an unknown label, the instrumentation is not emitting the new label, or the Prometheus config was not updated to scrape it.
When two services inadvertently use the same metric name with different label sets, Prometheus aggregates them, obscuring per-service trends. This is especially insidious when both services use http_requests_total but with different label subsets. Test by querying each service’s expected label combination independently.
The OpenTelemetry SDKs, by default, do not retry failed exports indefinitely. If the collector is restarted or overwhelmed, spans are dropped and lost forever. The sharp edge: the SDK returns a StatusCode.Error to the caller, but many frameworks ignore this return value. Test by stopping the collector mid-request flow and observing whether the upstream service logs or surfaces the error.
batch processor flush interval misaligned with traffic patternsThe collector’s batch processor defaults to flushing every 5 seconds or when the queue reaches 1024 spans. In low-traffic environments, this means spans sit for up to 5 seconds before export, causing apparent latency in dashboards. In high-traffic environments, the queue fills and drops occur. The test: run the collector with --config setting batch.flush_interval=1s and batch.max_export_batch_size=100 to force frequent exports, then verify trace appearance times in the backend.
otlp exporter endpoint mismatch between SDK and collectorSDKs often default to localhost:4317 (gRPC) or localhost:4318 (HTTP), while the collector may be configured to listen on different ports or IPs (especially in Kubernetes with service meshes). The result: connection refused errors that are easy to misdiagnose as SDK bugs. The concrete check: run netstat -tlnp | grep 4317 on the host and compare to the collector’s receivers.otlp.endpoint value.
Observability testing is the discipline of confirming that the data pipeline—from instrumented code to stored backend—functions as intended. The concrete steps are: emission verification via the OTLP endpoint, trace propagation injection and backend lookup, log correlation by trace ID, and metric query by label. The sharp edges are processor queue drops, header format mismatches, and collector backpressure that SDKs do not retry. Run these checks after any service addition, dependency change, or backend reconfiguration. If you cannot answer “is this request visible?” with a verified yes, the pipeline is untested and unreliable.
This page was rewritten on 18 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.
We use cookies for analytics (Google Analytics) and advertising (Google AdSense) to improve your experience and support free content. Privacy Policy