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 in fields). Enables Monitoring by Dimension.
  • segmentation_type: field or custom_sql_expression. Defaults to field.
    • field supports up to 2 fields. The fields must exist in the table.
    • custom_sql_expression supports 1 custom SQL expression.
  • timestamp_field: Timestamp field
  • timestamp_field_expression: Arbitrary SQL expression to be used as timestamp field, e.g. DATE(created). Must use either timestamp_field or timestamp_field_expression or neither.
  • where_condition: SQL snippet of where condition monitor's query
  • lookback_days: Lookback period in days. Default: 3. This option is optional and will be ignored unless timestamp_field is set.
  • aggregation_time_interval: Aggregation bucket time interval, either hour (default) or day. This option is optional and will be ignored unless timestamp_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 of high, medium or low.
  • schedule
    • type: One of fixed or dynamic
    • interval_minutes: For fixed, how frequently to run the monitor
    • start_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 the getUser API as described here. Then obtain names of the connections in the warehouse via the getWarehouseConnections API as described here. Use ["sql_query"] as the jobType parameter in the getWarehouseConnections API call.

Each Metric Monitor supports up to 300 monitored fields (or custom metrics).

Metric monitor alert conditions

  • operator: accepts AUTO, 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 for AUTO, OUTSIDE_RANGE, or INSIDE_RANGE. For rate metrics, ensure the threshold is between 0 and 1 (not 0%-100%).
  • lower_threshold: Lower end of threshold range for operators OUTSIDE_RANGE and INSIDE_RANGE
  • upper_threshold: Upper end of threshold range for operators OUTSIDE_RANGE and INSIDE_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 besides AUTO are compatible with every metric. Use the value from the MaC Name column in this field.
  • custom_metric: Allows defining a custom metric based on a SQL expression instead of a predefined metric indicated in metric. It can use any operator except AUTO.