# Monte Carlo

Euno's Monte Carlo integration surfaces active data quality alerts directly on impacted tables, mapped dbt models, and column resources, and introduces the originating Monte Carlo monitor as a first-class resource in the Euno data model.

Monte Carlo remains the source of truth for alerts. Euno retrieves alert payloads via the Monte Carlo GraphQL API and computes a set of resource-level indicators for discovery and filtering.

Only **active** alerts are ingested:

* `Investigating`
* `No Status` (newly opened, not yet triaged)

Alerts in terminal states (`Fixed`, `No Action Needed`, `False Positive`, `Expected`, `Resolved`, `Closed`, `Acknowledged`) are not fetched, stored, or displayed.

{% hint style="info" %}
**Alert lookback window**: Euno fetches alerts whose `updatedTime` falls within the last **30 days**. An alert that remains in an active state but has not been updated in Monte Carlo for longer than that window may not appear in Euno until it is updated again.
{% endhint %}

Euno's Monte Carlo integration supports auto-discovery of:

* `montecarlo_account` — top-level account container holding warehouse connection metadata
* `montecarlo_monitor` — one resource per monitor returned by Monte Carlo's `getMonitors` API (including monitors with no active alerts)

In addition, the integration **enriches** existing `table`, `dbt_model`, `column`, and `dbt_column` resources with active-alert properties. It does not discover or import warehouse hierarchy from Monte Carlo.

## Prerequisites

* A Monte Carlo account with at least one configured warehouse connection.
* Administrator access to Monte Carlo to create an Account Service Key.
* The tables, dbt models, and columns you want to enrich with alerts must already exist in Euno from another source integration (Snowflake, BigQuery, dbt, etc.). Euno resolves alerts to existing resources — it does not create warehouse hierarchy from Monte Carlo.

## Stage 1: Configure Monte Carlo

### Step 1: Create a Monte Carlo Account Service Key

1. Log in to your Monte Carlo account as an administrator.
2. Navigate to **Settings → API**.
3. Create a new **Account Service Key**.
4. Copy the **API Key ID** and **API Key Secret** — you'll need these for Euno configuration.

{% hint style="info" %}
**Account-level token required when SSO is enabled**: If your Monte Carlo account uses SSO, you must provide an **account-level** Account Service Key (not a user-scoped key) for this integration to work. User-scoped tokens issued under SSO will not authenticate successfully against the headless GraphQL API used by the integration.
{% endhint %}

## Stage 2: Configure New Monte Carlo Source in Euno

### Step 1: Access the Sources Page

1. Go to the **Sources** page in Euno.
2. Click on **Add New Source** and select **Monte Carlo** from the list of supported platforms.

### Step 2: General Configuration

Asterisk (\*) means a mandatory field.

| Configuration         | Description                                                                                                                                                           |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Name\***            | Enter a name for your Monte Carlo source (e.g., "Monte Carlo - Data Observability").                                                                                  |
| **API Key ID\***      | Account Service Key ID from Step 1. Sent on every request as the `x-mcd-id` header.                                                                                   |
| **API Key Secret\***  | Account Service Key secret from Step 1. Sent on every request as the `x-mcd-token` header. Stored securely.                                                           |
| **GraphQL API URL**   | (Advanced) Base URL of the Monte Carlo GraphQL API. Leave blank to use `https://api.getmontecarlo.com/graphql`. Override only if your account uses a custom endpoint. |
| **Warehouse mapping** | (Advanced) Optional JSON mapping of Monte Carlo warehouse identifiers to Euno warehouse URI prefixes. See [Warehouse mapping](#warehouse-mapping) below.              |

### Warehouse mapping

If Monte Carlo warehouse identifiers do not map cleanly to the warehouse URI prefixes Euno uses for tables (for example, in multi-warehouse accounts or when connection metadata is ambiguous), configure **Warehouse mapping** in the source's advanced settings.

Keys are matched against Monte Carlo warehouse metadata. Any of the following identifiers for a warehouse connection may be used as a key:

* Warehouse **UUID** (`uuid` from `getWarehouses`)
* Warehouse **name**
* Connection **UUID** or **id** under that warehouse

Values are Euno **warehouse URI prefixes** used when resolving alert table URIs:

* **Snowflake** — the Snowflake account host prefix (for example, `snowflake.myorg.us-east-1`).
* **BigQuery** — use `bigquery`. The GCP project, dataset, and table name come from each alert's MCON table reference (`project:dataset.table`), not from the warehouse mapping value.

```json
{
  "5b0b42bb-58ae-4ead-af6c-5a2f738df62b": "snowflake.jgb69604.us-west-2",
  "prod-snowflake": "snowflake.myorg.us-east-1"
}
```

In the example above, the first entry maps a warehouse UUID; the second maps a warehouse display name to a Snowflake URI prefix.

### Step 3: Schedule

* Enable the Schedule option.
* Choose:
  1. **Weekly**: Set specific days and times.
  2. **Hourly**: Define the interval in hours (e.g., every 4 hours).

{% hint style="info" %}
**Recommended**: Schedule the Monte Carlo integration to run every 4 hours so active alert state stays close to real-time. Manual runs are also supported.
{% endhint %}

### Step 4: Resource Cleanup

**Immediate Cleanup** is the default and recommended setting for this integration.

* **Immediate Cleanup**: `montecarlo_monitor` resources not observed in the most recent successful crawl are removed. This keeps the monitor inventory aligned with Monte Carlo's `getMonitors` results.

{% hint style="warning" %}
Use **Immediate Cleanup** for Monte Carlo sources. **No Cleanup** can leave stale `montecarlo_monitor` resources after monitors are deleted in Monte Carlo.

`active_montecarlo_alerts` is updated when a monitor's active alerts change, but resolved alerts may leave stale data on impacted resources until those resources are updated again. Prefer **Immediate Cleanup** and re-run the integration after major alert triage in Monte Carlo.
{% endhint %}

### Step 5: Save Configuration

Click the **Test & Save** button to complete the setup. Euno will:

1. Authenticate to the Monte Carlo GraphQL API using the provided API Key ID and Secret.
2. Verify access via the Monte Carlo API (`getUser`).
3. Save the configuration if validation passes.

If the test fails, review the error message and verify your credentials. The most common cause of failure is a user-scoped token in an SSO-enabled account — see the note in Step 1.

## What Euno Discovers

* `montecarlo_account` — The top-level Monte Carlo account container. Holds warehouse connection metadata and the warehouse-to-Euno mapping context used to resolve alerts to the correct resources.
* `montecarlo_monitor` — A Monte Carlo data quality monitor. One resource is created per monitor returned by Monte Carlo's `getMonitors` API. Stores the full monitor payload and its list of active alerts.

In addition, existing **table**, **dbt model**, **column**, and **dbt column** resources are enriched with alert properties when they are the impacted asset of one or more active Monte Carlo alerts.

For detailed information about discovered resources and their indexed properties, see [Monte Carlo Integration Discovered Resources](/sources/data-observability/monte-carlo/monte-carlo-integration-discovered-resources.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.euno.ai/sources/data-observability/monte-carlo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
