monitor_schema.models.Monitor#

class monitor_schema.models.Monitor[source]#

Customer specified monitor configs.

Show JSON schema
{
   "title": "Monitor",
   "description": "Customer specified monitor configs.",
   "type": "object",
   "properties": {
      "metadata": {
         "title": "Metadata",
         "description": "Meta. This is to track various metadata for auditing.",
         "allOf": [
            {
               "$ref": "#/definitions/Metadata"
            }
         ]
      },
      "id": {
         "title": "Id",
         "description": "A human-readable alias for a monitor. Must be readable",
         "maxLength": 128,
         "minLength": 10,
         "pattern": "[0-9a-zA-Z\\-_]+",
         "type": "string"
      },
      "displayName": {
         "title": "Displayname",
         "description": "A display name for the monitor if view through WhyLabs UI. Can only contain dashes, underscores,spaces, and alphanumeric characters",
         "maxLength": 256,
         "minLength": 10,
         "pattern": "[0-9a-zA-Z \\-_]+",
         "id": "DisplayName",
         "type": "string"
      },
      "tags": {
         "title": "Tags",
         "description": "A list of tags that are associated with the monitor.",
         "type": "array",
         "items": {
            "type": "string",
            "minLength": 3,
            "maxLength": 32,
            "pattern": "[0-9a-zA-Z\\-_]"
         }
      },
      "analyzerIds": {
         "title": "AnalyzerIds",
         "description": "The corresponding analyzer ID. Even though it's plural, we only support one analyzer at the moment",
         "maxItems": 100,
         "type": "array",
         "items": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_\\-]+$"
         }
      },
      "schedule": {
         "title": "Schedule",
         "description": "Schedule of the monitor. We only support hourly monitor at the finest granularity",
         "oneOf": [
            {
               "$ref": "#/definitions/FixedCadenceSchedule"
            },
            {
               "$ref": "#/definitions/CronSchedule"
            },
            {
               "$ref": "#/definitions/ImmediateSchedule"
            }
         ]
      },
      "disabled": {
         "title": "Disabled",
         "description": "Whether the monitor is enabled or not",
         "type": "boolean"
      },
      "severity": {
         "title": "Severity",
         "description": "The severity of the monitor messages",
         "default": 3,
         "type": "integer"
      },
      "mode": {
         "title": "Mode",
         "description": "Notification mode and how we might handle different analysis",
         "discriminator": {
            "propertyName": "type",
            "mapping": {
               "EVERY_ANOMALY": "#/definitions/EveryAnomalyMode",
               "DIGEST": "#/definitions/DigestMode"
            }
         },
         "oneOf": [
            {
               "$ref": "#/definitions/EveryAnomalyMode"
            },
            {
               "$ref": "#/definitions/DigestMode"
            }
         ]
      },
      "actions": {
         "title": "Actions",
         "description": "List of destination for the outgoing messages",
         "maxItems": 100,
         "type": "array",
         "items": {
            "anyOf": [
               {
                  "$ref": "#/definitions/GlobalAction"
               },
               {
                  "$ref": "#/definitions/SendEmail"
               },
               {
                  "$ref": "#/definitions/SlackWebhook"
               },
               {
                  "$ref": "#/definitions/RawWebhook"
               }
            ]
         }
      }
   },
   "required": [
      "analyzerIds",
      "schedule",
      "mode",
      "actions"
   ],
   "additionalProperties": false,
   "definitions": {
      "Metadata": {
         "title": "Metadata",
         "description": "Metadata for a top-level objects such as monitors, analyzers, and schema.\n\nThis object is managed by WhyLabs. Any user-provided values will be ignored on WhyLabs side.",
         "type": "object",
         "properties": {
            "version": {
               "title": "Version",
               "description": "A monotonically increasing numer that indicates the version of the object.",
               "type": "integer"
            },
            "schemaVersion": {
               "title": "Schemaversion",
               "description": "The version of the schema. Currently the accepted value is 1.",
               "minimum": 1,
               "maximum": 1,
               "type": "integer"
            },
            "updatedTimestamp": {
               "title": "Updatedtimestamp",
               "description": "Last updated timestamp",
               "exclusiveMinimum": 0,
               "type": "integer"
            },
            "author": {
               "title": "Author",
               "description": "The author of the change. It can be an API Key ID, a user ID, or a WhyLabs system ID.",
               "maxLength": 100,
               "pattern": "[0-9a-zA-Z-_.+]+",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "description": "A description of the object",
               "maxLength": 1000,
               "type": "string"
            }
         },
         "required": [
            "version",
            "updatedTimestamp",
            "author"
         ],
         "additionalProperties": false
      },
      "TimeRange": {
         "title": "TimeRange",
         "description": "Support for a specific time range.",
         "type": "object",
         "properties": {
            "start": {
               "title": "Start",
               "description": "Inclusive. Start time of a time range.",
               "type": "string",
               "format": "date-time"
            },
            "end": {
               "title": "End",
               "description": "Exclusive. End time of a time range.",
               "type": "string",
               "format": "date-time"
            }
         },
         "required": [
            "start",
            "end"
         ],
         "additionalProperties": false
      },
      "FixedCadenceSchedule": {
         "title": "FixedCadenceSchedule",
         "description": "Support for scheduling based on a predefined cadence.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "enum": [
                  "fixed"
               ],
               "type": "string"
            },
            "cadence": {
               "title": "Cadence",
               "description": "Frequency to run the analyzer or monitor, based on UTC time. The monitor will run at the start of the cadence with some SLA depending on the customer tiers.",
               "enum": [
                  "hourly",
                  "daily",
                  "weekly",
                  "monthly"
               ],
               "type": "string"
            },
            "exclusionRanges": {
               "title": "ExclusionRanges",
               "description": "Ranges of dates during which this Analyzer is NOT run.",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/TimeRange"
               }
            }
         },
         "required": [
            "type",
            "cadence"
         ],
         "additionalProperties": false
      },
      "CronSchedule": {
         "title": "CronSchedule",
         "description": "Support for scheduling.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "enum": [
                  "cron"
               ],
               "type": "string"
            },
            "cron": {
               "title": "Cron",
               "description": "Cron expression",
               "pattern": "(@(annually|yearly|monthly|weekly|daily|hourly))|((((\\d+,)+\\d+|(\\d+(\\/|-)\\d+)|\\d+|\\*) ?){5,7})",
               "type": "string"
            },
            "exclusionRanges": {
               "title": "ExclusionRanges",
               "description": "The ranges of dates during which this Analyzer is NOT run.",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/TimeRange"
               }
            }
         },
         "required": [
            "type",
            "cron"
         ],
         "additionalProperties": false
      },
      "ImmediateSchedule": {
         "title": "ImmediateSchedule",
         "description": "Schedule the monitor to run immediately.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "enum": [
                  "immediate"
               ],
               "type": "string"
            }
         },
         "required": [
            "type"
         ],
         "additionalProperties": false
      },
      "AnomalyFilter": {
         "title": "AnomalyFilter",
         "description": "Filter the anomalies based on certain criteria. If the alerts are filtered down to 0, the monitor won't fire.",
         "type": "object",
         "properties": {
            "includeColumns": {
               "title": "IncludeColumns",
               "description": "If set, we only include anomalies from these columns",
               "maxItems": 1000,
               "type": "array",
               "items": {
                  "type": "string",
                  "maxLength": 1000
               }
            },
            "excludeColumns": {
               "title": "ExcludeColumns",
               "description": "If set, we will exclude anomalies from these columns. This is applied AFTER the includeColumns",
               "maxItems": 1000,
               "type": "array",
               "items": {
                  "type": "string",
                  "maxLength": 1000
               }
            },
            "minWeight": {
               "title": "MinWeight",
               "description": "We will include only features with weights greater than or equal to this value. NOT SUPPORTED YET",
               "type": "number"
            },
            "maxWeight": {
               "title": "MaxWeight",
               "description": "We will include only features with weights less thanor equal to this value. NOT SUPPORTED YET",
               "type": "number"
            },
            "minRankByWeight": {
               "title": "MinRankByWeight",
               "description": "Include only features ranked greater than or equal tothis value by weight. If features have the same weight, we order them alphabetically. NOT SUPPORTED YET",
               "type": "integer"
            },
            "maxRankByWeight": {
               "title": "MaxRankByWeight",
               "description": "Include only features ranked less than or equal tothis value by weight. If features have the same weight, we order them alphabetically. NOT SUPPORTED YET",
               "type": "integer"
            },
            "minTotalWeight": {
               "title": "MinTotalWeight",
               "description": "Only fire the monitor if the total weights of the alerts (based on feature weights) is greater than or equal to this value. NOT SUPPORTED YET",
               "type": "number"
            },
            "maxTotalWeight": {
               "title": "MaxTotalWeight",
               "description": "Only fire the monitor if the total weights of the alerts (based on feature weights) is less than or equal to this value. NOT SUPPORTED YET",
               "type": "number"
            },
            "minAlertCount": {
               "title": "MinAlertCount",
               "description": "If the total alert count is less than this value, the monitor won't fire. NOT SUPPORTED YET",
               "type": "integer"
            },
            "maxAlertCount": {
               "title": "MaxAlertCount",
               "description": "If the total alert count is greater than this value, the monitor won't fire. NOT SUPPORTED YET",
               "type": "integer"
            },
            "includeMetrics": {
               "title": "IncludeMetrics",
               "description": "Metrics to filter by. NOT SUPPORTED YET",
               "maxItems": 100,
               "type": "array",
               "items": {
                  "type": "string",
                  "maxLength": 50
               }
            }
         },
         "additionalProperties": false
      },
      "EveryAnomalyMode": {
         "title": "EveryAnomalyMode",
         "description": "Config mode that indicates the monitor will send out individual messages per anomaly.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "enum": [
                  "EVERY_ANOMALY"
               ],
               "type": "string"
            },
            "filter": {
               "title": "Filter",
               "description": "Filter for anomalies",
               "allOf": [
                  {
                     "$ref": "#/definitions/AnomalyFilter"
                  }
               ]
            }
         },
         "required": [
            "type"
         ],
         "additionalProperties": false
      },
      "DigestModeGrouping": {
         "title": "DigestModeGrouping",
         "description": "Enable the ability to group digest by various fields.",
         "enum": [
            "byColumn",
            "byDataset",
            "byAnalyzer",
            "byDay",
            "byHour"
         ],
         "type": "string"
      },
      "DigestMode": {
         "title": "DigestMode",
         "description": "Config mode that indicates the monitor will send out a digest message.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "enum": [
                  "DIGEST"
               ],
               "type": "string"
            },
            "filter": {
               "title": "Filter",
               "description": "Filter for anomalies",
               "allOf": [
                  {
                     "$ref": "#/definitions/AnomalyFilter"
                  }
               ]
            },
            "creationTimeOffset": {
               "title": "CreationTimeOffset",
               "description": "Optional for Immediate digest, required for Scheduled digest. The earliest creation timestamp that we will filter by to build the digest. ISO 8601 format for timedelta.",
               "maxLength": 20,
               "type": "string"
            },
            "datasetTimestampOffset": {
               "title": "DatasetTimestampOffset",
               "description": "Optional for Immediate digest, required for Scheduled digest. The earliest dataset timestamp that we will filter by in the digest",
               "maxLength": 20,
               "type": "string"
            },
            "groupBy": {
               "description": "Default is None.If this is set, we will group alerts by these groupings and emit multiple messages per group.",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/DigestModeGrouping"
               },
               "maxItems": 10
            }
         },
         "required": [
            "type"
         ],
         "additionalProperties": false
      },
      "GlobalAction": {
         "title": "GlobalAction",
         "description": "Actions that are configured at the team/organization level.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "enum": [
                  "global"
               ],
               "type": "string"
            },
            "target": {
               "title": "Target",
               "description": "The unique action ID in the platform",
               "maxLength": 100,
               "pattern": "[a-zA-Z0-9\\-_]+",
               "type": "string"
            }
         },
         "required": [
            "type",
            "target"
         ],
         "additionalProperties": false
      },
      "SendEmail": {
         "title": "SendEmail",
         "description": "Action to send an email.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "enum": [
                  "email"
               ],
               "type": "string"
            },
            "target": {
               "title": "Target",
               "description": "Destination email",
               "maxLength": 1000,
               "format": "email",
               "type": "string"
            }
         },
         "required": [
            "type",
            "target"
         ],
         "additionalProperties": false
      },
      "SlackWebhook": {
         "title": "SlackWebhook",
         "description": "Action to send a Slack webhook.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "enum": [
                  "slack"
               ],
               "type": "string"
            },
            "target": {
               "title": "Target",
               "description": "The Slack webhook",
               "minLength": 1,
               "maxLength": 2083,
               "format": "uri",
               "type": "string"
            }
         },
         "required": [
            "type",
            "target"
         ],
         "additionalProperties": false
      },
      "RawWebhook": {
         "title": "RawWebhook",
         "description": "Action to send a Slack webhook.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "enum": [
                  "raw"
               ],
               "type": "string"
            },
            "target": {
               "title": "Target",
               "description": "Sending raw unformatted message in JSON format to a webhook",
               "minLength": 1,
               "maxLength": 2083,
               "format": "uri",
               "type": "string"
            }
         },
         "required": [
            "type",
            "target"
         ],
         "additionalProperties": false
      }
   }
}

