본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)41k · #6895

investigating-metric-anomalies

하는 일

이 스킬은 수집 지연이나 오류율처럼 인프라 지표가 왜 오르거나, 떨어지거나, 급증하는지 알아냅니다. 알림이나 걱정스러운 차트에 대응하는 엔지니어를 위한 것입니다.

사용하는 경우

  • ✓서버 지표에서 알림이 울려서 가능성 높은 원인을 알고 싶을 때.
  • ✓오류율, 지연 시간, 큐 깊이가 바뀌어서 이유를 알아야 할 때.
  • ✓지표 변화로 시작한 장애를 처리하고 있을 때.

스킬 링크

https://github.com/PostHog/posthog/blob/master/products/metrics/skills/investigating-metric-anomalies/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/PostHog/posthog/blob/master/products/metrics/skills/investigating-metric-anomalies/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“우리 수집 지연이 오늘 아침부터 계속 오르고 있습니다. 무엇이 원인인지 찾아 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

지표의 이름을 정하고, 변화의 크기와 시작 시점을 측정한 뒤, 그 무렵의 로그와 트레이스를 확인합니다. 증거를 합쳐 가능성 높은 원인을 제시합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Investigating metric anomalies

The job: go from a metric symptom ("ingestion lag is rising") to a probable cause with evidence, fast. The metric tells you what and when; logs and traces tell you why. Follow the loop below — it front-loads the cheap, high-information calls and only fans out when the blast radius is unclear.

The loop

1. Pin down the metric

If you have the exact metric name, skip ahead. Otherwise call metric-names-list with a substring from the symptom (lag, error, latency, queue). The returned metric_type decides the lens: counters (sum) are only meaningful as rate/increase, gauges as avg, histograms as histogram_quantile.

2. Characterize first — one call, three answers

Call characterize-metric-anomaly with the metric name and anomalyFrom (the alert fire time, or when the user says it started looking wrong; subtract some margin if unsure). It compares against the preceding window by default and answers:

  • How bad: direction, change_ratio, anomaly_peak vs baseline_mean. If direction is flat, your window or metric is wrong — widen the window, or compare against the same window yesterday via baselineFrom/baselineTo (daily-pattern metrics often look "anomalous" against the immediately-preceding hours).
  • When: onset_time — treat this timestamp as the pivot for everything that follows.
  • Where: top_movers — label values whose behavior changed. One mover (a single pod, shard, or endpoint) means a localized culprit; everything moving together means a shared cause (an upstream dependency, a deploy, infra).

3. Sharpen with targeted metric queries

Use query-metrics to test the hypotheses the report raises:

  • Drill a mover: re-query with filters pinning the suspicious label value, grouped by a second key, to localize further (pod → container, endpoint → status code).
  • Normalize: a rising error count means nothing if traffic doubled — use clauses + formula (errors / requests) to separate rate changes from volume changes.
  • Check the neighbors: query the obvious companion metrics over the same window (for lag: throughput and error counters of the same service; for latency: request rate and saturation gauges). Use the same interval so the grids align visually.

4. Correlate across signals at the onset

Pivot into logs and traces using the same service and a window bracketing onset_time (a few buckets before, through the peak):

  • Logs: use query-logs (follow its own discover-first workflow) filtered to the implicated service.name and window, severity error first, then warn. Restarts, crash loops, connection errors, and deploy markers right before onset are the classic causes. Widen to other services in the request path if the service's own logs are clean.
  • Traces: use the APM span tools (query-apm-spans etc.) for the same service/window — slow or erroring spans show which dependency degraded, and a trace_id from an exemplar or log line links a concrete request across all three signals.

5. Conclude with evidence, not vibes

State: the symptom (metric, magnitude, onset), the probable cause (what you found in logs/traces and how its timing aligns with the onset), the blast radius (which services/labels are affected, from the movers and grouped queries), and the confidence level. If the cause is still ambiguous, say which hypothesis the evidence favors and what would disambiguate (e.g. "the lag began draining at 20:12 — consistent with a consumer restart; check who restarted it").

Worked example: "ingestion lag is rising — why?"

  1. metric-names-list with value: "lag" → logs_rate_limiter_message_lag_seconds (histogram) and friends.
  2. characterize-metric-anomaly on it with anomalyFrom = alert time → direction up, change ratio 40x, onset_time 20:10, top mover service_name = logs-ingestion (the other services' lag stayed flat) — so the logs consumer specifically is behind, not the whole pipeline.
  3. query-metrics: rate of the consumer's throughput counter over the same window → throughput was zero during the gap and spiked after onset: the consumer wasn't slow, it was down, and the "rising lag" is it draining the backlog.
  4. query-logs for service.name = logs-ingestion (and its neighbors) around 20:00–20:15 → process exit + restart lines at the gap boundaries.
  5. Conclusion: consumer outage 20:01–20:10 (restart visible in logs); lag spike is backlog
자주 묻는 질문

스킬은 문제가 언제 시작했는지 어떻게 찾나요?

변화의 시작 시점을 찾고, 그 시각을 로그와 트레이스를 볼 시작점으로 씁니다.

지표가 평평해 보이면 어떻게 하나요?

시간 창이나 지표가 잘못되었을 수 있으므로, 스킬은 창을 넓히거나 어제 같은 시각과 비교합니다.

문제를 고치나요?

아니요. 가능성 높은 원인을 증거와 함께 설명해서, 무엇을 고칠지 사용자가 결정하게 합니다.

상세 정보

작성자의 원본 설명

Investigates server/infrastructure metric anomalies in PostHog Metrics — from "this metric is rising/dropping/spiking" or a fired alert to a probable cause with evidence. Use when asked why a metric looks wrong (ingestion lag rising, error rate spiking, latency degrading, queue depth growing, throughput dropping), when an alert fires on an OTel/Prometheus metric, or for any incident triage that starts from a metric symptom. Composes characterize-metric-anomaly, query-metrics, and metric-names-list with logs (query-logs) and traces (APM span tools) for cross-signal root-cause correlation.

repo: PostHog/posthog

인기도

GitHub 스타
41k
순위
#6895
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