Monitors as Code - Legacy Metric Monitor
We strongly recommend using the more up to date metric property. However, users can still deploy the legacy version of this monitor under the field_health
property.
Monitors created with the field_health
property do not receive any new improvements.
Parameters
table
: MC global table ID (format<database>:<schema>.<table name>
alert_conditions
: List of configurations for metrics, fields, and breach conditions. A field may only be included once in a monitor for a given metric. See section below for details.segmented_expressions
: List of fields or SQL expressions used to segment the field (must have exactly one field infields
). Enables Monitoring by Dimension.segmentation_type
:field
orcustom_sql_expression
. Defaults tofield
.field
supports up to 2 fields. The fields must exist in the table.custom_sql_expression
supports 1 custom SQL expression.
timestamp_field
: Timestamp fieldtimestamp_field_expression
: Arbitrary SQL expression to be used as timestamp field, e.g.DATE(created)
. Must use eithertimestamp_field
ortimestamp_field_expression
or neither.where_condition
: SQL snippet of where condition monitor's querylookback_days
: Lookback period in days. Default: 3. This option is optional and will be ignored unlesstimestamp_field
is set.aggregation_time_interval
: Aggregation bucket time interval, eitherhour
(default) orday
. This option is optional and will be ignored unlesstimestamp_field
is set.min_segment_size
: Minimum number of rows for a segment to be fetched. Defaults to 1. Can be used to avoid cardinality limits for datasets with a long tail of less-relevant segments.sensitivity_level
: Set sensitivity level to One ofhigh
,medium
orlow
.schedule
type
: One offixed
ordynamic
interval_minutes
: For fixed, how frequently to run the monitorstart_time
: When to start the schedule. If unspecified, for fixed schedules, then start sometime within the next hour.timezone
: Optional - select regional timezone for daylight savings ex. America/Los_Angeles
connection_name
: Specify the connection (also known as query-engine) to use. Obtain the warehouse UUID via thegetUser
API as described here. Then obtain names of the connections in the warehouse via the getWarehouseConnections API as described here. Use["sql_query"]
as thejobType
parameter in thegetWarehouseConnections
API call.
Each Metric Monitor supports up to 300 monitored fields (or custom metrics).
Metric monitor alert conditions
operator
: acceptsAUTO
,GT
,GTE
,LT
,LTE
,EQ
,NEQ
,OUTSIDE_RANGE
,INSIDE_RANGE
.AUTO
uses ML to detect breaches. All other operators require an explicit threshold.fields
: List of field names that should be monitored for this metric, operator, and threshold. This field is optional and defaults to all fields in the table. The field type must be compatible with the metric.- Each field may only be included once in the monitor for a given metric (including as part of an "all fields" metric).
- When using a custom metric,
fields
should not be included; the fields used should be included directly in the SQL expression.
threshold_value
: Breach threshold for the operator. Not used forAUTO
,OUTSIDE_RANGE
, orINSIDE_RANGE
. For rate metrics, ensure the threshold is between 0 and 1 (not 0%-100%).lower_threshold
: Lower end of threshold range for operatorsOUTSIDE_RANGE
andINSIDE_RANGE
upper_threshold
: Upper end of threshold range for operatorsOUTSIDE_RANGE
andINSIDE_RANGE
metric
: See the list of available metrics for full details, including whether AUTO is supported for each metric and which field types are compatible. All operators besidesAUTO
are compatible with every metric. Use the value from theMaC Name
column in this field.custom_metric
: Allows defining a custom metric based on a SQL expression instead of a predefined metric indicated inmetric
. It can use any operator exceptAUTO
.
Updated 5 days ago