OpenLineage Documentation
repository·main·Indexed 25 days ago
https://github.com/openlineage/openlineageAn open standard for collecting metadata and data lineage by instrumenting jobs during execution. It provides a unified model of jobs, runs, and datasets to enable consistent observability across diverse data tools. The documentation covers the Go SDK for managing run lifecycles and event emission, as well as Java transport dependencies for Amazon DataZone, GCP Lineage (Dataplex), and Google Cloud Storage.
What's inside OpenLineage
- The OpenLineage Flink integration enables the emission of OpenLineage metadata from Apache Flink applications. It achieves this by using JVM instrumentation to capture lineage information during runtime. For detailed configuration and setup instructions, refer to the official OpenLineage documentation.
Overview of OpenLineage Java SDK core components
mainThe OpenLineage Java SDK is used to generate and emit OpenLineage events to backends. The SDK provides several core data structures and mechanisms:
Core Data Structures
RunEvent: Represents an event in a lineage run.RunState: Represents the state of a run.Run: Represents a specific execution.Job: Represents the logical unit of work.Dataset: Represents the data entities involved.Facets: Various metadata components that can be attached toRun,Job, orDatasetobjects.
Transport Mechanism
Transport: An abstraction used to carry lineage events to target endpoints (e.g., via HTTP). The library provides various built-in transports.
New use cases supported by Static Lineage in OpenLineage 1.0
mainWith the introduction of static lineage in version 1.0, the following use cases are now supported:
- Bootstrapping lineage graphs: Using prospective runs for auditing purposes.
- Dataset ownership: Capturing changes to dataset ownership that occur outside of standard job runs.
- External facets: Consuming facets from external systems.
- Dataset symlinks: Creating dataset symlinks more easily.
Understand the OpenLineage Test Suite Workflows
mainThe OpenLineage test suite utilizes three distinct workflows to ensure compatibility across different scenarios. These workflows automate component testing, report generation, and failure detection. Depending on the trigger, the scope of tested components and the version of the OpenLineage specification used will vary:
1. New Release Workflow
Goal: Update compatibility data. Trigger: Periodic runs that check for new releases of OpenLineage or its components. Scope: Tests both Producers and Consumers. Component Selection: Only components with new releases are tested, or all components if a new OpenLineage release is detected. OpenLineage Versions: Uses official Release Versions. Additional Actions: Notifies about new failures, updates test reports, and updates compatibility information.
2. Spec Update Workflow
Goal: Notify developers of potential backward compatibility issues when the specification changes. Trigger: Periodic runs that check for updates to the specification in the OpenLineage
mainbranch. Scope: Tests Producers and Consumer Input Events. Component Selection: All Producers and Consumer Input Events are tested. OpenLineage Versions: Uses the Latest snapshot version from themainbranch. Additional Actions: Notifies about new failures.3. Test Suite PR Workflow
Goal: Ensure that changes made to the test suite itself do not introduce new failures. Trigger: A Pull Request (PR) submitted to the Test Suite repository. Scope: Tests Producers, Consumers, and Consumer Input Events. Component Selection: All Producers, Consumers, and Consumer Input Events are tested. OpenLineage Versions: Uses official Release Versions.
Understand OpenLineage Compatibility Tests
mainThe OpenLineage Compatibility Tests are a suite of automated checks designed to validate how different versions of OpenLineage interact with various producers (components that emit events) and consumers (components that ingest events).
These tests are hosted in a dedicated GitHub repository and use GitHub Actions to continuously verify compatibility. The results are used to generate compatibility tables in the official documentation.
Validation Types:
- For Producers: Validates that generated OpenLineage events comply with the expected structure (syntax) and that the values in the event fields are correct (semantics).
- For Consumers: Validates that valid OpenLineage events can be ingested without error (syntax) and that they result in the correct changes to the consumer's internal state (semantics).
Available local OpenLineage integration packages
mainThe following integration packages are maintained locally within this repository:
- dbt: Integration for dbt projects.
- Apache Spark: Integration for Spark workloads.
- Apache Flink: Integration for Flink workloads.
Note: The Apache Airflow integration is maintained in the official Apache Airflow repository rather than locally here.
Use OpenLineage clients and integrations
mainOpenLineage can be implemented by using official clients to send events to an HTTP backend or by using existing integrations that automatically collect metadata as OpenLineage events.
Clients
If you are building custom tools, you can use the following clients to emit OpenLineage events via HTTP:
- Java Client
- Python Client
Integrations
Metadata can be collected automatically from common data tools using these integrations:
- Apache Airflow: Supports BigQuery, Great Expectations, Postgres, Redshift, and Snowflake.
- Apache Spark
- dbt
Use the OpenLineage Spark Listener
mainThe OpenLineage Spark Agent uses JVM instrumentation to automatically emit OpenLineage metadata from Spark applications. This allows you to capture lineage information without manually instrumenting your Spark code.
For detailed setup, refer to the official documentation links:
- Installation: How to add the agent to your Spark environment.
- Configuration: How to tune the agent's behavior.
- Quickstart: A guide for running a local Spark job with OpenLineage.
- Column-Level Lineage: How to enable and use fine-grained lineage tracking.
- Extending: How to build custom extensions for the Spark agent.
Core modules of the OpenLineage Python Client
mainThe OpenLineage Python client is organized into several functional modules for interacting with the OpenLineage specification:
openlineage.client.client: The primary entry point for client operations.openlineage.client.event_v2: Handles OpenLineage event models (v2).openlineage.client.facet&openlineage.client.facet_v2: Modules for managing facets (metadata extensions).openlineage.client.run: Provides abstractions for representing job runs.openlineage.client.serde: Handles serialization and deserialization of OpenLineage data.openlineage.client.transport: Contains various transport implementations for sending metadata (e.g., HTTP, Kafka, File, Console).
Supported Apache Spark 3.x versions in the Spark3 Module
mainThe Spark3 module provides common code for Apache Spark 3.x.y versions where x >= 2. This includes support for:
- Spark 3.2.w
- Spark 3.3.x
- Spark 3.4.y
- Spark 3.5.z
Configure the OpenLineage Python client
mainThe OpenLineage Python client can be configured using four main sections:
- Transports: Defines how events are sent (e.g., HTTP, Kafka, File, Console).
- Facets: Configures metadata facets, such as attaching environment variables to events.
- Filters: Defines rules to selectively exclude specific events.
- Tags: Configures custom tags added to jobs and runs as custom facets.
Configuration Methods and Precedence
Configuration is read only at client creation time. The precedence (from highest to lowest) is:
- Python Code: Passed directly to the
OpenLineageClientconstructor via theconfigparameter. - YAML Configuration File: An
openlineage.ymlfile. - Environment Variables: Variables with the
OPENLINEAGE__prefix. - Legacy Environment Variables: Specific variables for HTTP transport (e.g.,
OPENLINEAGE_URL).
If no configuration is provided, the client defaults to
ConsoleTransport, printing events to the console.Use the OpenLineage Python Client
mainThe OpenLineage Python Client is used to emit lineage metadata from Python-based data processing applications to an OpenLineage-compliant backend. For detailed implementation guides, API references, and advanced configuration, refer to the official documentation.