인터페이스는 현지화되어 있으며, Skill 소개와 설명 문서는 선택한 언어로 AI가 자동 번역합니다. 코드·명령어·경로·전문 용어는 원문을 유지하며 원작자 문서가 우선합니다.
Skills 둘러보기
디자인 및 창작 · SKILL.md

monitoring-setup

monitoring-setup

Design monitoring and observability stacks — metrics, logs, traces, dashboards, alerting rules, and SLI/SLO definitions for production systems. TRIGGER when: user says /monitoring-setup, asks to set up monitoring, design observability, create dashboards, or configure alerting for a service.

Independent GitHub snapshot · Automated classification · Original documentation governs

Skill 문서

GitHub

name: monitoring-setup description: > Design monitoring and observability stacks — metrics, logs, traces, dashboards, alerting rules, and SLI/SLO definitions for production systems. TRIGGER when: user says /monitoring-setup, asks to set up monitoring, design observability, create dashboards, or configure alerting for a service. argument-hint: "[service name, architecture description, or monitoring tool]" user-invocable: true

Monitoring & Observability Setup

You are a senior SRE designing a monitoring and observability strategy. Produce a comprehensive, actionable monitoring plan that gives engineers confidence in their systems.

Process

Step 1: Understand the System

Before designing monitoring, determine:

  • What services and components are in scope?
  • What is the architecture? (monolith, microservices, serverless, event-driven)
  • What infrastructure? (Kubernetes, VMs, managed services, multi-cloud)
  • What are the critical user journeys?
  • What monitoring tools are already in use? (Datadog, Prometheus, Grafana, CloudWatch, New Relic, Splunk)
  • What are the team's SLOs and on-call practices?

Step 2: Define the Three Pillars

Metrics

Metric CategoryExamplesCollection MethodRetention
RED Metrics (Request)Rate, Errors, DurationApplication instrumentation (Prometheus client, StatsD)15-30 days high-res, 1 year downsampled
USE Metrics (Resource)Utilization, Saturation, Errors per resourceNode exporter, cAdvisor, cloud provider metrics15-30 days high-res, 1 year downsampled
Business MetricsSignups, orders, payments, active usersApplication events, analytics pipeline1-2 years
Dependency MetricsExternal API latency, DB query time, cache hit rateClient-side instrumentation, service mesh15-30 days
Infrastructure MetricsCPU, memory, disk I/O, network, container restartsInfrastructure agent, cloud APIs15-30 days

Naming Convention:

<namespace>_<subsystem>_<metric_name>_<unit>
Example: myapp_http_request_duration_seconds
Example: myapp_db_query_total

Logs

Log LevelWhen to UseRetentionExamples
ERRORUnexpected failures requiring attention90 daysUnhandled exceptions, failed API calls, data corruption
WARNDegraded behavior, recoverable issues30 daysRetry succeeded, deprecated API used, nearing quota
INFOSignificant business events30 daysUser login, order placed, deployment started
DEBUGDiagnostic detail for troubleshooting7 days (or on-demand)Request payloads, cache decisions, query plans

Structured Logging Standard:

{
  "timestamp": "2026-04-08T10:30:00Z",
  "level": "ERROR",
  "service": "payment-service",
  "trace_id": "abc123",
  "span_id": "def456",
  "message": "Payment processing failed",
  "error_code": "GATEWAY_TIMEOUT",
  "customer_id": "cust_789",
  "amount_cents": 4999,
  "duration_ms": 30000
}

Log Aggregation Pipeline:

  1. Application emits structured JSON logs to stdout
  2. Log collector (Fluentd, Fluent Bit, Vector) ships logs
  3. Central store (Elasticsearch, Loki, CloudWatch Logs) indexes logs
  4. Query interface (Kibana, Grafana, CloudWatch Insights) for search

Traces

ComponentPurposeTool Examples
InstrumentationAdd trace context to requestsOpenTelemetry SDK, Jaeger client
PropagationPass trace context across service boundariesW3C Trace Context, B3 headers
CollectionReceive and process spansOpenTelemetry Collector, Jaeger agent
StorageStore and index tracesJaeger, Tempo, X-Ray, Honeycomb
VisualizationView trace waterfalls, service mapsJaeger UI, Grafana Tempo, Honeycomb

Sampling Strategy:

  • Head-based sampling: Decide at trace start (e.g., sample 10% of requests). Simple but misses rare errors.
  • Tail-based sampling: Decide after trace completes. Keep all error traces, slow traces, and a sample of normal traces. Preferred for production.
  • Always sample: 100% of traces. Only feasible for low-traffic services or short retention.

Step 3: Design Dashboards

Dashboard Hierarchy

LevelAudienceContentRefresh Rate
Executive/SLOLeadership, productSLO status, error budgets, business metrics5 minutes
Service OverviewOn-call engineersRED metrics, dependency health, resource usage per service30 seconds
InfrastructurePlatform teamNode health, cluster capacity, network, storage30 seconds
DebuggingEngineers during incidentsDetailed per-endpoint metrics, log panels, trace links10 seconds
DeploymentRelease engineersDeploy markers, canary metrics, rollback triggers10 seconds

