Production Observability: Alerts, Dashboards, Traces

Instruments services and writes correct PromQL alerts, Grafana dashboards, structured logs, and traces that catch real incidents.

Development / DevOps & Infraobservabilityprometheus
by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“Set up monitoring, dashboards, and alerting for our production application”
Beforegeneric AI agent
Setting up monitoring is important for catching problems in production. You'll want to track metrics like CPU, memory, response time, and error rates. Prometheus and Grafana are popular tools for this. You'd need to instrument your application to send metrics to Prometheus. Then you can create dashboards in Grafana to visualize the data. You should probably define some alerts for when things go wrong. Structured logging helps debug issues too. It takes some time to configure everything properly, but it's worth the effort.
Afterwith Production Observability: Alerts, Dashboards, Traces
MONITORING STACK SETUP

ARCHITECTURE OVERVIEW
→ Prometheus: Scrapes metrics every 15 seconds
→ Grafana: Visualizes metrics, triggers alerts
→ Application: Instrumented with Prometheus client library
→ Structured logs: JSON logs → centralized storage (Loki optional)

STEP 1: PROMETHEUS CONFIG
File: prometheus.yml
→ Scrape interval: 15 seconds
→ Global timeout: 10 seconds
→ Targets: localhost:8080 (your app), localhost:9090 (node exporter)

Example scrape config:
COPY TO YOUR SETUP
Scrape job 1: application metrics (port 8080)
Scrape job 2: system metrics via node-exporter (port 9100)
Retention: 30 days (disk: ~50GB estimate)

STEP 2: APPLICATION INSTRUMENTATION
Library: Add to code: prometheus client for your language

Metrics to track (high value):
→ http_requests_total (counter: request count by endpoint, method, status)
→ http_request_duration_seconds (histogram: latency by endpoint)
→ database_query_duration_seconds (histogram: query slowness)
→ cache_hits_total (counter: cache efficiency metric)
→ errors_total (counter: by error type)
→ active_connections (gauge: current open connections)

Code example (Python):
from prometheus_client import Counter, Histogram, Gauge
http_requests = Counter('http_requests_total', 'Total requests', ['method', 'endpoint', 'status'])
http_duration = Histogram('http_request_duration_seconds', 'Request latency', ['endpoint'])

@app.route('/api/users')
def get_users():
  with http_duration.labels(endpoint='get_users').time():
    result = fetch_users()
    http_requests.labels(method='GET', endpoint='get_users', status='200').inc()
    return result

STEP 3: GRAFANA DASHBOARDS

DASHBOARD 1: System Health (for on-call engineers)
→ Panels:
  • CPU usage % (gauge, alert if > 80%)
  • Memory usage % (gauge, alert if > 85%)
  • Disk usage % (gauge, alert if > 90%)
  • Network IO (bytes in/out)
→ Layout: 4 panels top row
→ Refresh: 30 seconds

DASHBOARD 2: Application Performance
→ Panels:
  • Request rate (graph: requests/sec, colored by status code)
  • Response time P50/P95/P99 (graph: milliseconds)
  • Error rate % (graph: errors/total, red alert line at 5%)
  • Database query slowness (graph: slow queries in real-time)
  • Cache hit ratio % (gauge)
→ Drill-down: Click endpoint → see detailed latency breakdown

DASHBOARD 3: Business Metrics (for PMs)
→ Panels:
  • Active users (connected sessions gauge)
  • Signup events (counter, graph over time)
  • API calls by customer segment
  • Revenue impact (if tracking via metric tags)

STEP 4: ALERTING RULES

Alert Rule 1: High error rate
→ Condition: error_rate > 5% for 2 minutes
→ Action: Send to Slack #alerts channel
→ Notification: "Production: 7% errors detected. Check dashboard link."

Alert Rule 2: Slow database queries
→ Condition: p95 query duration > 500ms for 5 minutes
→ Action: Page on-call engineer
→ Notification: "Database performance degraded. Typical query: 650ms."

Alert Rule 3: High memory consumption
→ Condition: memory usage > 85% for 3 minutes
→ Action: Send to Slack
→ Escalate to: Page engineer if sustained 10 minutes

Alert Rule 4: Service unreachable
→ Condition: failed scrapes for 2 consecutive attempts
→ Action: Page on-call immediately
→ Notification: "CRITICAL: API service not responding."

STEP 5: STRUCTURED LOGGING

Log everything as JSON:
{
  "timestamp": "2024-07-31T14:22:15Z",
  "level": "ERROR",
  "service": "api",
  "message": "Database connection timeout",
  "trace_id": "abc-123-def",
  "user_id": 5047,
  "endpoint": "/api/users",
  "duration_ms": 2150
}

Benefit: Grep-able, queryable, connects to distributed traces

STEP 6: DEPLOYMENT
→ Docker compose file included (prometheus + grafana)
→ Or: Kubernetes manifests (if using K8s)
→ Startup: docker-compose up -d
→ Access Grafana: localhost:3000 (default admin/admin)

VERIFICATION CHECKLIST
☐ Prometheus scraping metrics (check /targets endpoint)
☐ At least 1 custom metric from your app (visible in Grafana)
☐ 1 dashboard created with 3+ panels
☐ 2 alert rules configured
☐ Alerts tested (trigger manually, confirm Slack delivery)
☐ On-call schedule linked to alerts

NEXT STEPS (not included in this setup)
→ Distributed tracing (Jaeger, optional)
→ Log aggregation (Loki, ELK stack)
→ Load testing (k6, Artillery) to establish baseline
→ Runbook linking (document what to do per alert)

ESTIMATED SETUP TIME
Prometheus config: 15 minutes
Instrument app: 1-2 hours (depends on codebase size)
Grafana dashboards: 1-2 hours (template provided)
Alerts: 30 minutes
Testing: 30 minutes
TOTAL: 4-6 hours for working monitoring system

About this skill

Your alerts fire at 3am for CPU blips while a real outage goes unnoticed, your p99 panel shows numbers that can't be right, and Prometheus memory keeps climbing. This skill writes monitoring the way an on-call engineer would. It checks the math of every query, keeps labels from exploding cardinality, and ties every page to something users actually feel.

What it does

  • Fixes PromQL that runs but is wrong, such as averaged percentiles, quantiles missing le, rate applied after sum, and windows too short for the scrape interval
  • Writes multiwindow burn-rate alert rules with traffic guards, absent() coverage, runbook links, and severity routing, so pages are rare and actionable
  • Lays out Grafana dashboards in RED/USE order, with deploy annotations and exemplars that link latency spikes to traces
  • Sets structured JSON logging and OpenTelemetry tracing conventions, including trace_id injection, propagation across queues, and tail-based sampling that keeps errors
  • Runs incident triage as a step-by-step sequence of exact queries, from the broken SLI to the dimension, the change, the trace, and the log line
  • Writes k6 load tests on an open model with thresholds set up front, plus capacity forecasts built on weeks of data instead of a single spike

What you get

Working artifacts you can paste in: PromQL, alert and recording rule YAML, dashboard row specs, logging and tracing conventions, or a k6 script. Each comes with a short explanation of the non-obvious choices and clearly labeled assumptions about your metric names.

Best for

Backend and platform engineers running Prometheus, Grafana, and OpenTelemetry, and teams with noisy or untrustworthy alerting.

SKILL.md preview

SKILL.md
---
name: production-observability-alerts-dashboards-traces

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →