> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Metrics for OpenMetadata

> Define and govern business metrics in OpenMetadata: metric properties, lineage to data assets and other metrics, creation from the UI, and best practices.

# Metrics in OpenMetadata

The **Metrics** entity in OpenMetadata lets you define, document, and manage key business and operational metrics. Metrics help organizations maintain consistency, traceability, and accuracy in data-driven decision-making.

## Overview of Metrics

Metrics document calculated values based on data assets. OpenMetadata lists them under the **Governance** section.

You can link each metric to:

* Glossary terms
* Data assets
* Other metrics

These links show how the metric relates to your data quality and usage.

## What a Metric Stores

A metric lets you document and share a business metric's definition. It includes:

* **Name**: The metric's unique identifier.
* **Meaning**: A description of what the metric measures.
* **Calculation**: The formula or SQL used to calculate it.

## Calculation and Scheduling

Keep the following in mind about how metrics work:

* **No calculation**: A metric is documentation only. OpenMetadata saves what you enter but doesn't run the formula, compute a value, or schedule a run.
* **Your own tools**: Calculate the value in your own database or business intelligence (BI) tool, then record its definition here so everyone can find it.

> [!TIP]
>
> If you want OpenMetadata to track how many of your tables and other data assets have a description or an owner, use [Key Performance Indicators (KPIs)](https://docs.open-metadata.org/v2.1.x/how-to-guides/data-insights/kpi.md). Data Insights calculates them for you.

## Key Properties of a Metric

| **Property** | **Description** | **Example Value** |
| - | - | - |
| **Name** | Unique identifier for the metric, following camelCase naming conventions. | `customerRetentionRate` |
| **Display Name** | Human-readable name for the metric. | `Customer Retention Rate` |
| **Description** | Detailed explanation of what the metric represents. | `Percentage of retained users` |
| **Expression** | The SQL, Python, Java, or JavaScript that documents how the metric is calculated, with its language. | `COUNT(returning_customers)` |
| **Granularity** | Time scale for the metric, such as daily, weekly, or monthly. | `Daily` |
| **Metric Type** | Type of calculation the metric's definition describes, such as count, average, or ratio. | `Percentage` |
| **Unit of Measurement** | Unit for interpreting metric values, such as count, dollars, or percentage. | `Percentage` |
| **Owner** | Individual or team responsible for maintaining the metric. | `Data Governance Team` |

## Metric Lineage and Dependencies

OpenMetadata allows users to trace the source and dependencies of metrics using lineage. This ensures end-to-end traceability from raw data to metric reporting. A typical lineage might look like:

```commandline theme={null}
Database Table → Metric → Pipeline → Dashboard
```

View associated tables, pipelines, and dashboards to understand how each metric is defined and where it's used.

Metrics support column-level lineage too. A metric is usually calculated from one column, such as `Total Sales = SUM(sales.amount)`. You can link that column to the metric. For more information, see [Metric Column Lineage](https://docs.open-metadata.org/v2.1.x/how-to-guides/data-lineage/column.md#metric-column-lineage).

## Creating Metrics Using the UI

To create a new metric in OpenMetadata using the user interface, follow these steps:

1. From the left navigation bar, select **Govern** > **Metrics**.

   ![Navigate to Govern > Metrics](https://mintcdn.com/openmetadata/DGjlVQ1UTH-GLlu5/public/images/how-to-guides/governance/metrics/metric-create-navigate.png?fit=max\&auto=format\&n=DGjlVQ1UTH-GLlu5\&q=85\&s=50ca4ec8db2383b30e43c62a6c5b2f1b)

2. Click **Add Metric**.

   ![Add Metric button on the Metrics page](https://mintcdn.com/openmetadata/DGjlVQ1UTH-GLlu5/public/images/how-to-guides/governance/metrics/metric-create-add-metric.png?fit=max\&auto=format\&n=DGjlVQ1UTH-GLlu5\&q=85\&s=4b836a1799673fafbac3ef80a1c21f3a)

3. On the **Add New Metric** page, fill in the fields:

   * **Name** (required): Enter a unique identifier in camelCase. Start with a lowercase letter. Spaces, underscores, and dots are not supported (for example, `customerRetentionRate`).
   * **Display Name** (Optional): Enter a human-readable name (for example, `Customer Retention Rate`).
   * **Description** (Optional): Describe what the metric measures and how it is used.
   * **Granularity** (Optional): Select the time scale, such as day, week, or month.
   * **Metric Type** (Optional): Select the type of calculation, such as count, average, or percentage.
   * **Measurement Unit** (Optional): Select the unit of the value, such as count, percentage, or dollar.
   * **Language** and **Code**: Select the language (SQL, Python, Java, or JavaScript) and enter the code that documents how the metric is calculated. Both are required.

   ![Add New Metric form](https://mintcdn.com/openmetadata/DGjlVQ1UTH-GLlu5/public/images/how-to-guides/governance/metrics/metric-create-form.png?fit=max\&auto=format\&n=DGjlVQ1UTH-GLlu5\&q=85\&s=60333872ebfcc4c24ce863941ebaf055)

4. Click **Create** to save the metric. The new metric appears in the **Metrics** list.

   ![New metric in the Metrics list](https://mintcdn.com/openmetadata/DGjlVQ1UTH-GLlu5/public/images/how-to-guides/governance/metrics/metric-create-result.png?fit=max\&auto=format\&n=DGjlVQ1UTH-GLlu5\&q=85\&s=84156b30e88be0f89e57033738e2eb7c)

## Metric Details Page

To open the Metric Details page:

1. From the left navigation bar, select **Govern** > **Metrics**.
2. In the Metrics list, select the name of the metric you want to open.

The page shows everything about the metric in one place. It has five tabs:

* **Overview**: Description, hierarchy, definition, and related metrics.
* **Lineage**: Where the metric's data comes from and where it is used.
* **Assets**: The data assets linked to the metric.
* **Activity Feeds & Tasks**: Conversations and tasks about the metric.
* **Custom Properties**: Extra fields your organization added to metrics.

![Overview tab of a metric](https://mintcdn.com/openmetadata/DGjlVQ1UTH-GLlu5/public/images/how-to-guides/governance/metrics/metric-details-overview.png?fit=max\&auto=format\&n=DGjlVQ1UTH-GLlu5\&q=85\&s=291311506409028b0bb71bb3b901a8ae)

### Overview Tab

The top of the page shows the metric name, its status (for example, **Approved**), and the **Domains**, **Owners**, **Tier**, and **Certification** fields. Select the edit icon next to a field to change it.

The **Overview** tab has a main area and a set of side panels.

**Main area**

* **Description**: What the metric measures and how to use it. Select the edit icon to change it.
* **Metric Hierarchy**: Shows where the metric sits among other metrics. For more information, see [Metric Hierarchy](#metric-hierarchy).
* **Definition**: The metric's type, granularity, unit, and calculation code. For more information, see [Metric Definition](#metric-definition).

**Side panels**

* **Data Products**: The data products the metric belongs to.
* **Tags**: Tags applied to the metric.
* **Glossary Term**: Glossary terms linked to the metric.
* **Reviewers**: The people assigned to review the metric.
* **Related Metrics**: Other metrics that relate to this one. For more information, see [Related Metrics](#related-metrics).
* **Custom Properties**: Extra fields your organization added to metrics.

### Metric Hierarchy

Metrics often build on each other. For example, `Revenue` can be the parent of `Online Revenue` and `Store Revenue`. The **Metric Hierarchy** card shows these relationships as a tree, so you can see how a metric fits in without leaving its page.

The tree can show:

* **Metric Group**: The group the metric belongs to, with the number of metrics it holds.
* **Parent metrics**: The metrics above the current one, shown as a path from the top.
* **Peer metrics**: Other metrics that share the same parent.
* **Child metrics**: Variants that sit under the current metric.
* **You are here**: A label that marks the metric you are viewing.

How to use the tree:

* Select a metric in the tree to open its page.
* Select a **Metric Group** to open the Metrics list with that group highlighted.
* Select **Show more Metrics** or **Show more Variants** when a list is long.
* Select **Add Child Metric** to create a new metric under the current one. You see this button only if you have permission to create metrics.

If a metric has no group, parent, or child, the card says: "This metric is standalone, it belongs to no group and has no variants."

![Metric Hierarchy card](https://mintcdn.com/openmetadata/DGjlVQ1UTH-GLlu5/public/images/how-to-guides/governance/metrics/metric-hierarchy-card.png?fit=max\&auto=format\&n=DGjlVQ1UTH-GLlu5\&q=85\&s=d9262465e77ad057250f682b6265794e)

### Metric Definition

The **Definition** card holds the details that describe how the metric is calculated. It shows the code block first, then the metric type, measurement unit, and granularity.

* **Metric Type**: The kind of calculation, such as count, average, or percentage.
* **Granularity**: The time scale, such as daily, weekly, or monthly.
* **Measurement Unit**: The unit of the value, such as count, percentage, or dollar. Choose a listed unit or enter your own custom unit.
* **Language**: The language of the calculation code, such as SQL, Python, or Java.
* **Code**: The formula or query that documents the calculation. The card shows it in a block labeled **Expression**, with the language badge (for example, **SQL**).

To change any of these, select **Edit** on the card, update the fields, and select **Save**. If you choose a language, **Code** is required. If you pick a custom unit, you must enter it.

![Metric Definition card](https://mintcdn.com/openmetadata/DGjlVQ1UTH-GLlu5/public/images/how-to-guides/governance/metrics/metric-definition-card.png?fit=max\&auto=format\&n=DGjlVQ1UTH-GLlu5\&q=85\&s=0ab9b782bb50f3ee7c99de4c59e84f22)

### Related Metrics

Use **Related Metrics** to point readers to metrics they should look at together, such as `Gross Revenue` and `Net Revenue`.

* Select the add icon to choose related metrics from the existing metrics.
* Select the edit icon to add or remove entries.
* Use **Show more** when the list is long.

## Link Data Assets to a Metric

The **Assets** tab lists the data assets that a metric uses or describes, such as tables, dashboards, and pipelines. Link assets so that anyone who finds the metric can see where it comes from and where it is used.

![Assets tab of a metric with the asset preview panel](https://mintcdn.com/openmetadata/DGjlVQ1UTH-GLlu5/public/images/how-to-guides/governance/metrics/metric-assets-tab.png?fit=max\&auto=format\&n=DGjlVQ1UTH-GLlu5\&q=85\&s=efc9818cd39f623bd341ad98caebe855)

### Add Assets

Add assets to a metric from the metric's **Assets** tab.

1. Open the metric and select the **Assets** tab.
2. Select **Add Assets** in the page header.
3. In the dialog, search for and select the assets you want to link.
4. Confirm your selection.

The linked assets now appear in the list, and the tab shows the number of assets.

You see **Add Assets** only if you can edit the metric.

### Browse and Preview Assets

The **Assets** tab lists every asset linked to the metric.

* The list shows each linked asset with its type and details, in the same layout as the glossary term and domain Assets tabs.
* Select an asset to open a preview panel next to the list. The panel shows the asset's summary without leaving the metric.
* Close the panel to return to the full list.
* If no assets are linked yet, the tab shows "No data assets are linked to this metric yet."

### Remove Assets

Unlink an asset when it no longer relates to the metric. Removing a link does not delete the asset itself.

To remove one asset:

1. Open the metric and select the **Assets** tab.
2. On the asset, open the three-dot menu and select **Delete**.
3. In the confirmation dialog, select **Delete**.

To remove several assets at once:

1. On the **Assets** tab, select the checkbox next to each asset, or select **Select All**.
2. In the bar that shows the number of items selected, select **Delete**.
3. Confirm the removal.

You can remove assets only if you have the Edit All permission on the metric.

## Example JSON for Creating a Metric

The following request body creates a metric with `POST /v1/metrics`. Only `name` is required. The related metric must already exist, and the `id` values are examples that you replace with your own.

```json theme={null}
{
  "name": "customerRetentionRate",
  "displayName": "Customer Retention Rate",
  "description": "Percentage of customers retained over a given period.",
  "metricExpression": {
    "language": "SQL",
    "code": "SELECT 100.0 * COUNT(DISTINCT CASE WHEN is_returning THEN customer_id END) / COUNT(DISTINCT customer_id) FROM customer_activity"
  },
  "metricType": "PERCENTAGE",
  "unitOfMeasurement": "PERCENTAGE",
  "granularity": "MONTH",
  "relatedMetrics": [
    "customerChurnRate"
  ],
  "owners": [
    {
      "id": "7c5a3f1e-2b4d-4e6a-9c8b-1d2e3f4a5b6c",
      "type": "team"
    }
  ],
  "reviewers": [
    {
      "id": "0f9e8d7c-6b5a-4c3d-8e2f-1a0b9c8d7e6f",
      "type": "user"
    }
  ],
  "tags": [
    {
      "tagFQN": "PII.NonSensitive",
      "source": "Classification",
      "labelType": "Manual",
      "state": "Confirmed"
    }
  ]
}
```

| **Field** | **Description** |
| - | - |
| `metricExpression` | The calculation, as an object with a `language` (`SQL`, `Java`, `JavaScript`, `Python`, or `External`) and the `code`. This is documentation only. OpenMetadata doesn't run it. |
| `metricType` | The type of calculation, such as `COUNT`, `SUM`, `AVERAGE`, `RATIO`, or `PERCENTAGE`. |
| `unitOfMeasurement` | The unit, such as `COUNT`, `DOLLARS`, or `PERCENTAGE`. Use `OTHER` with `customUnitOfMeasurement` for any other unit. |
| `granularity` | The time scale: `SECOND`, `MINUTE`, `HOUR`, `DAY`, `WEEK`, `MONTH`, `QUARTER`, or `YEAR`. |
| `relatedMetrics` | Fully qualified names of other metrics that this metric relates to. Each related metric must already exist. |
| `owners` | References to users or teams, each with the `id` and `type`. A team owner must be a Group team. |
| `reviewers` | References to one or more users, or to a single team, each with the `id` and `type`. |

## Metric vs. Glossary Term

A metric and a glossary term can describe the same business idea, but they do different jobs:

| | **Metric** | **Glossary Term** |
| - | - | - |
| **Describes** | A measurement, such as Customer Retention Rate | A business concept, such as Customer |
| **Holds** | An expression, a metric type, a unit, a granularity, and related metrics | A definition, synonyms, related terms, and a review workflow |
| **Use it to** | Record how a number is calculated, so everyone uses the same definition | Give teams a shared vocabulary, and tag data assets with it |

Use a glossary term to define what a "customer" is. Use a metric to define how you count retained customers.

> [!NOTE]
>
> KPIs and metrics are separate. A KPI can't be linked to a metric. For more information, see [Key Performance Indicators (KPIs)](https://docs.open-metadata.org/v2.1.x/how-to-guides/data-insights/kpi.md).

## Managing Metrics in OpenMetadata

* **Versioning**: Each update to a metric creates a new version, maintaining historical changes.
* **Linking**: Metrics can be linked to glossary terms, tables, dashboards, and pipelines for enriched context.
* **Values**: OpenMetadata stores the metric's definition. Track the actual values in your own database or BI tool.

## Best Practices for Metric Management

* **Consistent Naming**: Use camelCase for metric names to ensure consistency across systems.
* **Clear Definitions**: Provide comprehensive descriptions and units for accurate interpretation.
* **Lineage Tracking**: Always associate metrics with source tables and pipelines for traceability.
* **Ownership**: Assign metric owners for accountability and maintenance.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.