Observability Review
Structured review of logging, metrics, and tracing sufficiency. Producing actionable, prioritized findings with code-level references.
Out of scope (defer to siblings):
- Health/readiness probes, gRPC health, retry/timeout semantics →
review-reliability
- Log injection, PII leakage, log-as-attack-channel →
review-security (but flag obvious secret-in-log here as well)
- Dashboard / alert authoring (where to set thresholds) → typically out of scope; observability review covers signal availability, not alert tuning
Workflow
1. Scope and explore
- Confirm scope with the user: full codebase, specific packages/directories, changed files only (PR or branch diff), or specific concern.
- Resolve scope to a file/package list. Based on what the user requested:
- Changed files (PR or branch): Run
git diff --name-only --diff-filter=d <base>...HEAD. If the user references a PR number, use gh pr diff <number> --name-only. Filter to source files (.go, .ts, .tsx, .js, .py, etc.) and configs (prometheus.yml, otel-collector-config.yaml).
- Explicit paths/packages: Include all files under given directories.
- Full codebase: No filtering.
- If invoked from review-all: receive
file_list, package_paths, has_changes, base_ref, REVIEW_DIR, and pr_url from the orchestrator. Skip your own scope confirmation.
- Pass the resolved scope to all exploration and investigation subagents.
2. System overview
Produce a brief telemetry summary covering:
- Logging library/sink: structured (
slog, zap, zerolog, logrus) vs. unstructured (fmt.Println, log.Printf). Output sink (stdout, file, syslog, log aggregator).
- Metrics library/exporter: Prometheus client, OTel metrics, statsd. Where scraping happens.
- Tracing library/exporter: OTel tracer, vendor-specific (Datadog, Honeycomb, Jaeger). Sampling strategy.
- Correlation: are trace IDs threaded through logs (e.g.
slog.With("trace_id", ...))? Are span context propagated across RPC boundaries (otelgrpc, otelhttp)?
- Collector / pipeline: is there an OTel Collector in the path? What processors and exporters?
3. Launch investigation subagent
Launch a single investigation subagent (subagent_type="generalPurpose", model: sonnet per subagent-model-routing) with the system overview and in-scope file list.
Prompt it to:
- Read all in-scope source files and any observability config files (Prometheus, OTel Collector, dashboard JSON).
- Apply the checklists in reference.md:
- Logging sufficiency and structure
- Metrics sufficiency and cardinality
- Tracing sufficiency and propagation
- Correlation across signals
- Identify gaps: RPC handlers without spans, error paths without log entries, hot loops emitting per-iteration metrics, unbounded label values.
- For each finding, search nearby code for existing tracking (TODO/FIXME/HACK).
- Return findings using the observability findings template.
4. Run static analyzers (when applicable)
Most observability gaps are not lint-discoverable; the work is semantic. A few mechanical checks:
# Go: find packages spawning goroutines/RPC handlers without otel instrumentation
# (these are heuristics for the subagent to triage, not gates)
grep -rl "http.HandleFunc\|grpc.NewServer" --include='*.go' <paths>
grep -rL "otelhttp\|otelgrpc\|otel\.Tracer" --include='*.go' <paths>
# Cardinality smell: dynamic strings in metric labels
grep -rn "\.With(prometheus\.Labels{" --include='*.go' <paths>
grep -rn "labels\.NewBuilder\|labels.FromMap" --include='*.go' <paths>
These are inputs for the subagent. False positives are expected.
5. Present results
Resolve the review output directory (same pattern as siblings):
REVIEW_DATE=$(date +%Y-%m-%d)
REVIEW_DIR=".reviews/${REVIEW_DATE}"
if [ -d "$REVIEW_DIR" ]; then REVIEW_DIR=".reviews/${REVIEW_DATE}-$(date +%H%M)"; fi
~/.claude/scripts/ensure-gitignore.sh '.reviews/'
mkdir -p "$REVIEW_DIR"
Capture run metadata (see Run metadata header) and prepend to ${REVIEW_DIR}/OBSERVABILITY-REVIEW.md.
Output structure:
- Run metadata header
- Telemetry overview (from step 2)
- Findings table (grouped by signal: logging / metrics / tracing / correlation)
- Recommended fix order
Present the report to the user.
Run metadata header
RUN_DATETIME=$(date -u +"%Y-%m-%d %H:%M UTC")
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
GIT_COMMIT=$(git rev-parse --short HEAD)
GIT_COMMIT_FULL=$(git rev-parse HEAD)
GIT_SUBJECT=$(git log -1 --pretty=%s)
# When scope is diff-based: BASE_REF=<base>; BASE_COMMIT=$(git rev-parse --short "$BASE_REF")
> **Run:** {RUN_DATETIME}
> **Branch:** {GIT_BRANCH} @ {GIT_COMMIT} (`{GIT_COMMIT_FULL}`)
> **Subject:** {GIT_SUBJECT}
> **Base:** {BASE_REF} @ {BASE_COMMIT} <!-- omit when scope is not diff-based -->
> **Scope:** {scope description}
Finding link wrapping (PR mode)
When pr_url is provided (or gh pr view --json url -q .url 2>/dev/null returns one for standalone runs), wrap every path:line reference inside the finding tables as a Markdown link:
~/.claude/scripts/pr-deeplink.sh "$pr_url" <path> <line>
The display text stays path:line. Pass L as the fourth argument for findings about removed code. Findings follow terse-comments: concrete fix, optional bug:/risk:/nit:/unsure: prefix.
Output Templates
Observability findings
| Priority | Signal | Finding | Impact | Effort | Tracked |
|----------|--------|---------|--------|--------|---------|
| P0 | tracing | Description with code references | Impact on debuggability / MTTR | trivial / small / moderate / large | — |
| P1 | metrics | Description with code references | Cardinality / cost impact | Effort estimate | TODO in file:line |
Signal column values: logging, metrics, tracing, correlation.
Re-evaluation table (for follow-up reviews)
| Finding | Status | What Changed |
|---------|--------|--------------|
| ~~1. Description~~ | FIXED | Brief explanation of the fix |
| 2. Description | Still applicable | No changes |
Guidelines
- Observability is about debuggability under failure. The bar is "could oncall figure out what broke at 3am from these signals alone?"
- Cardinality is cost. Flag high-cardinality labels (user IDs, request IDs, raw URLs) on Prometheus metrics; they're fine as log fields and span attributes.
- Search the organization's codebase for existing logger / tracer / metric patterns before recommending new ones.
- Include effort estimates.
- When the user asks for a follow-up review, find the most recent review directory and append a re-evaluation table.
- For detailed framework categories, see reference.md.
- REVIEW.md integration: If a
REVIEW.md context section was provided by the review-all orchestrator (or exists at the repository root when running standalone), treat its rules as additional review criteria. "Always check" items are HIGH severity; domain-specific items (Observability section) are MEDIUM severity. "Skip" patterns exclude matching files from review scope.
- Findings must cite probed evidence (
path:line, grep output, command result), not pattern-matched suspicion. Per ~/.claude/rules/probe-not-assume.md.
1---2name: review-observability3description: Use when the user asks for an observability review, telemetry review, logging review, metrics review, tracing review, OpenTelemetry review, OTel review, Prometheus review, "are we observable", logging audit, structured logging audit, trace coverage check, span coverage check, metrics cardinality review, or production observability assessment.4---56# Observability Review78Structured review of logging, metrics, and tracing sufficiency. Producing actionable, prioritized findings with code-level references.910**Out of scope** (defer to siblings):11- Health/readiness probes, gRPC health, retry/timeout semantics → `review-reliability`12- Log injection, PII leakage, log-as-attack-channel → `review-security` (but flag obvious secret-in-log here as well)13- Dashboard / alert authoring (where to set thresholds) → typically out of scope; observability review covers signal *availability*, not alert tuning1415## Workflow1617### 1. Scope and explore1819- Confirm scope with the user: full codebase, specific packages/directories, changed files only (PR or branch diff), or specific concern.20- **Resolve scope to a file/package list.** Based on what the user requested:21 - **Changed files (PR or branch):** Run `git diff --name-only --diff-filter=d <base>...HEAD`. If the user references a PR number, use `gh pr diff <number> --name-only`. Filter to source files (`.go`, `.ts`, `.tsx`, `.js`, `.py`, etc.) and configs (`prometheus.yml`, `otel-collector-config.yaml`).22 - **Explicit paths/packages:** Include all files under given directories.23 - **Full codebase:** No filtering.24- **If invoked from review-all**: receive `file_list`, `package_paths`, `has_changes`, `base_ref`, `REVIEW_DIR`, and `pr_url` from the orchestrator. Skip your own scope confirmation.25- **Pass the resolved scope** to all exploration and investigation subagents.2627### 2. System overview2829Produce a brief telemetry summary covering:30- **Logging library/sink**: structured (`slog`, `zap`, `zerolog`, `logrus`) vs. unstructured (`fmt.Println`, `log.Printf`). Output sink (stdout, file, syslog, log aggregator).31- **Metrics library/exporter**: Prometheus client, OTel metrics, statsd. Where scraping happens.32- **Tracing library/exporter**: OTel tracer, vendor-specific (Datadog, Honeycomb, Jaeger). Sampling strategy.33- **Correlation**: are trace IDs threaded through logs (e.g. `slog.With("trace_id", ...)`)? Are span context propagated across RPC boundaries (`otelgrpc`, `otelhttp`)?34- **Collector / pipeline**: is there an OTel Collector in the path? What processors and exporters?3536### 3. Launch investigation subagent3738Launch a single investigation subagent (`subagent_type="generalPurpose"`, `model: sonnet` per `subagent-model-routing`) with the system overview and in-scope file list.3940Prompt it to:41- Read all in-scope source files and any observability config files (Prometheus, OTel Collector, dashboard JSON).42- Apply the checklists in [reference.md](reference.md):43 - Logging sufficiency and structure44 - Metrics sufficiency and cardinality45 - Tracing sufficiency and propagation46 - Correlation across signals47- Identify gaps: RPC handlers without spans, error paths without log entries, hot loops emitting per-iteration metrics, unbounded label values.48- For each finding, search nearby code for existing tracking (TODO/FIXME/HACK).49- Return findings using the **observability findings** template.5051### 4. Run static analyzers (when applicable)5253Most observability gaps are not lint-discoverable; the work is semantic. A few mechanical checks:5455```sh56# Go: find packages spawning goroutines/RPC handlers without otel instrumentation57# (these are heuristics for the subagent to triage, not gates)58grep -rl "http.HandleFunc\|grpc.NewServer" --include='*.go' <paths>59grep -rL "otelhttp\|otelgrpc\|otel\.Tracer" --include='*.go' <paths>6061# Cardinality smell: dynamic strings in metric labels62grep -rn "\.With(prometheus\.Labels{" --include='*.go' <paths>63grep -rn "labels\.NewBuilder\|labels.FromMap" --include='*.go' <paths>64```6566These are inputs for the subagent. False positives are expected.6768### 5. Present results6970Resolve the review output directory (same pattern as siblings):7172```sh73REVIEW_DATE=$(date +%Y-%m-%d)74REVIEW_DIR=".reviews/${REVIEW_DATE}"75if [ -d "$REVIEW_DIR" ]; then REVIEW_DIR=".reviews/${REVIEW_DATE}-$(date +%H%M)"; fi76~/.claude/scripts/ensure-gitignore.sh '.reviews/'77mkdir -p "$REVIEW_DIR"78```7980Capture run metadata (see [Run metadata header](#run-metadata-header)) and prepend to `${REVIEW_DIR}/OBSERVABILITY-REVIEW.md`.8182Output structure:831. Run metadata header842. Telemetry overview (from step 2)853. Findings table (grouped by signal: logging / metrics / tracing / correlation)864. Recommended fix order8788Present the report to the user.8990---9192## Run metadata header9394```sh95RUN_DATETIME=$(date -u +"%Y-%m-%d %H:%M UTC")96GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)97GIT_COMMIT=$(git rev-parse --short HEAD)98GIT_COMMIT_FULL=$(git rev-parse HEAD)99GIT_SUBJECT=$(git log -1 --pretty=%s)100# When scope is diff-based: BASE_REF=<base>; BASE_COMMIT=$(git rev-parse --short "$BASE_REF")101```102103```markdown104> **Run:** {RUN_DATETIME}105> **Branch:** {GIT_BRANCH} @ {GIT_COMMIT} (`{GIT_COMMIT_FULL}`)106> **Subject:** {GIT_SUBJECT}107> **Base:** {BASE_REF} @ {BASE_COMMIT} <!-- omit when scope is not diff-based -->108> **Scope:** {scope description}109```110111---112113## Finding link wrapping (PR mode)114115When `pr_url` is provided (or `gh pr view --json url -q .url 2>/dev/null` returns one for standalone runs), wrap every `path:line` reference inside the finding tables as a Markdown link:116117```sh118~/.claude/scripts/pr-deeplink.sh "$pr_url" <path> <line>119```120121The display text stays `path:line`. Pass `L` as the fourth argument for findings about removed code. Findings follow `terse-comments`: concrete fix, optional `bug:`/`risk:`/`nit:`/`unsure:` prefix.122123---124125## Output Templates126127### Observability findings128129```markdown130| Priority | Signal | Finding | Impact | Effort | Tracked |131|----------|--------|---------|--------|--------|---------|132| P0 | tracing | Description with code references | Impact on debuggability / MTTR | trivial / small / moderate / large | — |133| P1 | metrics | Description with code references | Cardinality / cost impact | Effort estimate | TODO in file:line |134```135136**Signal column values:** `logging`, `metrics`, `tracing`, `correlation`.137138### Re-evaluation table (for follow-up reviews)139140```markdown141| Finding | Status | What Changed |142|---------|--------|--------------|143| ~~1. Description~~ | FIXED | Brief explanation of the fix |144| 2. Description | Still applicable | No changes |145```146147---148149## Guidelines150151- Observability is about debuggability under failure. The bar is "could oncall figure out what broke at 3am from these signals alone?"152- Cardinality is cost. Flag high-cardinality labels (user IDs, request IDs, raw URLs) on Prometheus metrics; they're fine as log fields and span attributes.153- Search the organization's codebase for existing logger / tracer / metric patterns before recommending new ones.154- Include effort estimates.155- When the user asks for a follow-up review, find the most recent review directory and append a re-evaluation table.156- For detailed framework categories, see [reference.md](reference.md).157- **REVIEW.md integration**: If a `REVIEW.md` context section was provided by the review-all orchestrator (or exists at the repository root when running standalone), treat its rules as additional review criteria. "Always check" items are HIGH severity; domain-specific items (Observability section) are MEDIUM severity. "Skip" patterns exclude matching files from review scope.158- Findings must cite probed evidence (`path:line`, grep output, command result), not pattern-matched suspicion. Per `~/.claude/rules/probe-not-assume.md`.