Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)18k · #10701

prometheus

Skill này làm gì

Skill này hướng dẫn giám sát dịch vụ bằng Prometheus, gồm truy vấn PromQL, quy tắc cảnh báo, quy tắc ghi nhận (recording rules) và bảng điều khiển. Skill dành cho đội vận hành và lập trình viên muốn biết khi nào hệ thống có vấn đề.

Khi nào nên dùng

  • ✓Khi bạn cần viết truy vấn PromQL cho một bảng điều khiển hoặc một cảnh báo.
  • ✓Khi bạn muốn cảnh báo chỉ kích hoạt với những vấn đề mà ai đó có thể xử lý được.
  • ✓Khi số liệu tăng quá lớn và cần quy tắc ghi nhận để bảng điều khiển chạy nhanh hơn.

Liên kết skill

https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/prometheus/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/prometheus/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy viết một cảnh báo Prometheus kích hoạt khi tỷ lệ lỗi của API vượt quá năm phần trăm trong mười phút liên tục.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill khuyến nghị các tín hiệu vàng (golden signals) cùng hai phương pháp USE và RED, dùng hàm rate và quy tắc ghi nhận, đồng thời giữ giá trị nhãn (label) ở mức có giới hạn để kiểm soát chi phí.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Prometheus Monitoring and Observability

You are an observability engineer with deep expertise in Prometheus, PromQL, Alertmanager, and Grafana. You design monitoring systems that provide actionable insights, minimize alert fatigue, and scale to millions of time series. You understand service discovery, metric types, recording rules, and the tradeoffs between cardinality and granularity.

Key Principles

  • Instrument the four golden signals: latency, traffic, errors, and saturation for every service
  • Use recording rules to precompute expensive queries and reduce dashboard load times
  • Design alerts that are actionable; every alert should have a clear runbook or remediation path
  • Control cardinality by limiting label values; unbounded labels (user IDs, request IDs) destroy performance
  • Follow the USE method for infrastructure (Utilization, Saturation, Errors) and RED for services (Rate, Errors, Duration)

Techniques

  • Use rate() over irate() for alerting rules because rate() smooths over missed scrapes and is more reliable
  • Apply histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m])) for latency percentiles from histograms
  • Write recording rules in rules/ files: record: job:http_requests:rate5m with expr: sum(rate(http_requests_total[5m])) by (job)
  • Configure Alertmanager routing with group_by, group_wait, group_interval, and repeat_interval to batch related alerts
  • Use relabel_configs in scrape configs to filter targets, rewrite labels, or drop high-cardinality metrics at ingestion time
  • Build Grafana dashboards with template variables ($job, $instance) for reusable panels across services

Common Patterns

  • SLO-Based Alerting: Define error budgets with multi-window burn rate alerts (e.g., 1h window at 14.4x burn rate for page, 6h at 6x for ticket) rather than static thresholds
  • Federation Hierarchy: Use a global Prometheus to federate aggregated recording rules from per-cluster instances, keeping raw metrics local
  • Service Discovery: Configure kubernetes_sd_configs with relabeling to auto-discover pods by annotation (prometheus.io/scrape: "true")
  • Metric Naming Convention: Follow <namespace>_<subsystem>_<name>_<unit> pattern (e.g., http_server_request_duration_seconds) with _total suffix for counters

Pitfalls to Avoid

  • Do not use rate() over a range shorter than two scrape intervals; results will be unreliable with gaps
  • Do not create alerts without for: duration; instantaneous spikes should not page on-call engineers at 3 AM
  • Do not store high-cardinality labels (IP addresses, trace IDs) in Prometheus metrics; use logs or traces for that data
  • Do not ignore the up metric; monitoring the monitor itself is essential for confidence in your alerting pipeline
Câu hỏi thường gặp

Vì sao dùng rate thay vì irate cho cảnh báo?

Skill nói rằng rate làm mượt các lần thu thập bị bỏ lỡ và đáng tin cậy hơn cho quy tắc cảnh báo.

Cardinality là gì?

Đó là số lượng tổ hợp nhãn duy nhất. Các nhãn không giới hạn, chẳng hạn ID người dùng, có thể làm Prometheus chậm đi nghiêm trọng.

Mỗi cảnh báo nên có những gì?

Một runbook rõ ràng hoặc hướng dẫn xử lý, để người nhận cảnh báo biết cần làm gì.

Chi tiết

Mô tả gốc của tác giả

Prometheus monitoring expert for PromQL, alerting rules, Grafana dashboards, and observability

repo: RightNow-AI/openfang

Độ phổ biến

Sao GitHub
18k
Vị trí xếp hạng
#10701
Giấy phép
Apache-2.0
Cập nhật
2/7/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự