OpenMetadata lineage for Kafka Connect

Overview

OpenMetadata is an open platform for working with metadata, designed for organizing data, searching, tracking its lineage, and managing data.

Starting with ADS 4.1.0.b1, OpenMetadata Reporter was added for the Iceberg Sink Connector to track lineage data between Kafka topics and Iceberg tables. Previously, this wasn’t implemented for the OpenMetadata Kafka Connect pipeline service.

OpenMetadata Reporter is a simple HTTP client that sends a lineage record using the PUT method. The lineage record is provided by the connector that uses OpenMetadata Reporter.

The lineage record includes a description of the lineage edges, where a Kafka topic is set as fromEntity and an Iceberg table as toEntity, and also specifies fromColumns and toColumns in columnsLineage to map the columns of the Iceberg table, messages in the Kafka topic, and ultimately the records (columns) from the primary source, for example, a PostgreSQL table via the Debezium CDC connector.

OpenMetadata Reporter implements a serial peripheral interface (SPI) MetadataReporter for Kafka Connect. Connectors send metadata events via MetadataReporter, and OpenMetadata Reporter asynchronously sends them to the OpenMetadata REST API. At the moment, OpenMetadata Reporter only supports lineage for the transmitted data (messages).

The Iceberg Sink Connector records lineage only after a successful commit of an Iceberg table snapshot. For each committed table, the connector reports relationships with every Kafka topic that supplied data for that commit. Column origin is matched by linking fields with the same names in the Kafka topic and the columns in the current Iceberg table schema.

OpenMetadata Reporter is enabled via the metadata.reporter.class parameter in the Iceberg Sink Connector configuration. If this parameter is not set, records in Iceberg continue as usual, and lineage is not tracked.

Before lineage can be created, OpenMetadata must have entities with FQNs that match the connector configuration, described below.

Creating lineage does not block connector data processing. Events are put into an in-memory queue and sent by a background thread. The queue is also cleared during task rebalancing or stopping.

If the required message services, databases, or pipelines, as well as the corresponding entities for topics, tables, or pipelines, do not yet exist in OpenMetadata, the lineage event is returned to the queue and retried during subsequent cleanups. Retries continue until all entity references become available or until the entity availability timeout expires (metadata.reporter.openmetadata.entity.not.available.retry.timeout.minutes parameter). The queue is not persisted to disk, so buffered events are lost if the worker process ends unexpectedly.

Prerequisites

Before configuring and running the connector using OpenMetadata Reporter, all objects being used (topics, tables, pipelines, databases) should already exist in OpenMetadata. OpenMetadata can automatically discover all objects via its integrated services:

Services can be created and connected to ADS services using API OpenMetadata or UI OpenMetadata.

An Iceberg table might need to be added manually by running Ingestion Framework External Deployment on ADH.

When running the Iceberg Sink Connector for the first time, a table might not exist, since in most cases the connector itself is responsible for creating a table. In this case, a retry mechanism is needed to try sending the lineage again after a table is created in OpenMetadata.

NOTE

An example of creating OpenMetadata services and connecting to ADS services is given in the Iceberg Connector article.

Example of creating a connector

An Iceberg Sink Connector with a connection to OpenMetadata can be created like any regular connector using any available method, using OpenMetadata Reporter parameters and special connector parameters that define the interaction between the connector and OpenMetadata services.

The Iceberg connector article describes creating a complete pipeline that captures data changes in PostgreSQL database tables and writes the changes to an Iceberg table in the ADS Control interface, including a JSON file example of the Iceberg Sink Connector configuration with a connection to OpenMetadata.

Configure

OpenMetadata Reporter

Configuration of OpenMetadata Reporter is done at the Iceberg Sink Connector configuration level. The main parameter is metadata.reporter.class — only after this parameter is set, is it possible to create a lineage for the connector.

The names of additional parameters that describe the behavior of OpenMetadata Reporter include the metadata.reporter.openmetadata. prefix (for example, metadata.reporter.openmetadata.url, metadata.reporter.openmetadata.token, etc.). Configuring these parameters is also done in the Iceberg Sink Connector configuration.

Iceberg Sink Connector

Setting up special parameters that describe the interaction between the Iceberg Sink Connector and OpenMetadata services is done at the connector configuration level.

The names of these parameters include the iceberg.metadata. prefix and specify the names of OpenMetadata services connected to ADS services (for example, iceberg.metadata.kafka-service-name, iceberg.metadata.pipeline-service-name, etc.).

NOTE

A complete description of the configuration parameters for OpenMetadata Reporter and special connector parameters for connecting to OpenMetadata is provided in the Iceberg Connector article.

FQN mapping

Object (entity) names in OpenMetadata are created according to certain rules for creating FQNs.

Below are examples of creating some entities.

Entity FQN format Example

Kafka topic

<kafka-service>.<topic>

kafka.orders

Kafka Connect pipeline

<pipeline-service>.<connector-name>

kafka-connect.iceberg-sink

Iceberg table

<iceberg-service>.<database>.<namespace>.<table>

iceberg.default.sales.orders

Column

<entity-fqn>.<column>

iceberg.default.sales.orders.id

The pipeline name is taken from the connector’s name property. An empty Iceberg namespace maps to default. Each segment of an FQN is escaped separately according to OpenMetadata rules. For example, the orders.v1 topic becomes kafka."orders.v1".

Current version limitations

There are currently some limitations when using OpenMetadata Reporter:

  • creating column lineage requires a direct match (SMTs are not considered);

  • for the TableCreated and SchemaEvolved events, lineage creation is not available yet;

  • creating lineage for source connectors (like Debezium) is expected in future updates.

Found a mistake? Seleсt text and press Ctrl+Enter to report it