monitor_schema.cli#
Console script for monitor_schema.
Classes#
Configuration for running an analysis. |
|
Filter the anomalies based on certain criteria. If the alerts are filtered down to 0, the monitor won't fire. |
|
Supported baseline types. |
|
Cadence for an analyzer or monitor run. |
|
Options for configuring data type for a column. |
|
Classifying the type. |
|
Define the matrix of columns and segments to fan out for monitoring. |
|
Schema configuration for a column. |
|
Define the matrix of fields and segments to fan out for monitoring. |
|
Config mode that indicates the monitor will send out a digest message. |
|
The main document that dictates how the monitor should be run. This document is managed by WhyLabs internally. |
|
An analyzer using stddev for a window of time range. |
|
Schema definition of an entity. |
|
Config mode that indicates the monitor will send out individual messages per anomaly. |
|
Support for scheduling based on a predefined cadence. |
|
Actions that are configured at the team/organization level. |
|
Supported granularity. |
|
Customer specified monitor configs. |
|
A segment is a list of tags. |
|
Action to send an email. |
|
Action to send a Slack webhook. |
|
Calculates upper bounds and lower bounds based on stddev from a series of numbers. |
|
Which nested level we are targeting. |
|
A dynamic trailing window. |
Functions#
|
Generates schema and example document JSON. |
|
Module Contents#
- class monitor_schema.cli.Analyzer[source]#
Bases:
monitor_schema.models.commons.NoExtrasBaseModel
Configuration for running an analysis.
An analysis targets a metric (note that a metric could be a complex object) for one or multiple fields in one or multiple segments. The output is a list of ‘anomalies’ that might show issues with data.
- metadata: monitor_schema.models.commons.Metadata | None#
- tags: Optional[List[constr(min_length=3, max_length=256, regex='[0-9a-zA-Z\\-_]')]]#
- schedule: monitor_schema.models.commons.CronSchedule | monitor_schema.models.commons.FixedCadenceSchedule | None#
- targetMatrix: monitor_schema.models.analyzer.targets.ColumnMatrix | monitor_schema.models.analyzer.targets.DatasetMatrix | None#
- config: monitor_schema.models.analyzer.algorithms.ConjunctionConfig | monitor_schema.models.analyzer.algorithms.DisjunctionConfig | monitor_schema.models.analyzer.algorithms.DiffConfig | monitor_schema.models.analyzer.algorithms.ComparisonConfig | monitor_schema.models.analyzer.algorithms.ListComparisonConfig | monitor_schema.models.analyzer.algorithms.FrequentStringComparisonConfig | monitor_schema.models.analyzer.algorithms.ColumnListChangeConfig | monitor_schema.models.analyzer.algorithms.FixedThresholdsConfig | monitor_schema.models.analyzer.algorithms.StddevConfig | monitor_schema.models.analyzer.algorithms.DriftConfig | monitor_schema.models.analyzer.algorithms.ExperimentalConfig | monitor_schema.models.analyzer.algorithms.SeasonalConfig#
- class monitor_schema.cli.AnomalyFilter[source]#
Bases:
monitor_schema.models.commons.NoExtrasBaseModel
Filter the anomalies based on certain criteria. If the alerts are filtered down to 0, the monitor won’t fire.
- class monitor_schema.cli.BaselineType[source]#
-
Supported baseline types.
- BatchTimestamp = 'BatchTimestamp'#
- Reference = 'Reference'#
- TrailingWindow = 'TrailingWindow'#
- TimeRange = 'TimeRange'#
- CurrentBatch = 'CurrentBatch'#
- class monitor_schema.cli.Cadence[source]#
-
Cadence for an analyzer or monitor run.
- hourly = 'hourly'#
- daily = 'daily'#
- weekly = 'weekly'#
- monthly = 'monthly'#
- class monitor_schema.cli.ColumnDataType[source]#
-
Options for configuring data type for a column.
- integral = 'integral'#
- fractional = 'fractional'#
- boolean = 'bool'#
- string = 'string'#
- unknown = 'unknown'#
- null = 'null'#
- class monitor_schema.cli.ColumnDiscreteness[source]#
-
Classifying the type.
- discrete = 'discrete'#
- continuous = 'continuous'#
- class monitor_schema.cli.ColumnMatrix[source]#
Bases:
_BaseMatrix
Define the matrix of columns and segments to fan out for monitoring.
- type: Literal[TargetLevel]#
- include: List[ColumnGroups | monitor_schema.models.utils.COLUMN_NAME_TYPE] | None#
- exclude: List[ColumnGroups | monitor_schema.models.utils.COLUMN_NAME_TYPE] | None#
- class monitor_schema.cli.ColumnSchema[source]#
Bases:
monitor_schema.models.commons.NoExtrasBaseModel
Schema configuration for a column.
Should be generated by WhyLabs originally but can be overridden by users.
- discreteness: ColumnDiscreteness#
- dataType: ColumnDataType#
- class monitor_schema.cli.DatasetMatrix[source]#
Bases:
_BaseMatrix
Define the matrix of fields and segments to fan out for monitoring.
.
- type: Literal[TargetLevel]#
- class monitor_schema.cli.DigestMode[source]#
Bases:
monitor_schema.models.commons.NoExtrasBaseModel
Config mode that indicates the monitor will send out a digest message.
- type: Literal['DIGEST']#
- filter: AnomalyFilter | None#
- groupBy: List[DigestModeGrouping] | None#
- class monitor_schema.cli.Document[source]#
Bases:
monitor_schema.models.commons.NoExtrasBaseModel
The main document that dictates how the monitor should be run. This document is managed by WhyLabs internally.
- schemaVersion: Literal[1]#
- metadata: monitor_schema.models.commons.Metadata | None#
- granularity: Granularity#
- entitySchema: monitor_schema.models.column_schema.EntitySchema | None#
- weightConfig: monitor_schema.models.column_schema.EntityWeights | None#
- analyzers: List[monitor_schema.models.analyzer.Analyzer]#
- monitors: List[monitor_schema.models.monitor.Monitor]#
- class monitor_schema.cli.DriftConfig[source]#
Bases:
AlgorithmConfig
An analyzer using stddev for a window of time range.
This analysis will detect whether the data drifts or not. By default, we use hellinger distance with a threshold of 0.7.
- type: Literal[AlgorithmType]#
- algorithm: Literal['hellinger', 'jensenshannon', 'kl_divergence', 'psi']#
- metric: Literal[ComplexMetrics, ComplexMetrics]#
- class monitor_schema.cli.EntitySchema[source]#
Bases:
monitor_schema.models.commons.NoExtrasBaseModel
Schema definition of an entity.
- metadata: monitor_schema.models.commons.Metadata | None#
- columns: Dict[monitor_schema.models.utils.COLUMN_NAME_TYPE, ColumnSchema]#
- class monitor_schema.cli.EveryAnomalyMode[source]#
Bases:
monitor_schema.models.commons.NoExtrasBaseModel
Config mode that indicates the monitor will send out individual messages per anomaly.
- type: Literal['EVERY_ANOMALY']#
- filter: AnomalyFilter | None#
- class monitor_schema.cli.FixedCadenceSchedule[source]#
Bases:
NoExtrasBaseModel
Support for scheduling based on a predefined cadence.
- type: Literal['fixed']#
- cadence: Literal[Cadence, Cadence, Cadence, Cadence]#
- class monitor_schema.cli.GlobalAction[source]#
Bases:
monitor_schema.models.commons.NoExtrasBaseModel
Actions that are configured at the team/organization level.
- type: Literal['global']#
- class monitor_schema.cli.Granularity[source]#
-
Supported granularity.
- hourly = 'hourly'#
- daily = 'daily'#
- weekly = 'weekly'#
- monthly = 'monthly'#
- class monitor_schema.cli.Monitor[source]#
Bases:
monitor_schema.models.commons.NoExtrasBaseModel
Customer specified monitor configs.
- metadata: monitor_schema.models.commons.Metadata | None#
- tags: Optional[List[constr(min_length=3, max_length=256, regex='[0-9a-zA-Z\\-_]')]]#
- analyzerIds: List[constr(regex='^[A-Za-z0-9_\\-]+$')]#
- schedule: monitor_schema.models.commons.FixedCadenceSchedule | monitor_schema.models.commons.CronSchedule | monitor_schema.models.commons.ImmediateSchedule#
- mode: EveryAnomalyMode | DigestMode#
- actions: List[GlobalAction | SendEmail | SlackWebhook | RawWebhook]#
- class monitor_schema.cli.Segment[source]#
Bases:
monitor_schema.models.commons.NoExtrasBaseModel
A segment is a list of tags.
We normalize these in the backend.
- tags: List[SegmentTag]#
- class monitor_schema.cli.SendEmail[source]#
Bases:
monitor_schema.models.commons.NoExtrasBaseModel
Action to send an email.
- type: Literal['email']#
- class monitor_schema.cli.SlackWebhook[source]#
Bases:
monitor_schema.models.commons.NoExtrasBaseModel
Action to send a Slack webhook.
- type: Literal['slack']#
- target: pydantic.HttpUrl#
- class monitor_schema.cli.StddevConfig[source]#
Bases:
_ThresholdBaseConfig
Calculates upper bounds and lower bounds based on stddev from a series of numbers.
An analyzer using stddev for a window of time range.
This calculation will fall back to Poisson distribution if there is only 1 value in the baseline. For 2 values, we use the formula sqrt((x_i - avg(x))^2 / n - 1)
- type: Literal[AlgorithmType]#
- class monitor_schema.cli.TargetLevel[source]#
-
Which nested level we are targeting.
- dataset = 'dataset'#
- column = 'column'#
- class monitor_schema.cli.TrailingWindowBaseline[source]#
Bases:
_SegmentBaseline
A dynamic trailing window.
This is useful if you don’t have a static baseline to monitor against. This is the default mode for most monitors.
- type: Literal[BaselineType]#
- exclusionRanges: List[monitor_schema.models.commons.TimeRange] | None#