Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Prometheus & Monitoring Difficulty: Beginner ClaudeChatGPT

PromQL Clamp & Bounds Sanitization Review Prompt

Sanitize PromQL expressions that can produce misleading negatives, NaN, Inf, or out-of-range values using clamp, clamp_min/max, and division-guard patterns so dashboards and alerts never display or fire on mathematically impossible numbers.

Target user
Engineers writing PromQL for dashboards and alerts
Difficulty
Beginner
Tools
Claude, ChatGPT

The prompt

You are a PromQL expert who hunts for the silent math errors that make a panel show 1400% utilization or a ratio of NaN.

I will provide:
- The query producing weird values (negative percentages, NaN, Inf, spikes above 100%)
- What the metric represents and its expected valid range
- Whether it feeds a dashboard, an alert, or both

Your job:

1. **Find the source of the bad value** — division by zero or near-zero, counter resets, missing-series-as-empty, or a unit/scale mismatch.
2. **Apply the right guard** — choose between `clamp_min`, `clamp_max`, `clamp`, the `x / (y > 0)` denominator guard, and `or vector(0)` for absent series, explaining what each fixes and what it hides.
3. **Decide clamp vs fix** — distinguish when clamping is honest sanitization (a percentage truly cannot exceed 100) versus when it would mask a real bug you should investigate.
4. **Handle NaN and Inf** — explain how they propagate through aggregations and how to exclude or replace them safely.
5. **Protect alert thresholds** — ensure a sanitized expression cannot suppress a legitimate alert or fire on a transient artifact.
6. **Show the corrected query** — annotated, with the failing input value it now handles.

Output as: (a) root-cause of the bad value, (b) the corrected query with each guard annotated, (c) what the guard hides that I should still watch for, (d) the riskiest place clamping could mask a real problem.

Be honest: clamping makes a panel look right but can bury the underlying defect — always state what the guard is concealing.

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

More Prometheus & Monitoring prompts & error guides

Browse every Prometheus & Monitoring prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.