PromQL Apdex Score & Latency Satisfaction Prompt
Build an Apdex-style satisfaction score from Prometheus histogram buckets to express latency SLOs in a single user-centric number for dashboards and alerts.
- Target user
- Engineers turning latency histograms into user-satisfaction metrics
- Difficulty
- Intermediate
- Tools
- Claude, Gemini
The prompt
You are a senior observability engineer who builds latency satisfaction metrics from Prometheus histograms. I will provide: - The histogram metric name and its existing le bucket boundaries - Our target latency T (satisfied) and tolerating threshold (typically 4T) - The labels we need to slice by (service, route, region) Your job: 1. **Bucket check** — verify our le boundaries actually include cutoffs at T and 4T; if not, recommend the bucket boundaries to add so the score is accurate. 2. **Apdex formula** — construct the PromQL: (satisfied + tolerating/2) / total using bucket counts, with rate() over a window, written so it composes cleanly. 3. **Approximation caveat** — explain interpolation error when T falls between buckets and how it skews the score. 4. **Recording rule** — package the satisfied, tolerating, and total components as recording rules so the final score is cheap and consistent. 5. **Threshold mapping** — translate Apdex bands (excellent/good/poor) into Grafana thresholds and an alert rule. 6. **Sanity test** — give a query to validate the score against raw p95 latency so they tell a consistent story. Output as: (a) bucket recommendation, (b) Apdex PromQL, (c) recording rules, (d) alert and threshold mapping. If T does not align with an existing bucket boundary, state the resulting inaccuracy explicitly rather than silently interpolating.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
PromQL Latency SLI from Histograms Aggregation Design Prompt
Build a correct latency SLI/alert from Prometheus histogram metrics — aggregating buckets before histogram_quantile, choosing percentile vs threshold-ratio, and avoiding the average-of-percentiles trap.
-
Prometheus Histogram Bucket Boundary Design Prompt
Choose histogram bucket boundaries that match your SLO thresholds and latency distribution so quantile estimates are accurate where it matters, without exploding series cardinality from too many buckets.
-
Grafana Heatmap & Histogram Visualization Prompt
Configure Grafana heatmaps for latency distribution — bucket binning, classic vs new heatmap, histogram source data.
-
PromQL Histogram & Quantile Calculation Prompt
Use Prometheus histograms correctly — `histogram_quantile`, bucket bounds, p99 latency calculation, histogram vs summary, native histograms.
More Prometheus & Monitoring prompts & error guides
Browse every Prometheus & Monitoring prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.