Observability

From maragudk/fabrik · View interactive version

Observability is an AI agent skill from the GitHub repository maragudk/fabrik. Guide for instrumenting and operating observable software systems. Use this skill whenever the user is adding or reviewing telemetry, instrumenting code with OpenTelemetry, working with traces/spans/metrics/logs/structured events, debugging production behavior, designing SLOs or alerts, setting up s

How to use this skill

Skill file

Observability

Overview

This skill turns modern observability practice into actionable guidance. The aim is not a survey of the field but to help you instrument code, debug production, and design reliability mechanisms well.

The throughline: observability is the ability to understand any state your system can reach -- including ones you have never seen before -- by interrogating its outputs, without shipping new code to capture them first. In the AI era the bottleneck is no longer writing code; it is validating and understanding the code you (or an agent) just shipped. Observability is the feedback loop that closes that gap.

When to use this skill

Use it when instrumenting code, reviewing someone's telemetry, debugging a production problem from first principles, designing SLOs/alerts, configuring sampling or pipelines, choosing where to store telemetry, or making a system legible to AI agents. For a one-line "add a log here", you don't need the skill; for anything that shapes what data exists or how you'll answer questions later, you do.

The core mental model

The foundational practice: wide structured events

Everything else rests on this. Get it right and the rest follows; get it wrong and no tool will save you.

Two telemetry models, and when each is right:

Instrumenting with OpenTelemetry

OTel is the vendor-neutral standard for creating, transmitting, and naming telemetry. The payoff is separation of concerns: instrument once, route anywhere, swap backends via config without touching app code. Generating telemetry is easy; generating useful telemetry is the hard part -- instrumentation is sculpting, deciding what to keep.

For the full what-to-capture catalog, per-architecture patterns (streaming, async fan-out, long-running jobs, serverless, eBPF), span-link usage, and ontology design, read references/instrumentation.md. For a concrete attribute-by-attribute catalog for wide events (names, example values, and the question each answers), read references/wide-event-attributes.md.

Analysis: debug from first principles

Collecting good telemetry is half the job; how you analyze it is the other half. Stop debugging from known conditions (intuition, "what normal looks like", flipping through dashboards) -- that doesn't scale, doesn't transfer, and fails on novel multi-causal incidents.

The core analysis loop (hypothesis-driven, scientific, teachable):

  1. Start from the signal -- what did the alert/customer/anomaly actually tell you?
  2. Verify it's real -- is there a notable change in some curve?
  3. Isolate what's different inside the anomaly vs the baseline -- examine outlier rows, group by useful fields (status code, build, region), filter to expose outliers.
  4. Know enough? If yes, done. If no, filter to narrow and return to step 3.

It needs no prior mental model of every subsystem -- it brute-forces across all dimensions to find which ones correlate with the anomaly. Automate the brute force: compute each dimension's distribution inside vs outside the anomaly, diff, and rank by largest difference (the "BubbleUp" pattern). This only works if you have wide events to slice; metrics lack the dimensionality.

Anti-patterns: exhaustive runbooks and "every known root cause" docs (they go stale; wrong docs are worse than none -- keep only ownership, escalation, dependencies, and a few good entry queries; instrumentation is the best living documentation). Confirmation bias (guessing a cause, then hunting for supporting evidence). Confusing correlation with causation while brute-forcing.

Observability-driven development (ODD)

ODD complements TDD: TDD verifies correctness against a spec; ODD verifies behavior against reality. Tests pass in a controlled world with variability removed; production is variability. So ship every feature together with the instrumentation needed to measure its impact and debug it.

SLOs and alerting

Alert on symptoms of user pain, not on causes. Threshold alerts (CPU > 80%) measure what's easy, not what users feel -- they breed alert fatigue and "normalization of deviance" until the one real alert drowns. They also only cover known-unknowns, while distributed systems are dominated by unknown-unknowns, and self-healing systems (autoscale, circuit breakers) trip them for conditions that resolve themselves.

The two-part test for a helpful alert: (1) it's a reliable indicator of degraded user experience, and (2) it's actionable. If it fails either test, delete it.

For SLO adoption (it's a sociotechnical problem -- alignment matters more than query-writing), burn-alert math, baseline-window sizing, and acting on alerts, read references/slos-and-alerting.md.

Cost, sampling, pipelines, and storage

At scale, storing 100% of events costs more than it's worth -- most events are near-identical successes. Sample to keep representative events plus enough metadata to reconstruct traffic shape. Every sampled event must carry the sample rate in effect, so the backend can weight it back up.

For sampling code patterns, pipeline architecture, and the transferable storage-design lessons (Retriever and ClickHouse), read references/storage-sampling-pipelines.md.

Observability for AI: agents and LLM applications

This is a major emphasis of modern observability practice, and it's directly relevant to AI engineering work.

For the full agent context layer, LLM telemetry design, the eval flywheel, and ontology/invariant patterns, read references/ai-llm-and-agents.md.

Strategy, decisions, and organizational change

The organizational side matters when you're advising on observability strategy, not just writing instrumentation.

For build/buy frameworks, vendor partnership and procurement tactics, observability-team practices, the business case, systems-thinking lens, and the organizational shift, read references/strategy-and-org.md.

A few rules of thumb to carry around

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.