Service Overview Dashboard Template

Every service dashboard should include:

  1. Request Rate — Requests per second, broken down by endpoint and status code
  2. Error Rate — Percentage of 5xx responses, broken down by error type
  3. Latency Percentiles — P50, P90, P95, P99 response times
  4. Saturation — CPU usage, memory usage, connection pool utilization
  5. Dependencies — Latency and error rate for downstream calls (DB, cache, APIs)
  6. Deployment Markers — Vertical lines on graphs showing when deploys happened
  7. Alerts Status — Active alerts for this service

Step 4: Configure Alerting Rules

Alert TypeConditionSeverityResponse
Error Rate SpikeError rate > 5% for 5 minutesCriticalPage on-call
Latency DegradationP99 > 2x baseline for 5 minutesWarningNotify channel
Resource ExhaustionCPU > 85% or Memory > 90% for 10 minutesWarningAuto-scale or notify
Dependency DownDependency health check failing for 3 minutesCriticalPage on-call
Disk SpaceDisk usage > 80%WarningNotify; > 90% = Critical
Certificate ExpirySSL cert expires in < 14 daysWarningNotify; < 3 days = Critical
Error Budget BurnBurn rate > 10x for 1 hourCriticalPage on-call
No DataMetric stops reporting for 5 minutesWarningInvestigate collection pipeline

Alert Routing:

  • Critical -> PagerDuty/Opsgenie -> On-call engineer -> 5-minute acknowledgment SLA
  • Warning -> Slack channel -> Triage within 1 hour
  • Info -> Dashboard only, no notification

Step 5: Define SLIs and SLOs

SLIMeasurementGood EventSLO Target
AvailabilityHTTP status codesResponse is not 5xx99.9% (43.8 min/month downtime budget)
LatencyResponse timeResponse in < 300ms95% of requests
ThroughputSuccessful requests/secRequest completes successfullyBaseline +/- 20%
CorrectnessBusiness validationCorrect result returned99.99%

Step 6: Implement Health Checks

Check TypeEndpointWhat It ValidatesFrequency
Liveness/healthzProcess is running, not deadlockedEvery 10s
Readiness/readyzCan serve traffic (dependencies connected)Every 5s
Startup/startupzInitialization completeEvery 5s until ready
Deep Health/health/detailedAll dependencies reachable, checks passEvery 30s (internal only)

Output Format

## Monitoring Plan: [Service Name]

### System Overview
[Architecture diagram or description, key components]

### Metrics
[Key metrics to collect, instrumentation approach, naming]

### Logging
[Log levels, structured format, aggregation pipeline]

### Tracing
[Instrumentation, sampling strategy, storage]

### Dashboards
[Dashboard list with panels, organized by audience]

### Alerting Rules
[Rules table with conditions, severity, routing]

### SLIs / SLOs
[Definitions with targets and measurement method]

### Health Checks
[Endpoints, what they validate, failure behavior]

### Implementation Checklist
[Prioritized tasks to implement the monitoring plan]

Quality Checklist

  • All three pillars covered: metrics, logs, traces
  • Trace IDs propagated across all service boundaries and included in logs
  • Dashboards exist for every critical service
  • Alerting rules have clear severity, routing, and runbook links
  • SLOs are defined for all user-facing services
  • Health check endpoints are implemented and used by load balancers
  • Log retention policies comply with compliance requirements
  • Metric cardinality is bounded (no unbounded labels like user_id)
  • Sampling strategy is defined for traces
  • Cost of monitoring stack is estimated and within budget

Edge Cases

  • High-Cardinality Metrics: Never use unbounded values (user IDs, request IDs) as metric labels. Use traces for per-request detail. If you need per-customer metrics, use a top-N approach or separate analytics pipeline.
  • Monitoring the Monitoring: Ensure the observability stack itself is monitored. Set up alerts for Prometheus scrape failures, log pipeline lag, and trace collection errors. Use a separate, simpler system to monitor the primary monitoring stack.
  • Multi-Region / Multi-Cloud: Aggregate metrics across regions but preserve region labels. Alert on per-region AND global thresholds. Ensure log and trace collection works across network boundaries.
  • Ephemeral Infrastructure: For serverless or spot instances, use push-based metrics (StatsD, OTLP push) instead of pull-based (Prometheus scrape). Ensure instance metadata is captured before termination.
  • Cost Management: High-resolution metrics and full trace collection are expensive. Use downsampling, tiered retention, and tail-based sampling. Estimate costs before enabling verbose collection.
  • PII in Logs/Traces: Scrub personally identifiable information before it enters the logging pipeline. Use allowlists for log fields rather than denylists. Audit log content regularly.
저장한 Skills