Reference

Observability & troubleshooting

Read logs, metrics and traces; query service behavior and reason about alerts and missing evidence.

Scope and conventions

PromQL uses classic counter/gauge/histogram series; Loki examples use LogQL log pipelines. Metric names and log fields are an explicit example schema, not automatic SDK output. Queries need data with that schema. Native language logging and HTTP recipes remain in Programming languages.

SLOs, alerts & investigation

Define the SLI population before calculating budget

Telemetry & queries

Specify eligible events and good events over a stated window. For a 99.9% success objective, the allowed bad fraction is 0.001. Burn rate divides the observed bad-event fraction by that allowance.

Protocol / decision sketch

Sequence or decision sketch; not executable code.

Telemetry & queries · Define the SLI population before calculating budget
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
eligible = 100000 requests
allowed bad = 100000 × (1 - 0.999) = 100
observed bad fraction = 0.01 → burn rate = 10

Require sustained evidence with an alert rule

Telemetry & queries

A Prometheus alert becomes pending when its expression returns matching series and fires after the condition persists for for. The shown up check detects failed scrapes, not complete user-facing health.

Complete file

Complete Prometheus rule file; load it through rule_files in your Prometheus configuration. Notification routing is separate.

alerts.yml
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
groups:
  - name: api-availability
    rules:
      - alert: ApiScrapeFailing
        expr: up{job="api"} == 0
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: "API target has failed scrapes for five minutes"

Investigate with a matched comparison and a stopping check

Telemetry & queries

State impact and time range, compare an affected population against a useful baseline, then join metrics to events and traces. A deployment correlation suggests a hypothesis; test it and verify recovery through the user operation.

Protocol / decision sketch

Sequence or decision sketch; not executable code.

Telemetry & queries · Investigate with a matched comparison and a stopping check
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
impact + time range + scope
→ compare baseline and affected traffic
→ inspect changes, errors and traces
→ test a bounded hypothesis
→ verify recovery and record remaining uncertainty

Choose retention and sensitive-data handling deliberately

Telemetry & queries

Telemetry can contain personal or operationally sensitive information. Collect only useful fields, control access/export destinations and retention, and avoid making secrets or unbounded identifiers metric labels.

Protocol / decision sketch

Sequence or decision sketch; not executable code.

Telemetry & queries · Choose retention and sensitive-data handling deliberately
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
retain: documented fields and investigation window
restrict: credentials, payloads, personal data, destinations
monitor: ingestion drops, sampling and collection cost