

# Lineage tracking OpenLineage facets

Amazon SageMaker AI sends lineage to AWS Glue Data Catalog as OpenLineage events. Each event describes a job, its run, and the datasets that the run reads and writes. Jobs include training, processing, and transform jobs and endpoints. Datasets include models, model packages, feature groups, hub content, and inference components. Amazon SageMaker AI attaches metadata to these nodes as *facets*.

Facets that are defined by the OpenLineage specification follow that specification. This page defines the custom facets that Amazon SageMaker AI adds. Every custom facet links to this page in its `_schemaURL` field.

## Common fields
<a name="lineage-tracking-ol-facets-common"></a>

Every custom facet contains the following OpenLineage base fields.


| Field | Type | Description | 
| --- | --- | --- | 
| \_producer | String (URI) | https://aws.amazon.com/sagemaker/ | 
| \_schemaURL | String (URI) | The URL of this page. | 

## Custom facets
<a name="lineage-tracking-ol-facets-summary"></a>


**Custom facets that Amazon SageMaker AI writes**  

| Facet key | Facet type | Written on | 
| --- | --- | --- | 
| resourceTimestamps | Run, dataset | Every job run, and models, model packages, feature groups, hub content, and inference components | 
| executionParameters | Run | Training jobs | 
| endpointDeploymentChain | Job | Endpoints | 
| stageLifecycle | Dataset | Model packages | 
| inferenceComponentModel | Dataset | Inference components | 
| tags | Dataset | Dataset nodes for Amazon SageMaker AI resources that have sagemaker: tags | 
| project | Run, dataset | Jobs and datasets for resources that belong to a Amazon SageMaker AI project | 

## resourceTimestamps
<a name="lineage-tracking-ol-facets-timestamps"></a>

The times that the Amazon SageMaker AI resource was created, last modified, started, and completed. A field that the resource doesn't report is left out. For example, an endpoint has no start or completion time, and a running job has no completion time.


| Field | Type | Description | 
| --- | --- | --- | 
| createdAt | String | When the resource was created. | 
| updatedAt | String | When the resource was last modified. On a dataset node, if the resource can't be modified, such as a model, this value equals createdAt. | 
| startedAt | String | Run facet only. When the job started running. | 
| completedAt | String | Run facet only. When the job completed. | 

The following JSON Schema defines the run form of the facet.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking-ol-facets.html#ResourceTimestampsRunFacet",
  "$defs": {
    "ResourceTimestampsRunFacet": {
      "allOf": [
        {
          "$ref": "https://openlineage.io/spec/2-0-2/OpenLineage.json#/$defs/RunFacet"
        },
        {
          "type": "object",
          "properties": {
            "createdAt": {
              "type": "string",
              "format": "date-time"
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time"
            },
            "startedAt": {
              "type": "string",
              "format": "date-time"
            },
            "completedAt": {
              "type": "string",
              "format": "date-time"
            }
          },
          "description": "Run form. Fields the resource doesn't report are omitted."
        }
      ]
    }
  },
  "type": "object",
  "properties": {
    "resourceTimestamps": {
      "$ref": "#/$defs/ResourceTimestampsRunFacet"
    }
  }
}
```

The following JSON Schema defines the dataset form of the facet.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking-ol-facets.html#ResourceTimestampsDatasetFacet",
  "$defs": {
    "ResourceTimestampsDatasetFacet": {
      "allOf": [
        {
          "$ref": "https://openlineage.io/spec/2-0-2/OpenLineage.json#/$defs/DatasetFacet"
        },
        {
          "type": "object",
          "properties": {
            "createdAt": {
              "type": "string",
              "format": "date-time"
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time"
            }
          },
          "description": "Dataset form. updatedAt equals createdAt for a resource that can't be modified.",
          "required": [
            "createdAt",
            "updatedAt"
          ]
        }
      ]
    }
  },
  "type": "object",
  "properties": {
    "resourceTimestamps": {
      "$ref": "#/$defs/ResourceTimestampsDatasetFacet"
    }
  }
}
```

## executionParameters
<a name="lineage-tracking-ol-facets-execution-parameters"></a>

The compute configuration of a training job, from its `ResourceConfig`.


| Field | Type | Description | 
| --- | --- | --- | 
| parameters | Array of objects | Key-value pairs. Each object has a `key` (string) and a `value`. The keys are the following:+  `instanceType` (string): the ML compute instance type, for example `ml.m5.xlarge`. <br />+  `instanceCount` (integer): the number of instances. <br />+  `volumeSizeInGB` (integer): the size of the storage volume attached to each instance, in GB.  | 

