# Observability Instrumentation

> Use when adding logs, metrics, traces or alerts in application code: define the questions the on-call will ask before instrumenting anything. devops-conventions covers the pipeline and infra.

- Skill: `techmefr/observability-instrumentation` (Agent Skill, multi-file: 7 files)
- Install (CLI): `npx get-skill add techmefr/observability-instrumentation`
- Raw SKILL.md: https://api.skillmd.com/api/skills/techmefr/observability-instrumentation/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: techmefr (https://skillmd.com/u/techmefr)
- Updated: 2026-11-19
- Page: https://skillmd.com/skills/techmefr/observability-instrumentation

---


# observability-instrumentation

Step 6 of the pipeline (`WORKFLOW.md`), complementing `devops-conventions` (which covers
CI/CD/infra/monitoring at platform level): here, instrumentation at application-code level: where
to log, which metric, which label. Every rule below holds in a repo with **nothing installed**
(`CONVENTIONS.md`, rule A).

**An applied override is recorded, not hidden.** Where a platform's own observability conventions govern a
rule here, write what they require, and leave one short neutral trace addressed to whoever can decide (a line
in the PR description, the task summary or an ADR): which rule was overridden, by what, and that it is a
resolved case. Never phrase it as "a conflict between mentis and the house rules" to a non-technical
stakeholder — that framing reads as broken even when the case is a normal, resolved one, and has already
caused a real project to get abandoned and restarted over nothing. Raise one specific, named question to the
decider only when no rule anywhere actually resolves the case.

## When
As soon as logging, a metric, a trace or an alert is added or modified in application code: never
by adding instrumentation "just in case" with no precise question behind it.

## Steps

**Read §1 first, every time, then the section for what you are adding.** The rules live one file per
section under `references/`. §1 is what makes the rest judgeable: without the questions written down,
nothing decides whether a log line or a metric belongs.

| § | Covers | Read it when | File |
|---|---|---|---|
| 1 | Define the questions before instrumenting | always, before the first log line or metric | [`01-questions-first.md`](./references/01-questions-first.md) |
| 2 | Structured logs | a log line is added or changed | [`02-structured-logs.md`](./references/02-structured-logs.md) |
| 3 | Metrics and traces: anti-cardinality | a metric, a label or a trace span is added | [`03-metrics.md`](./references/03-metrics.md) |
| 4 | Alerting: symptom-based | an alert is added or changed | [`04-alerting.md`](./references/04-alerting.md) |
| 5 | OpenTelemetry: service identity, span names and status, attribute naming, sampling | the code is instrumented with OpenTelemetry | [`05-opentelemetry.md`](./references/05-opentelemetry.md) |

## Output / checkpoint
The instrumentation added explicitly answers one of the on-call questions stated at step 1; no
unbounded-cardinality label introduced; the alert tested under simulated conditions before being
considered reliable (§4.2); and the output looked at once with real traffic (§1.10).

## Guardrails
Never instrument out of reflex ("you never know") with no identified on-call question behind it: the
cost of collection/storage isn't free and the noise drowns the useful signal during a real
incident. Never PII in clear text in a log, even in a test environment — and redact by field name
rather than by call-site discipline (§2.4). **Never interpolate a value into a log message** (§2.6);
fields for the values, a constant for the message. **Never rename a metric or change its unit
casually** (§3.8) — every dashboard, alert and saved query is written against them. **Never leave an
alert untested** (§4.2).

## Origin
A rewrite of a market generalist catalogue's `observability-and-instrumentation` skill. The full
provenance and the refresh log are in [`references/origin.md`](./references/origin.md).

