# Monitors

Monitors in Sling observe your data assets without moving data. They track schema drift, data freshness, row counts, column-level statistics, and anomalies — giving you continuous visibility into the health and quality of your database tables and views.

![monitor-charts](https://3453272330-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M93cpHl7B7NPZlDrubS%2Fuploads%2Fgit-blob-32b997eecb1ccf0360072abf839df613e75c0573%2Fmonitor-charts.png?alt=media)

## What Can Monitors Do?

* **Schema change detection** — Track when tables, columns, or types are added, dropped, or altered
* **Data freshness** — Alert when data falls behind its expected update schedule
* **Row count tracking** — Monitor table sizes and detect unexpected growth or shrinkage
* **Column statistics** — Collect min/max/mean, percentiles, null counts, cardinality, and more
* **Value validation** — Enforce regex patterns, accepted values, and rejected values on columns
* **Anomaly detection** — Automatically detect spikes, drops, and pattern changes using z-score analysis

## Quick Start

Create a YAML file that specifies which connection to monitor and what to track:

```yaml
connection: MY_POSTGRES

defaults:
  metadata: true
  row_count: true

objects:
  # monitor all objects in schemas
  marketing.*:
  salesforce.*:

  public.users:
    freshness_column: updated_at
    freshness_threshold: "24h"
    columns:
      email:
        count_distinct: true

  public.orders:
    freshness_column: created_at
    freshness_threshold: "12h"
```

On the Sling Platform, save this file in the `monitors/` directory of your project and schedule it as a job.

{% hint style="success" %}
Monitors are a [Sling Platform](https://docs.slingdata.io/sling-platform/platform) feature available on the **Advanced plan**. See [Pricing](https://slingdata.io/platform/) for details.
{% endhint %}

## Configuration Overview

A monitor configuration has five top-level keys:

| Key          | Required | Description                                                                                                                                               |
| ------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `connection` | Yes      | The connection to monitor (must match a connection in `env.yaml`)                                                                                         |
| `defaults`   | No       | Default settings applied to all objects. See [Structure](https://docs.slingdata.io/sling-platform/platform/monitors/structure).                           |
| `objects`    | Yes      | Map of object names or patterns to their monitoring configuration. See [Structure](https://docs.slingdata.io/sling-platform/platform/monitors/structure). |
| `schemata`   | No       | Schema change detection settings. See [Schema Changes](https://docs.slingdata.io/sling-platform/platform/monitors/schema-changes).                        |

For the complete YAML reference, see [Structure](https://docs.slingdata.io/sling-platform/platform/monitors/structure).

## Running Monitors

Monitor files are stored in the `monitors/` directory of your project on the Sling Platform. Once created, you can schedule them as jobs with a cron expression for automated execution. Monitor runs process objects in parallel (default 2 threads) and retry transient errors up to 3 times.

## Supported Connections

### Databases

| Database        | Table Size | Percentiles  | Freshness |
| --------------- | ---------- | ------------ | --------- |
| PostgreSQL      | Yes        | Yes          | Yes       |
| MySQL / MariaDB | Yes        | —            | Yes       |
| Snowflake       | Yes        | Yes          | Yes       |
| BigQuery        | Yes        | Yes (approx) | Yes       |
| ClickHouse      | Yes        | Yes          | Yes       |
| DuckDB          | Yes        | Yes          | Yes       |
| SQL Server      | Yes        | Yes          | Yes       |
| Oracle          | Yes        | Yes          | Yes       |
| Redshift        | Yes        | Yes          | Yes       |
| Databricks      | Yes        | Yes          | Yes       |
| Trino / Athena  | Yes        | Yes          | Yes       |
| SQLite / D1     | —          | —            | Yes       |

## Notifications

{% hint style="info" %}
Notification settings are a Sling Platform feature, configured per monitor job.
{% endhint %}

![monitor-notification](https://3453272330-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M93cpHl7B7NPZlDrubS%2Fuploads%2Fgit-blob-085dbc08d17a3742f7b52c00949fce54c3de0f6b%2Fmonitor-notification.png?alt=media)

Each monitor job supports four notification triggers:

| Setting              | Fires When                                                   |
| -------------------- | ------------------------------------------------------------ |
| **On Schema Change** | Tables, columns, or types are added, dropped, or altered     |
| **On Freshness**     | Data exceeds its freshness threshold                         |
| **On Anomaly**       | Metric values deviate significantly from historical baseline |
| **On Failure**       | Monitor execution fails                                      |

Notifications can be sent via **email**, **Slack**, **Discord**, or **Microsoft Teams**.

## Learn More

Detailed documentation for each aspect of monitors:

* [Structure](https://docs.slingdata.io/sling-platform/platform/monitors/structure) — Complete YAML reference, wildcards, defaults, and definition order
* [Object Metrics & Freshness](https://docs.slingdata.io/sling-platform/platform/monitors/object-metrics) — Object-level metrics and data staleness detection
* [Column Metrics & Validation](https://docs.slingdata.io/sling-platform/platform/monitors/column-metrics) — Column statistics and value validation rules
* [Anomaly Detection](https://docs.slingdata.io/sling-platform/platform/monitors/anomaly-detection) — Z-score analysis, configuration, and event types
* [Schema Changes](https://docs.slingdata.io/sling-platform/platform/monitors/schema-changes) — Schema drift detection and change events
