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

# Add custom metadata to OpenLineage assets

Astro Observe supports a custom OpenLineage facet, `astroCustomMetadata`, that you can use to attach links to assets sourced from OpenLineage, such as datasets and tasks. The links appear on the asset in the **Details** tab and in the **Asset Overview** in [Lineage](/docs/astro/lineage-graph). Use them to surface contextual resources, such as documentation, dashboards, or runbooks, alongside your assets.

Astro Observe supports up to five links per asset.

## Prerequisites

* A Deployment that emits OpenLineage events to Astro Observe. See [Configure OpenLineage on Astro](/docs/astro/observe-openlineage).
* A Dag that emits OpenLineage events for an Observe asset (supported for now: `Airflow Task`, `OpenLineage Dataset`).

## Facet structure

Attach the facet using the `facets` keyword argument. The facet body contains an `observeAssetMetadata` array, where each item describes a single link.

| Field                               | Description                                                                        |
| ----------------------------------- | ---------------------------------------------------------------------------------- |
| `observeAssetMetadata`              | Array of metadata items to display on the asset.                                   |
| `observeAssetMetadata[].value`      | The URL to link to.                                                                |
| `observeAssetMetadata[].type`       | The metadata type. Must be `url`. Astro Observe ignores items with any other type. |
| `observeAssetMetadata[].typeParams` | Optional. For `url`, set `displayText` to the text shown for the link.             |

## Example

The following custom facet attaches one link to an OpenLineage dataset:

```python wrap theme={null}
from airflow.providers.common.compat.openlineage.facet import Dataset as OLDataset


def observe_facet():
    return {
        "astroCustomMetadata": {
            "observeAssetMetadata": [
                {
                    "value": "https://www.astronomer.io/docs/astro/astro-observe",
                    "type": "url",
                    "typeParams": {"displayText": "Go to Astro Observe documentation"},
                },
            ],
        }
    }


# See https://openlineage.io/docs/spec/naming#dataset-naming
ol_dataset = OLDataset(
    name="<dataset-name>",
    namespace="<dataset-namespace>",
    facets=observe_facet(),
)
task = BashOperator(
    task_id="task",
    bash_command="exit 0;",
    outlets=[ol_dataset],
)
```

Use this dataset as an `outlets` value on any task that writes to it. The OpenLineage event for that task includes the dataset with this facet, and Astro Observe attaches the link to the corresponding dataset asset.

To attach the facet to a task run instead of a dataset, emit it as a custom run facet. See [Custom facets](https://airflow.apache.org/docs/apache-airflow-providers-openlineage/stable/configurations-ref.html#custom-facets) in the Apache Airflow documentation.
