DevOps QA / Intermediate: trustworthy validation systems / Lesson 12
Test observability and actionable triage
Connect a failed case to its environment and application activity without turning telemetry into an uncontrolled archive.
On this page
Lesson goals
- Design correlated test, application, and pipeline evidence.
- Measure diagnosis quality and retain privacy-conscious diagnostics.
Start with diagnostic questions
A useful failure record answers what failed, which candidate and environment were involved, whether setup completed, which dependency responded, and where time was spent. A screenshot can show visible state but not why a backend rejected a request. A server log can show an error without identifying the test that triggered it. Correlation connects these views. Keep test identity, pipeline run, artifact, scenario, attempt, and environment available through a controlled context, and distinguish test harness activity from application behavior so the harness does not become the unexplained source of every failure.
Use spans for bounded operations
OpenTelemetry traces represent operations as spans with relationships and timing. Instrument meaningful boundaries such as fixture creation, reservation request, and confirmation polling instead of one span per assertion line. Correlate through supported propagation where the application integration permits it, and avoid private payloads in attributes. Semantic conventions and instrumentation APIs evolve, so pin the SDK and chosen convention version. The example uses ordinary application-defined qa.* attributes rather than claiming they are standardized OpenTelemetry fields. It assumes the project already configures a local test tracer provider.
from opentelemetry import trace
tracer = trace.get_tracer("booking.qa")
def traced_case(run_id, case_id, exercise):
with tracer.start_as_current_span("qa.case") as span:
span.set_attribute("qa.run_id", run_id)
span.set_attribute("qa.case_id", case_id)
return exercise()
Requires compatible pinned OpenTelemetry API/SDK packages and an approved exporter configuration; none is installed or contacted here. exercise is a local fixture callback. Do not attach tokens, email addresses, or full request bodies to spans.
Choose metrics with honest denominators
Track queue delay, setup duration, execution duration, first-attempt failure, recovered failure, missing reports, and time to actionable diagnosis. Group failures by stable categories and responsible boundary. Avoid presenting one blended pass rate that hides retries or skips. Test ids are useful in logs or traces but can create excessive metric cardinality if every generated case becomes a new label. Keep metric dimensions bounded, and use links to detailed evidence for exploration. An observability backendโs missing data must itself be visible; no telemetry is not evidence that nothing failed.
Store the first useful evidence
A triage record should preserve the earliest relevant error and link to bounded diagnostics with access control. Categorize provisionally when the root cause is unknown, then update the classification with evidence. The record below distinguishes failed behavior from a final pipeline status and makes attempt identity visible. Its artifact values are synthetic labels rather than cryptographic claims. A trusted ingestion path must attach actual immutable identity. Avoid overwriting this record when a retry passes; maintain the relationship so investigators can compare what changed between attempts.
{
"caseId": "reserve-final-seat",
"runId": "lab-run-51",
"attempt": 1,
"artifact": "lab-candidate-51",
"phase": "assertion",
"classification": "unclassified",
"errorCode": "CAPACITY_MISMATCH",
"diagnostics": ["owned-trace-51", "fixture-manifest-51"]
}
Diagnostic names refer to synthetic access-controlled artifacts, not real links. A production schema needs retention, redaction, integrity, and ownership rules. Keep the exact machine error code stable while translating human explanations outside the code field.
Improve the investigation loop
Route failures to an owner who can distinguish application, test, environment, and pipeline causes. Measure whether the evidence reduced repeated reproduction work and whether the classification changed after review. Use representative incidents to improve fixtures, assertions, and instrumentation. Avoid ranking people by red-job count, which encourages hiding signals and discourages useful tests. Observability has cost and privacy consequences: sample successes, preserve bounded failures where appropriate, and expire artifacts deliberately. The goal is a short defensible path from a failed check to a verified repair, not maximum telemetry volume.
Common errors and fixes
A failure has screenshots but no candidate identity
- Why it happens
- Diagnostics are detached from pipeline metadata.
- How to fix it
- Attach artifact, environment, run, case, and attempt identity.
- Prevent it next time
- Validate the evidence envelope before accepting reports.
Telemetry storage grows with every generated user id
- Why it happens
- Unbounded identifiers are metric dimensions.
- How to fix it
- Use bounded categories and trace links for detail.
- Prevent it next time
- Review cardinality and retention budgets.
A passed retry removes the original trace
- Why it happens
- Artifact names overwrite across attempts.
- How to fix it
- Retain attempt-specific evidence and relationships.
- Prevent it next time
- Test diagnostic collection under retries.
Check your understanding
1. A timeout may be caused by setup, API latency, or stale UI state. Which evidence separates them?
Show worked solution
Record phase timings, readiness result, correlated request trace, response outcome, and the UI assertion state. If setup never completed, classify that first. If the API succeeded promptly but the UI stayed stale, inspect state observation rather than increasing the server timeout blindly.
2. A dashboard has 98% passes after excluding missing reports. How should it change?
Show worked solution
Show expected cases or suites, completed evidence, skips, cancellations, missing reports, first-pass success, and recovered success separately. Keep the missing denominator visible. The gate can then distinguish execution reliability from the behavior results actually observed.
Key takeaways
- Correlated evidence should answer concrete triage questions.
- Attempt identity and complete denominators prevent misleading summaries.
- Privacy, cardinality, and retention are part of observability design.