Config
  • schema_extra: function = <function Monitor.Config.schema_extra at 0xffff856cd3a0>

Fields
field actions: List[Union[GlobalAction, SendEmail, SlackWebhook, RawWebhook]] [Required]#

List of destination for the outgoing messages

Constraints
  • maxItems = 100

field analyzerIds: List[ConstrainedStrValue] [Required]#

The corresponding analyzer ID. Even though it’s plural, we only support one analyzer at the moment

Constraints
  • maxItems = 100

field disabled: Optional[bool] = None#

Whether the monitor is enabled or not

field displayName: Optional[str] = None#

A display name for the monitor if view through WhyLabs UI. Can only contain dashes, underscores,spaces, and alphanumeric characters

Constraints
  • maxLength = 256

  • minLength = 10

  • pattern = [0-9a-zA-Z -_]+

field id: str = None#

A human-readable alias for a monitor. Must be readable

Constraints
  • maxLength = 128

  • minLength = 10

  • pattern = [0-9a-zA-Z-_]+

field metadata: Optional[Metadata] = None#

Meta. This is to track various metadata for auditing.

field mode: Union[EveryAnomalyMode, DigestMode] [Required]#

Notification mode and how we might handle different analysis

field schedule: Union[FixedCadenceSchedule, CronSchedule, ImmediateSchedule] [Required]#

Schedule of the monitor. We only support hourly monitor at the finest granularity

field severity: Optional[int] = 3#

The severity of the monitor messages

field tags: Optional[List[ConstrainedStrValue]] = None#

A list of tags that are associated with the monitor.