Custom Metrics
In Metric Monitors and Comparison Monitors, users can define custom metrics using SQL. Defining a custom metric is helpful when:
- The desired metric isn't one of the available metrics. For example:
APPROX_PERCENTILE(order_amount, 0.99)
. This metric measures the 99th percentile of order_amount. While there is an available metric for 80th percentile, there is not 99th, and so a custom metric is needed.
- The user needs to references multiple fields in the metric. For example:
AVG(price + tax_collected)
: this metric measures the average value of price plus tax_collected.COUNT(DISTINCT(CONCAT(invoice_number, line_item)))/COUNT(*)
: this metric measures the uniqueness (%) of the concatenation of invoice_number and line_item.
To add a custom metric, select Custom in the metric dropdown in the Define alert conditions section of the monitor.
In a Metric Monitor, provide a metric name and a SQL expression, then test the metric to confirm it works.

In a Comparison Monitor, provide a metric name and a SQL expression for source and target, then test each metric to confirm they work.

Updated 12 days ago