# Metric

Schema reference for metric definitions and the evaluation results they produce.

### Metrics Table

**Table Name:** `metrics`\
**Description:** Metric definitions for evaluation and monitoring

{% tabs %}
{% tab title="Schema" %}

| Column                | Type           | Description                     |
| --------------------- | -------------- | ------------------------------- |
| `_id`                 | string         | Metric identifier               |
| `additional_notes`    | string         | Additional notes                |
| `applied_to_services` | array\<string> | Associated service IDs          |
| `created_at`          | timestamp      | Creation timestamp              |
| `creator`             | json           | Creator information             |
| `description`         | string         | Metric description              |
| `is_deleted`          | boolean        | Deletion status                 |
| `metric_value`        | json           | Value definition (type, bounds) |
| `name`                | string         | Metric name                     |
| `org_id`              | string         | Organization identifier         |
| `region_name`         | string         | Deployment region               |
| `tags`                | json           | Associated tags                 |
| `updated_at`          | timestamp      | Last update timestamp           |
| `updated_by`          | json           | Last updater ID                 |
| `metric_value_type`   | string         | Type of metric value            |
| {% endtab %}          |                |                                 |

{% tab title="Query Example" %}

```sql
SELECT
  name,
  description,
  applied_to_services,
  metric_value
FROM metrics
WHERE is_deleted = false;
```

{% endtab %}
{% endtabs %}

### Metric Evaluation Results Table

**Table Name:** `metric_evaluation_results`\
**Description:** Results from metric evaluations

{% tabs %}
{% tab title="Schema" %}

| Column          | Type      | Description             |
| --------------- | --------- | ----------------------- |
| `_id`           | string    | Evaluation result ID    |
| `created_at`    | timestamp | Creation timestamp      |
| `justification` | string    | Result justification    |
| `metric_id`     | string    | Associated metric ID    |
| `org_id`        | string    | Organization identifier |
| `region_name`   | string    | Deployment region       |
| `result`        | string    | Evaluation result       |
| `source`        | json      | Source information      |
| `source_type`   | string    | Type of source          |
| `updated_at`    | timestamp | Last update timestamp   |
| {% endtab %}    |           |                         |

{% tab title="Query Example" %}

```sql
SELECT
  metric_id,
  result,
  justification,
  source,
  created_at
FROM metric_evaluation_results
ORDER BY created_at DESC;
```

{% endtab %}
{% endtabs %}
