Chaos & Partial Trace Degradation
Observability-Driven QE Sprint β Day 5
Inject observability chaos into microservices: corrupt traceparent headers, simulate dropped parent contexts, and verify graceful fallback to new root traces without crashing.
What happens when an intermediary reverse proxy strips headers or a buggy third-party client passes a corrupted traceparent? Observability instrumentation must never crash user transactions. In this lab, you simulate degraded context faults and verify services recover gracefully according to the W3C spec.
The official reference codebase for Day 5 is hosted in the repository. Clone the repository and navigate to tests/day5-degraded-context.spec.ts to run the working solution.
git clone https://github.com/777abhi/observability-qe-roadmap.git
cd observability-qe-roadmap/tests/day5-degraded-context.spec.tsTest Fault Injection & Recovery
Run Day 5 Vitest suites and inspect chaos mutations.
npm run test:day5export class TraceResiliencyVerifier {
static resolveIncomingContext(headers: Record<string, string | undefined>): ServiceTraceResolution {
const rawHeader = headers['traceparent'];
if (!rawHeader) {
return {
traceId: W3CTraceContext.generateTraceId(),
wasRecovered: true,
recoveryReason: 'MISSING_HEADER_GENERATED_NEW_ROOT',
};
}
const parsed = W3CTraceContext.parseTraceParent(rawHeader);
if (!parsed) {
return {
traceId: W3CTraceContext.generateTraceId(),
wasRecovered: true,
recoveryReason: 'CORRUPTED_HEADER_RESTARTED_ROOT',
};
}
return {
traceId: parsed.traceId,
parentSpanId: parsed.parentId,
wasRecovered: false,
};
}
}- Simulated missing and corrupted W3C traceparent headers.
- Verified services fail-open by generating new root trace IDs rather than throwing unhandled exceptions.
- Ensured business transactions complete successfully even under severe observability degradation.
π§ Knowledge Check
How should a service behave when it receives an invalid or corrupt traceparent header?