The following JSON Schema defines this facet.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking-ol-facets.html#ExecutionParametersRunFacet",
  "$defs": {
    "ExecutionParametersRunFacet": {
      "allOf": [
        {
          "$ref": "https://openlineage.io/spec/2-0-2/OpenLineage.json#/$defs/RunFacet"
        },
        {
          "type": "object",
          "properties": {
            "parameters": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "enum": [
                      "instanceType",
                      "instanceCount",
                      "volumeSizeInGB"
                    ]
                  },
                  "value": {
                    "type": [
                      "string",
                      "integer"
                    ]
                  }
                },
                "required": [
                  "key",
                  "value"
                ]
              }
            }
          },
          "required": [
            "parameters"
          ]
        }
      ]
    }
  },
  "type": "object",
  "properties": {
    "executionParameters": {
      "$ref": "#/$defs/ExecutionParametersRunFacet"
    }
  }
}
```

## endpointDeploymentChain
<a name="lineage-tracking-ol-facets-endpoint"></a>

The endpoint configuration that an endpoint runs, and the models that each production variant serves.


| Field | Type | Description | 
| --- | --- | --- | 
| endpointConfigName | String | The name of the endpoint configuration. | 
| endpointConfigArn | String | The ARN of the endpoint configuration. | 
| productionVariants | Array of objects | One object for each production variant, with the following fields:+  `variantName` (string): the name of the variant. <br />+  `modelName` (string): the name of the model that the variant serves. <br />+  `modelArn` (string): the ARN of the model. <br />+  `modelPackage` (string): the ARN of the model package that the model was created from, if any. <br />+  `instanceType` (string): the ML compute instance type. <br />+  `initialInstanceCount` (integer): the initial number of instances. <br />+  `initialVariantWeight` (number): the initial traffic weight of the variant. <br />A field that doesn't apply to the variant is `null`. | 
| shadowProductionVariants | Array of objects | Shadow variants, with the same fields as productionVariants. Reserved. This array is currently empty. | 

The following JSON Schema defines this facet.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking-ol-facets.html#EndpointDeploymentChainJobFacet",
  "$defs": {
    "EndpointDeploymentChainJobFacet": {
      "allOf": [
        {
          "$ref": "https://openlineage.io/spec/2-0-2/OpenLineage.json#/$defs/JobFacet"
        },
        {
          "type": "object",
          "properties": {
            "endpointConfigName": {
              "type": "string"
            },
            "endpointConfigArn": {
              "type": "string"
            },
            "productionVariants": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ProductionVariant"
              }
            },
            "shadowProductionVariants": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ProductionVariant"
              }
            }
          },
          "required": [
            "productionVariants",
            "shadowProductionVariants"
          ]
        }
      ]
    },
    "ProductionVariant": {
      "type": "object",
      "properties": {
        "variantName": {
          "type": [
            "string",
            "null"
          ]
        },
        "modelName": {
          "type": [
            "string",
            "null"
          ]
        },
        "modelArn": {
          "type": [
            "string",
            "null"
          ]
        },
        "modelPackage": {
          "type": [
            "string",
            "null"
          ]
        },
        "instanceType": {
          "type": [
            "string",
            "null"
          ]
        },
        "initialInstanceCount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "initialVariantWeight": {
          "type": [
            "number",
            "null"
          ]
        }
      }
    }
  },
  "type": "object",
  "properties": {
    "endpointDeploymentChain": {
      "$ref": "#/$defs/EndpointDeploymentChainJobFacet"
    }
  }
}
```

## stageLifecycle
<a name="lineage-tracking-ol-facets-stage-lifecycle"></a>

The approval status and lifecycle stage of a model package version.


| Field | Type | Description | 
| --- | --- | --- | 
| stages | Array of objects | The current stages of the model package. Each object has the following fields:+  `stage` (string): `Approval` for the approval status, or the name of the model lifecycle stage, for example `Staging`. <br />+  `status` (string): for `Approval`, the model approval status, such as `Approved`, `PendingManualApproval`, or `Rejected`. For a lifecycle stage, the stage status, or `Unknown` if none is set. <br />+  `description` (string): reserved.  | 

