agentleFS
avizmarlonavizmarlon/agent-skills/skills/observability-when-to-add/SKILL.md

observability-when-to-add

Skill2 starsChanged 6 months agoMITView on GitHub

Instrumentation is directed, not preventive — add observability only when confirmed pain exists. Follow industry standards (OpenTelemetry, structured logging, performance.now()). Use when implementing metrics, tracing, performance debugging, or asking whether instrumentation is needed.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before you have identified a concrete bottleneck or failure mode

    line 21
  2. Distinctive:

    NOT every function, NOT every variable assignment

    line 36
  3. Distinctive:

    All log writes go in try/catch blocks (silent failure okay)

    line 44
  4. Distinctive:

    If the observability system is down, the application runs normally

    line 45
  5. Very specific:

    NOT wall-clock time (Date.now(), time.time()) — wall clocks can jump backward

    line 60

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Observability & Instrumentation — Directed, Not Preventive

Industry principle (Google SRE Book, Honeycomb, Charity Majors): instrumentation carries maintenance cost proportional to its value. Every metric is code to maintain, schema that can break, storage cost, and signal to interpret. You instrument when you have confirmed pain, not "just in case."

When to add observability

  • Performance bug you cannot locate (classic in multi-threaded, async, or distributed systems)
  • External SLA or performance requirement demands metrics
  • System is in production with real user traffic
  • Flow analysis is part of the product itself (user journey tracking, etc.)

When NOT to add observability

  • "Good practice" or preventive coverage before pain is identified
  • Small side projects in active development
  • Before you have identified a concrete bottleneck or failure mode
  • To satisfy an abstract rule like "instrument everything"

What to use when you decide to instrument

  • Production / real traffic → OpenTelemetry (CNCF graduated project) + collector + backend (Honeycomb, Tempo, Jaeger, or cloud equivalent)
  • Local development / single-user → structured JSON logging + jq/grep. Add correlation_id if the call crosses process boundaries.
  • Spot performance hunt → use language builtins (console.time/console.timeEnd in JavaScript, time.perf_counter() in Python, etc.). Discard after resolving the issue.

Universal principles when instrumenting

Instrument boundaries, not internals

  • Entry points (API handlers, RPC endpoints)
  • Network calls (HTTP, gRPC, database queries)
  • External service boundaries
  • NOT every function, NOT every variable assignment

Aggressive sampling in production

  • Default: 1-10% of requests
  • 100% only in development or for high-value (error) events
  • Sampling reduces noise and cost without losing signal on aggregate behavior

Telemetry failure must not cascade

  • All log writes go in try/catch blocks (silent failure okay)
  • If the observability system is down, the application runs normally
  • Observability is about understanding running systems, not blocking them

Never log PII, tokens, or raw payloads

  • Log summaries instead of bodies (e.g., "request 256 bytes to /api/v1/users" not the JSON)
  • Redact or hash sensitive fields
  • Assume logs are readable by ops teams and retained for weeks

Use verb:noun naming for events

  • Examples: fetch:external_api, query:database, publish:event
  • This naming schema makes grep work reliably months later
  • Easier to discover related events and trace flows

Use monotonic clocks for duration

  • performance.now() (JavaScript), time.perf_counter() (Python), System.nanoTime() (Java)
  • NOT wall-clock time (Date.now(), time.time()) — wall clocks can jump backward
  • Duration must be reliable across system-clock corrections

Red flags — when you're over-instrumenting

  • Observability code is more complex than the business logic it instruments
  • You added metrics months ago and have never queried them
  • The instrumentation is "just in case" with no corresponding monitoring/alerting
  • Log volume exceeds bandwidth or storage budget
  • You notice yourself filtering/ignoring metrics because they're too noisy

Canonical references

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.