Overview

The Metrics Monitor Template allows for applying statistical operations to analyze and understand the characteristics of datasets. It supports both dynamic and static thresholds (including relative thresholds) to trigger alerts based on aggregation results over specified time windows.

Previously known as Smart Metrics, this monitor was designed to detect anomalies using machine learning (ML) and seasonality-based thresholds. Now, it also includes support for static threshold settings, enabling users to monitor for absolute or relative value deviations.

How to

Available Operations

Normalized Average

A value adjusted relative to a range of [0;1], often used to make data comparable across different sources or categories. It is also useful for clients who want to monitor trends while keeping actual values private.

Use Case: A large international retail enterprise uses normalized averages to compare sales data across different regions.

Sum

Calculates the total value by adding all individual values together. This operation gives a simple overview of the total magnitude of the values being monitored.

Distinct Count

Counts the number of unique values in a set, which helps in identifying the variety within the dataset.

Use Case: Counting unique customers or products sold.

Max (Maximum)

Identifies the largest value in a dataset, useful for spotting extreme occurrences.

Use Case: Displaying the maximum sales in a month.

Min (Minimum)

Identifies the smallest value, useful for finding the lower extremes in a dataset.

Use Case: Finding the lowest transaction amount in a day.

Average (Mean)

Calculates the central value by summing all values and dividing by the number of entries. It gives an idea of the typical value in the dataset.

Use Case: Calculating the average daily sales of a grocery store chain.

Variance

Measures how far each number in the dataset is from the mean, indicating the amount of spread in the data.

Use Case: Analyzing the variance of a restaurant bill per customer.

Standard Deviation

Quantifies the amount of variation or dispersion in a dataset.

Use Case: Assessing how far sales values deviate from the average.

Quantile

Divides a dataset into equal-sized subsets. Quantiles help in understanding the distribution and identifying median or percentile values.


Threshold Types

The Metrics monitor supports various types of thresholds to trigger alerts. You can configure the thresholds to be dynamic, static, or relative, depending on your monitoring needs.

Dynamic Threshold

Dynamic thresholds use machine learning (ML) to detect seasonality and anomalies in the data. These thresholds automatically adjust based on seasonal patterns, making them ideal for time-series data and anomaly detection.

Static Threshold

Static thresholds are predefined fixed limits. You set a minimum and/or maximum value, and alerts are triggered if the monitored data falls outside these boundaries. These are useful for straightforward, rule-based monitoring.

Relative Percentage Threshold

A relative threshold compares the current data with the previous time window's values using percentage-based changes. Alerts are triggered when the value changes by a certain percentage beyond a defined range. This is useful for monitoring changes relative to previous performance.


As Code

Threshold Examples

Dynamic Threshold

parameters:
  kind: Metrics
  field: COUNT_ITEMS
  aggregation:
    kind: Sum
  threshold:
    kind: Dynamic
    sensitivity: 26
  timeWindow:
    field: auto
    firstRun: P365D
    frequency: P1D

Explanation: This dynamic threshold monitor checks the COUNT_ITEMS field using a sum aggregation, with a sensitivity of 26. The threshold automatically adjusts based on seasonal patterns using machine learning and detects anomalies accordingly.

Static Threshold (Minimum)

parameters:
  kind: Metrics
  field: COUNT_ITEMS
  aggregation:
    kind: Sum
  threshold:
    kind: Static
    min: 0
  timeWindow:
    field: auto
    firstRun: P365D
    frequency: P1D

Explanation: This static threshold monitor checks the COUNT_ITEMS field using a sum aggregation and alerts if the value falls below 0.

Relative Percentage Threshold

parameters:
  kind: Metrics
  field: COUNT_ITEMS
  aggregation:
    kind: Sum
  threshold:
    kind: Static
    comparisonMode: RelativePercentage
    min: -5%
    isMinInclusive: false
    max: 5%
    isMaxInclusive: false
  timeWindow:
    field: auto
    firstRun: P365D
    frequency: P1D

Explanation: This monitor checks if the COUNT_ITEMS value increases by more than 5% or decreases by more than 5% relative to the previous period. Alerts are triggered if the change exceeds this range.


Time Window Configuration

Metrics monitors can be configured to operate over specific time windows. The timeWindow parameter is automatically set in the examples above with a frequency of P1D (daily), and the first run considers data from the past 365 days.

timeWindow:
  field: auto
  firstRun: P365D
  frequency: P1D

This configuration helps ensure that the thresholds are applied within a consistent time window, such as daily analysis or longer historical trends.