The following JSON Schema defines this facet.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking-ol-facets.html#StageLifecycleDatasetFacet",
  "$defs": {
    "StageLifecycleDatasetFacet": {
      "allOf": [
        {
          "$ref": "https://openlineage.io/spec/2-0-2/OpenLineage.json#/$defs/DatasetFacet"
        },
        {
          "type": "object",
          "properties": {
            "stages": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "stage": {
                    "type": "string",
                    "description": "Approval, or a model lifecycle stage name."
                  },
                  "status": {
                    "type": "string"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "stage",
                  "status"
                ]
              }
            }
          },
          "required": [
            "stages"
          ]
        }
      ]
    }
  },
  "type": "object",
  "properties": {
    "stageLifecycle": {
      "$ref": "#/$defs/StageLifecycleDatasetFacet"
    }
  }
}
```

## inferenceComponentModel
<a name="lineage-tracking-ol-facets-inference-component"></a>

The model that an inference component runs. All inference components on an endpoint are outputs of the same endpoint run, so the graph alone can't show which component runs which model. This facet records that pairing on the inference component node. Fields without a value are left out.


| Field | Type | Description | 
| --- | --- | --- | 
| modelName | String | The name of the model, from Specification.ModelName. | 
| modelArn | String | The ARN of the model. It matches the model's input node in the graph. | 
| baseInferenceComponentName | String | For an adapter inference component, the name of the base inference component that it extends, from Specification.BaseInferenceComponentName. | 
| variantName | String | The endpoint variant that the inference component runs on. | 

The following JSON Schema defines this facet.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking-ol-facets.html#InferenceComponentModelDatasetFacet",
  "$defs": {
    "InferenceComponentModelDatasetFacet": {
      "allOf": [
        {
          "$ref": "https://openlineage.io/spec/2-0-2/OpenLineage.json#/$defs/DatasetFacet"
        },
        {
          "type": "object",
          "properties": {
            "modelName": {
              "type": "string"
            },
            "modelArn": {
              "type": "string"
            },
            "baseInferenceComponentName": {
              "type": "string"
            },
            "variantName": {
              "type": "string"
            }
          },
          "description": "Fields without a value are omitted."
        }
      ]
    }
  },
  "type": "object",
  "properties": {
    "inferenceComponentModel": {
      "$ref": "#/$defs/InferenceComponentModelDatasetFacet"
    }
  }
}
```

## tags
<a name="lineage-tracking-ol-facets-tags"></a>

The Amazon SageMaker AI system tags on the resource. Only tags whose key starts with `sagemaker:` are included. On job runs, Amazon SageMaker AI writes the same tags in the standard OpenLineage `tags` run facet instead.


| Field | Type | Description | 
| --- | --- | --- | 
| tags | Array of objects | Each object has a key (string) and a value (string). | 

The following JSON Schema defines this facet.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking-ol-facets.html#TagsDatasetFacet",
  "$defs": {
    "TagsDatasetFacet": {
      "allOf": [
        {
          "$ref": "https://openlineage.io/spec/2-0-2/OpenLineage.json#/$defs/DatasetFacet"
        },
        {
          "type": "object",
          "properties": {
            "tags": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^sagemaker:"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "key",
                  "value"
                ]
              }
            }
          },
          "required": [
            "tags"
          ]
        }
      ]
    }
  },
  "type": "object",
  "properties": {
    "tags": {
      "$ref": "#/$defs/TagsDatasetFacet"
    }
  }
}
```

## project
<a name="lineage-tracking-ol-facets-project"></a>

The Amazon SageMaker AI project that the resource belongs to, from its `sagemaker:project-id` tag. Amazon SageMaker AI writes this facet on both the job node and the dataset nodes that the resource owns, so that you can filter a lineage graph by project.


| Field | Type | Description | 
| --- | --- | --- | 
| projectId | String | The project ID. This is the ID, not the project name. | 

The following JSON Schema defines the run form of the facet.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking-ol-facets.html#ProjectRunFacet",
  "$defs": {
    "ProjectRunFacet": {
      "allOf": [
        {
          "$ref": "https://openlineage.io/spec/2-0-2/OpenLineage.json#/$defs/RunFacet"
        },
        {
          "type": "object",
          "properties": {
            "projectId": {
              "type": "string"
            }
          },
          "description": "Run form, on the job node.",
          "required": [
            "projectId"
          ]
        }
      ]
    }
  },
  "type": "object",
  "properties": {
    "project": {
      "$ref": "#/$defs/ProjectRunFacet"
    }
  }
}
```

The following JSON Schema defines the dataset form of the facet.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking-ol-facets.html#ProjectDatasetFacet",
  "$defs": {
    "ProjectDatasetFacet": {
      "allOf": [
        {
          "$ref": "https://openlineage.io/spec/2-0-2/OpenLineage.json#/$defs/DatasetFacet"
        },
        {
          "type": "object",
          "properties": {
            "projectId": {
              "type": "string"
            }
          },
          "description": "Dataset form, on the resource's own dataset nodes.",
          "required": [
            "projectId"
          ]
        }
      ]
    }
  },
  "type": "object",
  "properties": {
    "project": {
      "$ref": "#/$defs/ProjectDatasetFacet"
    }
  }
}
```