investigating-metric-anomalies

Diagnoses server metric anomalies by correlating metrics, logs, and traces to root causes.

713|118|Updated Aug 11, 2020
One-click install
npx skills add https://github.com/PostHog/posthog-foss --skill investigating-metric-anomalies
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: investigating-metric-anomalies
Source: https://github.com/PostHog/posthog-foss/tree/main/products/metrics/skills/investigating-metric-anomalies
Command: npx skills add https://github.com/PostHog/posthog-foss --skill investigating-metric-anomalies

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When an infrastructure metric spikes, drops, or an alert fires, engineers need a fast, evidence-backed path from symptom to probable cause instead of manually poking at dashboards across metrics, logs, and traces.

Core Features & Use Cases

  • Anomaly characterization: Quantifies direction, magnitude, onset time, and top-moving label values of a metric anomaly in a single call.
  • Targeted metric drill-down: Uses filtered and normalized queries (e.g., errors divided by requests) to localize culprits to a pod, endpoint, or status code.
  • Cross-signal correlation: Pivots into logs and APM traces around the onset time to identify restarts, crashes, or degraded dependencies.
  • Use Case: An alert fires that ingestion lag is rising; the workflow identifies the lagging service, discovers its throughput dropped to zero during a consumer outage, and confirms via restart log lines that the lag spike is backlog drain.

Quick Start

Ask the agent to investigate why the ingestion lag metric started rising at 20:10 and find the probable cause with supporting evidence.

Frequently Asked Questions about investigating-metric-anomalies

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I investigate why a Prometheus metric is spiking?

Start by characterizing the anomaly to get its direction, magnitude, onset time, and top-moving label values. Then drill into the suspicious label values with filtered metric queries and correlate with logs and traces around the onset time to find the cause.

How to find the root cause of rising ingestion lag?

Characterize the lag metric to find which service is falling behind, then check that service's throughput counter over the same window. Zero throughput during the gap indicates the consumer was down, and logs around the onset typically reveal restarts or crashes.

What metric aggregation should I use for counters vs gauges?

Counters are only meaningful as rate or increase because they reset on process restart. Gauges should be read as averages, and histograms should be queried with histogram_quantile to inspect tail latency rather than trusting a flat average.

Why does a metric show a gap instead of zero values?

A gap in the series means the emitter stopped reporting, not that the value dropped to zero. When a label value vanishes from top movers, treat it as a dead emitter and pivot immediately to that service's logs.

Can I compare a metric anomaly against yesterday instead of the preceding hours?

Yes, by setting baselineFrom and baselineTo to the same window on a previous day. This is important for daily-pattern metrics, which often look anomalous when compared only against the immediately preceding hours.