Monitoring
Monitoring
The activity of observing system state in real time. Uses tools such as Prometheus, Grafana, and Datadog.
Monitoring
The activity of observing system state in real time. Uses tools such as Prometheus, Grafana, and Datadog.
Monitoring is the activity of collecting and observing a system's status, performance, and availability in real time. It forms the basis for failure detection, performance optimization, and capacity planning, and is a core competency of DevOps and SRE.
Types of monitoring include infrastructure monitoring (CPU, memory, disk), application monitoring (APM, response time), business monitoring (conversion rate, revenue), and synthetic monitoring (external probes). Metrics are collected at each layer to understand the health of the entire system.
Key tools include Prometheus (metric collection), Grafana (visualization), Datadog (integrated platform), and New Relic (APM). Prometheus scrapes metrics from targets using a pull model and is queried with PromQL. Dashboards are visualized with Grafana, and notifications are sent with Alertmanager.
In practice, key indicators are defined using the RED (Rate, Errors, Duration) and USE (Utilization, Saturation, Errors) methodologies. Service levels are measured based on SLI/SLO, and thresholds are set carefully to reduce alert fatigue.
# prometheus.yml - Prometheus 설정
global:
scrape_interval: 15s
evaluation_interval: 15s
rule_files:
- "alerts.yml"
scrape_configs:
- job_name: 'kubernetes-pods'
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
alerting:
alertmanagers:
- static_configs:
- targets: ['alertmanager:9093']
---
# alerts.yml - 알림 규칙
groups:
- name: service-alerts
rules:
- alert: HighErrorRate
expr: |
sum(rate(http_requests_total{status=~"5.."}[5m])) /
sum(rate(http_requests_total[5m])) > 0.05
for: 5m
labels:
severity: critical
annotations:
summary: "High error rate detected ({{ $value | humanizePercentage }})"
- alert: SlowResponseTime
expr: |
histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[5m]))
by (le, service)) > 2
for: 5m
labels:
severity: warning
annotations:
summary: "P95 latency above 2s for {{ $labels.service }}"
- alert: PodMemoryHigh
expr: |
container_memory_usage_bytes / container_spec_memory_limit_bytes > 0.9
for: 10m
labels:
severity: warning
annotations:
summary: "Pod memory usage above 90%"
Senior: "We're getting too many alerts at night, so we need to revisit the thresholds."
Junior: "After analyzing it, the 90% threshold turned out to be within the normal operating range. I adjusted it to 95% and also extended the for condition to 10 minutes."
Interviewer: "Please explain the RED and USE methodologies."
Candidate: "RED measures from a service perspective: Rate (requests per second), Errors (error rate), and Duration (response time). USE looks at it from a resource perspective: Utilization (usage rate), Saturation (queue length), and Errors (errors). RED is applied to services, and USE to infrastructure."
Take a mock interview on this topic → WIA SOOM AI Interview · Start for free
Reviewer: "I added a custom metric, but I think the cardinality is going to get high."
Developer: "I'll remove the user_id label and change it to aggregate by user_type."