Anomaly Detection

Automated spike and dip detection vs. a statistical baseline.

Overview

Anomaly Detection automatically identifies unusual spikes or dips in a metric compared to a statistical baseline. This is alert-mode, not view-mode — the LLM is told what deviated and by how much, rather than being asked to interpret a time series. Use it for automatic monitoring of key metrics where you want to be notified when something unusual happens.

When to use anomaly: "Alert me when error rates spike", "Did anything unusual happen with revenue this week?", "Detect and explain anomalies in daily active users."

When NOT to use anomaly: If you want to view a time-series trend without automated detection, use trend. If you want step-by-step drop-off analysis, use funnel.

Configuration Reference

Prop

Type

AnomalyMetricDef Properties

Prop

Type

AnomalyBaselinetype values

ValueMeaning
"rolling_average"Average of the metric over the last windowDays days
"same_period_last_week"Same time period from the previous week
"same_period_last_month"Same time period from the previous month

Available Template Variables

VariableDescription
{{metricCount}}Number of metrics being monitored
{{totalAnomalies}}Total number of anomalous time buckets detected across all metrics
{{anomalySummary}}Per-metric anomaly details (metric label, deviation magnitude, direction)
{{windowPeriod}}Human-readable analysis window, e.g. "last 14 days"
{{dataAsJson}}Full structured result as JSON
{{executedAt}}ISO 8601 execution timestamp

Example

.journium/trackers/error-rate-anomaly.yml
apiVersion: journium.app/v0Beta
kind: InsightTracker
metadata:
  name: error-rate-anomaly
  displayName: Error Rate Anomaly Detection
  description: Alert when error event rates spike above statistical normal
spec:
  type: LLM
  trigger:
    mode: automatic
    schedule: daily
  window:
    period: last_14d
    granularity: hour
  analysis:
    type: anomaly
    metrics:
      - event: error_occurred
        aggregation: count
        groupBy: hour
        label: Error Rate
      - event: api_call_failed
        aggregation: count
        groupBy: hour
        label: API Failure Rate
    baseline:
      type: rolling_average
      windowDays: 14
    threshold:
      stdDeviations: 2.5
      minAbsoluteChange: 10
    includeTimeSeries: false
  llm:
    promptTemplate: |
      Error monitoring report for {{windowPeriod}}.
      {{metricCount}} metrics monitored. {{totalAnomalies}} anomalous periods detected.
      Anomaly summary:
      {{anomalySummary}}
      Full data: {{dataAsJson}}
      Describe the most significant anomaly, its likely cause, and recommended response.
    maxOutputTokens: 500

How is this guide?

Last updated on

On this page