Observability patterns

From farming-labs/fm-skills · View interactive version

Observability patterns is an AI agent skill from the GitHub repository farming-labs/fm-skills. Explains observability patterns for web applications including logs, metrics, traces, client error reporting, correlation IDs, SLOs, and alert design. Use when debugging production issues, designing telemetry, or deciding what signals to collect from frontend and backend systems.

How to use this skill

Skill file

Observability Patterns

Overview

Observability is how you understand what a system is doing in production.

It answers questions like:

Observability is not just logging. It is the combined use of:

The Core Signals

| Signal | Best For | Weakness |

|--------|----------|----------|

| Logs | Detailed event context | High volume, harder to aggregate |

| Metrics | Trends, rates, latency, alerting | Lose per-event detail |

| Traces | Following one request across services | More setup and sampling tradeoffs |

| Error reporting | Grouping crashes and exceptions | Misses non-crash degradation |

Good observability uses all of them together instead of expecting one signal to answer every question.

Logs

Logs record discrete events with contextual fields.

Useful examples:

Prefer Structured Logs

{
  "level": "error",
  "message": "Payment authorization failed",
  "requestId": "req_123",
  "userId": "user_42",
  "route": "/checkout",
  "statusCode": 502
}

Structured logs are better than free-form text because they can be filtered, grouped, and correlated reliably.

Logging Rules of Thumb

Metrics

Metrics show how the system behaves over time.

Common metric families:

Good Metric Questions

Percentiles Matter

Averages often hide user pain.

Example:

That usually means many users are fine while a meaningful minority are having a bad experience.

Traces

Tracing follows one request or user action across system boundaries.

This is especially useful when:

Trace Shape

User click
  -> browser request
    -> edge middleware
      -> app server
        -> database query
        -> cache lookup
        -> third-party API

Traces help answer not just "what failed?" but "where in the chain did time or failure accumulate?"

Error Reporting

Error reporting is a specialized signal for exceptions, crashes, and grouped failures.

For web applications, useful sources include:

Error reporting is strongest when each event includes:

Frontend Observability

Frontend systems need observability too, not just backend services.

Important client-side signals:

Useful Frontend Questions

Backend Observability

Important backend signals:

Backend telemetry should make it easy to distinguish:

Correlation IDs

Correlation IDs connect signals across layers.

Examples:

Why They Matter

Without correlation IDs:

With them, you can move from:

What to Instrument

Instrument user flows and system boundaries first.

Good starting points:

Avoid starting with hyper-granular internal events that generate noise without helping diagnosis.

Golden Signals

A practical baseline is to watch these:

Examples:

These are often the fastest path to spotting active incidents.

SLOs and User Impact

Observability is most useful when tied to user experience, not just system internals.

Examples:

This helps separate:

Alerting Patterns

Alerts should be actionable, not just noisy.

Good Alerts

Bad Alerts

If an alert does not tell someone what to investigate next, it is probably not a good alert.

Dashboards

Dashboards are for fast situational awareness.

Useful dashboard slices:

Dashboards should help answer:

Sampling and Cost

Telemetry is not free.

Common tradeoffs:

High Cardinality Warning

Avoid unbounded metric labels like:

Those are usually better as log fields, not metric dimensions.

Common Anti-Patterns

| Anti-Pattern | Why It Hurts |

|--------------|--------------|

| Logging everything | Expensive and hard to query |

| Metrics without labels or ownership | Hard to act on |

| Alerts on raw noise | Pager fatigue |

| Error events without release/version | Hard to connect to deployments |

| Frontend blind spots | Backend looks healthy while users are failing |

| No correlation IDs | Investigation becomes guesswork |

Incident Debugging Workflow

A practical workflow:

  1. Check alerts or user reports
  2. Look at top-level metrics to confirm scope
  3. Identify affected route, service, or release
  4. Use traces or request IDs to narrow the failing path
  5. Inspect structured logs for exact failure context
  6. Confirm user impact and whether rollback or mitigation is needed

Good observability shortens this loop.

Decision Guide

Use this rough mapping:

Rules of Thumb

Related Skills

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.