π¦ ClawHub
Prometheus
by @ivangdavila
Prometheus monitoring patterns, cardinality management, alerting best practices, and PromQL traps.
TERMINAL
clawhub install promπ About This Skill
name: Prometheus description: Prometheus monitoring patterns, cardinality management, alerting best practices, and PromQL traps. metadata: category: infrastructure skills: ["prometheus", "monitoring", "alerting", "metrics", "observability"]
Cardinality Explosions
user_id as label kills Prometheusprometheus_tsdb_head_series metric β above 1M series needs attentionlabeldrop in scrape configHistogram vs Summary
Rate and Increase
rate() requires range selector at least 4x scrape interval β rate(metric[1m]) with 30s scrape misses datarate() is per-second, increase() is total over range β don't confuse themrate() handles this, raw delta doesn'tirate() uses only last two samples β too spiky for alerting, use rate() for alertsAlerting Mistakes
for clause prevents flapping: for: 5m means condition must hold 5 minutes before firingfor clause = fires immediately on first match = noisyrunbook_url label β on-call needs to know what to do, not just that something's wrongpromtool check rules β syntax errors discovered at 3am are badPromQL Traps
and is intersection by labels, not boolean AND β results must have matching label setsor fills in missing series, doesn't do boolean OR on values{} without metric name is expensive β scans all metricsoffset goes back in time: metric offset 1h is value from 1 hour agohttp_requests > 100 drops series below 100, doesn't return booleanScrape Configuration
honor_labels: true trusts source labels β use only when source is authoritative (e.g., Pushgateway)scrape_timeout must be less than scrape_interval β otherwise overlapping scrapesinsecure_skip_verify) should be temporary, never permanentPushgateway Pitfalls
curl -X DELETE http://pushgateway/metrics/job/myjobRecording Rules
record: job:request_duration_seconds:rate5mlevel:metric:operations β helps identify what rules produceFederation and Remote Write
Common Operational Issues
--storage.tsdb.wal-compression and monitor disk spaceLabel Best Practices
snake_case, prefix with domain: http_requests_total, node_cpu_seconds_totalle label is reserved for histogram buckets β don't use for other purposes