sre-observability-query-cookbook
Skill4 starsChanged 24 days agoMITView on GitHub
Use when you need a correct query for golden signals, RED/USE, saturation, error ratio, latency percentiles or SLO burn rate in PromQL, DQL, Datadog or LogQL.
In this repository84 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/sre-safety-gates.mdcCursor rule
- sre-awsSkill
- sre-azureSkill
- sre-capacity-planningSkill
- sre-change-safetySkill
- sre-chaos-engineeringSkill
- sre-cloud-cost-reviewSkill
- sre-database-triageSkill
- sre-datadogSkill
- sre-dependency-mappingSkill
- sre-diagnosticsSkill
- sre-dr-backup-testSkill
- sre-dynatraceSkill
- sre-emudhra-ca-checkSkill
- sre-engineerSkill
- sre-expiry-auditSkill
- sre-gcpSkill
- sre-incident-commandSkill
- sre-incident-communicationSkill
- sre-k8s-safe-remediationSkill
- sre-k8s-triageSkill
- sre-k8s-upgrade-autopilotSkill
- sre-message-queue-triageSkill
- sre-migration-safetySkill
- sre-observability-cost-cutterSkill
- sre-oncall-auditSkill
- sre-oncall-handoffSkill
- sre-pagerduty-opsgenieSkill
- sre-php2shell-checkSkill
- sre-postmortem-templatesSkill
- sre-production-readinessSkill
- sre-prometheus-grafanaSkill
- sre-remediation-actionsSkill
- sre-runbook-templatesSkill
- sre-safety-gatesSkill
- sre-security-incident-triageSkill
- sre-service-mesh-triageSkill
- sre-slo-alertingSkill
- sre-slo-burn-rate-rulesSkill
- sre-terraformSkill
- sre-toil-reviewSkill
- sre-awsSkill
- sre-azureSkill
- sre-capacity-planningSkill
- sre-change-safetySkill
- sre-chaos-engineeringSkill
- sre-cloud-cost-reviewSkill
- sre-database-triageSkill
- sre-datadogSkill
- sre-dependency-mappingSkill
- sre-diagnosticsSkill
- sre-dr-backup-testSkill
- sre-dynatraceSkill
- sre-emudhra-ca-checkSkill
- sre-engineerSkill
- sre-expiry-auditSkill
- sre-gcpSkill
- sre-incident-commandSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Wait for explicit human approval before any prod-changing command, MCP write tool, or external post.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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.
Files
Observability Query Cookbook
Safety gates (REQUIRED)
- Read-only diagnosis first.
- Propose each change with risk (low/med/high) and reversibility.
- Wait for explicit human approval before any prod-changing command, MCP write tool, or external post.
- Act only as approved, verify, and stop and escalate if anything gets worse.
Full rules: sre-safety-gates. Read-only MCP setup: sre-safety-gates/references/mcp.md.
Adjust metric and label names to your environment. Dynatrace queries use Smartscape forms (dt.smartscape.*, getNodeName()); classic fallback is dt.entity.* with entityName(). Reviewed against Dynatrace dynatrace-for-ai skills. For tool-specific depth see sre-prometheus-grafana, sre-dynatrace, sre-datadog.
Error ratio (5xx / total)
sum(rate(http_requests_total{job="<svc>",code=~"5.."}[5m]))
/
sum(rate(http_requests_total{job="<svc>"}[5m]))# Datadog (APM)
# span name varies by integration: trace.<span_name>.errors / .hits
sum:trace.http.request.errors{service:<svc>}.as_count() / sum:trace.http.request.hits{service:<svc>}.as_count()timeseries { total = sum(dt.service.request.count), failed = sum(dt.service.request.failure_count) }, by: { dt.smartscape.service }
| fieldsAdd error_pct = if(total[] > 0, failed[] * 100.0 / total[])Latency p95
histogram_quantile(0.95, sum by (le) (rate(http_request_duration_seconds_bucket{job="<svc>"}[5m])))# Datadog (APM, distribution metric)
p95:trace.http.request{service:<svc>}timeseries p95_us = percentile(dt.service.request.response_time, 95), rollup: avg, by: { dt.smartscape.service }
// response_time is in microsecondsSaturation
# CPU used by container vs. limit (container!="" drops pod-level cgroup series that double-count; pods without limits drop out)
sum by (namespace, pod) (rate(container_cpu_usage_seconds_total{namespace="<ns>",container!="",container!="POD"}[5m]))
/
sum by (namespace, pod) (kube_pod_container_resource_limits{namespace="<ns>",resource="cpu",container!="",container!="POD"})# Datadog
# kubernetes.cpu.usage.total is in nanocores; kubernetes.cpu.limits is in cores.
# Ratio: convert usage to cores (/ 1e9) or limits to nanocores (* 1e9), never compare raw.
(avg:kubernetes.cpu.usage.total{kube_namespace:<ns>} by {pod_name} / 1e9) / avg:kubernetes.cpu.limits{kube_namespace:<ns>} by {pod_name}// verify Kubernetes metric keys in your environment (verify_dql)
timeseries { used = sum(dt.kubernetes.container.cpu_usage), lim = sum(dt.kubernetes.container.limits_cpu) }, by: { k8s.pod.name }, filter: k8s.namespace.name == "<ns>"
| fieldsAdd cpu_pct = if(lim[] > 0, used[] * 100.0 / lim[])
| sort arrayMax(cpu_pct) desc
| limit 10SLO burn rate (99.9% SLO, 1h window)
(
sum(rate(http_requests_total{job="<svc>",code=~"5.."}[1h]))
/
sum(rate(http_requests_total{job="<svc>"}[1h]))
) / (1 - 0.999)timeseries { total = sum(dt.service.request.count, scalar: true), failed = sum(dt.service.request.failure_count, scalar: true) }, by: { dt.smartscape.service }, from: now()-1h
| fieldsAdd burn = (failed / total) / (1 - 0.999)# Datadog SLO monitor query
burn_rate("<slo_id>").over("30d").long_window("1h").short_window("5m") > 14.4Page when burn > 14.4 over 1h AND > 14.4 over 5m (see sre-slo-alerting).
Logs
sum by (level) (count_over_time({app="<svc>"} |~ "(?i)error" | logfmt [5m]))
# Loki 3.x: use detected_level if the stream has no level labelfetch logs, from: now()-1h
| filter loglevel == "ERROR" and k8s.namespace.name == "<ns>"
| summarize errors = count(), by: { k8s.workload.name }
| sort errors desc# Datadog log search
service:<svc> status:errorKubernetes restarts
increase(kube_pod_container_status_restarts_total{namespace="<ns>"}[1h]) > 0timeseries restarts = sum(dt.kubernetes.container.restarts), by: { k8s.pod.name }, filter: k8s.namespace.name == "<ns>", from: now()-1h
| filter arraySum(restarts) > 0Output
- The query (with tool, time range, and assumptions about metric names) and how to read the result
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
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.

