Observability with Prometheus & Grafana
Production-grade observability stack with Prometheus metrics, Grafana dashboards, PromQL query language, alerting rules, and AI-powered anomaly detection for…

Установить Observability with Prometheus & Grafana в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Observability with Prometheus & Grafana
Overview
Master production observability with Prometheus and Grafana - the industry-standard monitoring stack for cloud-native applications. Learn metrics collection, PromQL query language, dashboard design, alerting, and AI-powered anomaly detection (Grafana AI Observability 2024).
When to Use This Skill
- Monitoring production applications and infrastructure
- Implementing SLOs (Service Level Objectives) and SLIs
- Creating custom metrics for business KPIs
- Setting up alerting for proactive incident response
- Debugging performance issues with metrics analysis
- Tracking API latency, error rates, and throughput
- Monitoring AI/ML model performance in production
Core Principles
1. The Four Golden Signals (Google SRE)
# Always monitor these four metrics for every service:
# 1. Latency - How long requests take
http_request_duration_seconds_bucket{le="0.1", job="api"} 8500
http_request_duration_seconds_bucket{le="0.5", job="api"} 9800
http_request_duration_seconds_sum{job="api"} 2450
http_request_duration_seconds_count{job="api"} 10000
# 2. Traffic - How many requests
http_requests_total{method="GET", status="200"} 50000
# 3. Errors - How many requests fail
http_requests_total{method="POST", status="500"} 150
# 4. Saturation - How "full" is the service
node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes < 0.2
2. Metric Types
from prometheus_client import Counter, Gauge, Histogram, Summary, Info
# Counter - Monotonically increasing (requests, errors)
request_count = Counter(
'http_requests_total',
'Total HTTP requests',
['method', 'endpoint', 'status']
)
request_count.labels(method='GET', endpoint='/api/users', status='200').inc()
# Gauge - Can go up or down (memory usage, queue size)
active_connections = Gauge(
'active_database_connections',
'Number of active database connections'
)
active_connections.set(25)
active_connections.inc() # Increment
active_connections.dec() # Decrement
# Histogram - Track distributions (latency, request sizes)
request_duration = Histogram(
'http_request_duration_seconds',
'HTTP request duration',
buckets=[0.01, 0.05, 0.1, 0.5, 1.0, 5.0] # Define buckets
)
with request_duration.time():
process_request()
# Summary - Similar to histogram, calculates quantiles
response_size = Summary(
'http_response_size_bytes',
'HTTP response size in bytes'
)
response_size.observe(1024)
# Info - Static metadata
app_info = Info('app_version', 'Application version info')
app_info.info({'version': '1.2.3', 'environment': 'production'})
When to use each type:
- Counter: Total requests, errors, bytes transferred
- Gauge: Current memory, active users, queue depth
- Histogram: Request latency, response sizes (use for percentiles)
- Summary: Similar to histogram, cheaper but less flexible
3. PromQL Essentials
# Basic queries
http_requests_total # Instant vector (latest value)
http_requests_total[5m] # Range vector (5 minute window)
# Label matching
http_requests_total{method="GET"} # Exact match
http_requests_total{method=~"GET|POST"} # Regex match
http_requests_total{method!="OPTIONS"} # Not equal
# Aggregation operators
sum(rate(http_requests_total[5m])) by (status) # Requests per second by status
avg(http_request_duration_seconds) by (endpoint) # Average latency by endpoint
max(node_memory_MemTotal_bytes) without (instance) # Max memory across instances
# Rate and increase (for counters)
rate(http_requests_total[5m]) # Per-second rate over 5 minutes
increase(http_requests_total[1h]) # Total increase over 1 hour
irate(http_requests_total[5m]) # Instant rate (sensitive to spikes)
# Histogram quantiles (percentiles)
histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m])) # p95 latency
histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m])) # p99 latency
# Math and comparisons
(sum(rate(http_requests_total{status=~"5.."}[5m]))
/ sum(rate(http_requests_total[5m]))) * 100 # Error rate percentage
node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes < 0.1 # Memory <10%
# Logical operators
(rate(http_requests_total[5m]) > 100) and (http_request_duration_seconds > 1)
4. Alerting Rules
# /etc/prometheus/alerts.yml
groups:
- name: api_alerts
interval: 30s
rules:
# High error rate
- alert: HighErrorRate
expr: |
(sum(rate(http_requests_total{status=~"5.."}[5m])) by (service)
/ sum(rate(http_requests_total[5m])) by (service)) > 0.05
for: 5m
labels:
severity: critical
team: backend
annotations:
summary: "High error rate on {{ $labels.service }}"
description: "Error rate is {{ $value | humanizePercentage }} (threshold: 5%)"
runbook: "https://wiki.company.com/runbooks/high-error-rate"
# High latency (p99)
- alert:
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Observability with Prometheus & Grafana?
Production-grade observability stack with Prometheus metrics, Grafana dashboards, PromQL query language, alerting rules, and AI-powered anomaly detection for modern cloud-native applications
Как установить скилл Observability with Prometheus & Grafana?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Observability with Prometheus & Grafana запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
