| Title: | Create and Emit 'OpenLineage' Events |
|---|---|
| Description: | Construct and validate run events that follow the 'OpenLineage' specification <https://openlineage.io/>. Model run lifecycles, datasets, and extensible facets with protocol-aware 'R' objects. Serialize events into deterministic JavaScript Object Notation (JSON) while preserving wire field names. Deliver events synchronously over Hypertext Transfer Protocol (HTTP) with authentication and retries, or use offline transports for local development and testing. |
| Authors: | Pedro Baltazar [aut, cre, cph] |
| Maintainer: | Pedro Baltazar <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0.9000 |
| Built: | 2026-09-25 08:13:00 UTC |
| Source: | https://github.com/pedrobtz/openlineage |
Build validated OpenLineage 2.0.2 run events, serialize them to the protocol wire format, and emit them through local or synchronous HTTP transports.
Create a Run, Job, and optional input/output datasets, then combine them in a RunEvent. An OpenLineageClient emits the event through an injected transport or through HTTP configured by constructor arguments or environment variables.
Typed facet constructors cover common metadata. Use ol_facet to attach a facet schema that does not yet have a typed R constructor.
Maintainer: Pedro Baltazar [email protected] [copyright holder]
Authors:
Pedro Baltazar [email protected] [copyright holder]
OpenLineageClient, RunEvent, local_transports, HttpTransport
Recursively converts OpenLineage S7 models to named R lists. Protocol field
names are applied here, RunState values are unwrapped, and NULL
properties are omitted. Object key order is deterministic; array order is
preserved.
as_openlineage_list(x)as_openlineage_list(x)
x |
An OpenLineage model or supported nested value. |
A named list for a model, or the corresponding wire value for a nested value.
run <- Run("019c0000-0000-7000-8000-000000000001") as_openlineage_list(run)run <- Run("019c0000-0000-7000-8000-000000000001") as_openlineage_list(run)
Constructors for dataset-level schema, data-source, and tag metadata.
SchemaField( name, type = NULL, description = NULL, ordinal_position = NULL, fields = list() ) SchemaDatasetFacet( fields = list(), producer = OPENLINEAGE_PRODUCER, deleted = NULL ) DatasourceDatasetFacet( name = NULL, uri = NULL, producer = OPENLINEAGE_PRODUCER, deleted = NULL )SchemaField( name, type = NULL, description = NULL, ordinal_position = NULL, fields = list() ) SchemaDatasetFacet( fields = list(), producer = OPENLINEAGE_PRODUCER, deleted = NULL ) DatasourceDatasetFacet( name = NULL, uri = NULL, producer = OPENLINEAGE_PRODUCER, deleted = NULL )
name |
A field or data-source name. |
type |
An optional field type. |
description |
An optional field description. |
ordinal_position |
An optional one-based field position. |
fields |
For |
producer |
A URI identifying the facet producer. |
deleted |
Whether this facet deletes a previously emitted facet. |
uri |
An optional data-source URI. |
A typed dataset facet or schema-field S7 object.
field <- SchemaField("order_id", "INTEGER", ordinal_position = 1L) SchemaDatasetFacet(list(field)) DatasourceDatasetFacet("warehouse", "postgres://warehouse")field <- SchemaField("order_id", "INTEGER", ordinal_position = 1L) SchemaDatasetFacet(list(field)) DatasourceDatasetFacet("warehouse", "postgres://warehouse")
Dataset identifies a dataset. InputDataset and OutputDataset add
lifecycle-specific facet maps and are the only dataset types accepted by a
RunEvent.
Dataset(namespace, name, facets = list()) InputDataset(namespace, name, facets = list(), input_facets = list()) OutputDataset(namespace, name, facets = list(), output_facets = list())Dataset(namespace, name, facets = list()) InputDataset(namespace, name, facets = list(), input_facets = list()) OutputDataset(namespace, name, facets = list(), output_facets = list())
namespace |
A non-empty namespace string. |
name |
A non-empty dataset name. |
facets |
A named list of dataset facets, or |
input_facets |
A named list of input facets, or |
output_facets |
A named list of output facets, or |
A Dataset, InputDataset, or OutputDataset S7 object.
Dataset("postgres://warehouse", "analytics.orders") InputDataset("postgres://warehouse", "raw.orders") OutputDataset("postgres://warehouse", "analytics.orders")Dataset("postgres://warehouse", "analytics.orders") InputDataset("postgres://warehouse", "raw.orders") OutputDataset("postgres://warehouse", "analytics.orders")
Sends OpenLineage events as JSON POST requests. The base url and
relative endpoint are joined with one slash; a URL that already ends in
the endpoint is not duplicated.
Supply api_key for Authorization: Bearer <key> authentication, or place
authentication headers in headers. Supplying both an API key and a custom
Authorization header is an error. All custom headers are redacted from
httr2 request printing.
HTTP 429, 500, 502, 503, and 504 responses and low-level connection
failures are retried up to max_retries times. HTTP 401 and 403 responses
are never retried. Set verify_tls = FALSE only for controlled development
environments; doing so raises an openlineage_insecure_tls_warning.
An R6 HTTP transport object.
OpenLineageTransport -> HttpTransport
OpenLineageTransport$close()HttpTransport$new()Create an HTTP transport.
HttpTransport$new( url, endpoint = "api/v1/lineage", api_key = NULL, headers = character(), timeout = 5, verify_tls = TRUE, max_retries = 3L )
urlAn absolute HTTP or HTTPS base URL.
endpointA relative OpenLineage endpoint path.
api_keyAn optional bearer API key.
headersOptional custom headers as a named character vector.
timeoutA positive request timeout in seconds.
verify_tlsWhether to verify TLS certificates.
max_retriesA non-negative number of retries after the first request attempt.
A new HttpTransport object.
HttpTransport$emit()Send an event to the configured OpenLineage HTTP endpoint.
HttpTransport$emit(event)
eventA RunEvent model.
event, invisibly, after a successful HTTP response.
HttpTransport$print()Print a redacted transport summary.
HttpTransport$print(...)
...Unused.
The transport, invisibly.
HttpTransport$clone()The objects of this class are cloneable with this method.
HttpTransport$clone(deep = FALSE)
deepWhether to make a deep clone.
transport <- HttpTransport$new("https://example.com") transporttransport <- HttpTransport$new("https://example.com") transport
Input and output statistics facets
InputStatisticsInputDatasetFacet( row_count = NULL, size = NULL, file_count = NULL, producer = OPENLINEAGE_PRODUCER ) OutputStatisticsOutputDatasetFacet( row_count = NULL, size = NULL, file_count = NULL, producer = OPENLINEAGE_PRODUCER )InputStatisticsInputDatasetFacet( row_count = NULL, size = NULL, file_count = NULL, producer = OPENLINEAGE_PRODUCER ) OutputStatisticsOutputDatasetFacet( row_count = NULL, size = NULL, file_count = NULL, producer = OPENLINEAGE_PRODUCER )
row_count |
The optional number of rows read or written. |
size |
The optional number of bytes read or written. |
file_count |
The optional number of files read or written. |
producer |
A URI identifying the facet producer. |
A typed input- or output-dataset facet S7 object.
InputStatisticsInputDatasetFacet(row_count = 100L) OutputStatisticsOutputDatasetFacet(row_count = 100L, size = 2048L)InputStatisticsInputDatasetFacet(row_count = 100L) OutputStatisticsOutputDatasetFacet(row_count = 100L, size = 2048L)
Identifies a job within a producer-defined namespace.
Job(namespace, name, facets = list())Job(namespace, name, facets = list())
namespace |
A non-empty namespace string. |
name |
A non-empty job name. |
facets |
A named list of job facets, or |
A Job S7 object.
Job("example-scheduler", "daily-report")Job("example-scheduler", "daily-report")
Constructors for SQL, source location, and job-type metadata.
SQLJobFacet( query, dialect = NULL, producer = OPENLINEAGE_PRODUCER, deleted = NULL ) SourceCodeLocationJobFacet( type, url, repo_url = NULL, path = NULL, version = NULL, tag = NULL, branch = NULL, pull_request_number = NULL, producer = OPENLINEAGE_PRODUCER, deleted = NULL ) EmissionPattern(event_trigger, event_content_mode, window_duration = NULL) JobTypeJobFacet( processing_type, integration, job_type = NULL, emission_pattern = NULL, producer = OPENLINEAGE_PRODUCER, deleted = NULL )SQLJobFacet( query, dialect = NULL, producer = OPENLINEAGE_PRODUCER, deleted = NULL ) SourceCodeLocationJobFacet( type, url, repo_url = NULL, path = NULL, version = NULL, tag = NULL, branch = NULL, pull_request_number = NULL, producer = OPENLINEAGE_PRODUCER, deleted = NULL ) EmissionPattern(event_trigger, event_content_mode, window_duration = NULL) JobTypeJobFacet( processing_type, integration, job_type = NULL, emission_pattern = NULL, producer = OPENLINEAGE_PRODUCER, deleted = NULL )
query |
The SQL query text. |
dialect |
An optional SQL dialect. |
producer |
A URI identifying the facet producer. |
deleted |
Whether this facet deletes a previously emitted facet. |
type |
The source-control system type. |
url |
The full source-code URL. |
repo_url, path, version, tag, branch, pull_request_number
|
Optional source location details. |
event_trigger |
When events are emitted. |
event_content_mode |
Whether events accumulate or contain snapshots. |
window_duration |
An optional positive duration in seconds. |
processing_type |
The processing type, such as |
integration |
The integration name, such as |
job_type |
An optional integration-specific job type. |
emission_pattern |
An optional |
A typed job facet or emission-pattern S7 object.
SQLJobFacet("SELECT 1", dialect = "ansi") SourceCodeLocationJobFacet( "git", "https://github.com/example/project/blob/main/job.R" ) pattern <- EmissionPattern("EVENT_BASED", "COMPLETE_SNAPSHOT") JobTypeJobFacet("BATCH", "R", emission_pattern = pattern)SQLJobFacet("SELECT 1", dialect = "ansi") SourceCodeLocationJobFacet( "git", "https://github.com/example/project/blob/main/job.R" ) pattern <- EmissionPattern("EVENT_BASED", "COMPLETE_SNAPSHOT") JobTypeJobFacet("BATCH", "R", emission_pattern = pattern)
Offline transports for testing, local development, and disabled emission.
Every emit(event) method accepts a RunEvent model and returns that event
invisibly after success.
AccumulatingTransport stores emitted models in its public events list.
Its clear() method removes all accumulated events and returns the transport
invisibly.
ConsoleTransport writes one JSON event to stream. Set pretty = TRUE
for indented output.
NoopTransport validates an event but performs no output or storage.
All transports provide close(), which returns TRUE invisibly because the
local transports have no pending work.
An R6 transport object.
OpenLineageTransport -> AccumulatingTransport
eventsEmitted RunEvent models in emission order.
OpenLineageTransport$close()AccumulatingTransport$new()Create an empty accumulating transport.
AccumulatingTransport$new()
A new AccumulatingTransport object.
AccumulatingTransport$emit()Store an event.
AccumulatingTransport$emit(event)
eventA RunEvent model.
event, invisibly.
AccumulatingTransport$clear()Remove all stored events.
AccumulatingTransport$clear()
The transport, invisibly.
AccumulatingTransport$clone()The objects of this class are cloneable with this method.
AccumulatingTransport$clone(deep = FALSE)
deepWhether to make a deep clone.
OpenLineageTransport -> ConsoleTransport
OpenLineageTransport$close()ConsoleTransport$new()Create a console transport.
ConsoleTransport$new(stream = stdout(), pretty = TRUE)
streamAn open, writable R connection.
prettyWhether JSON should be indented.
A new ConsoleTransport object.
ConsoleTransport$emit()Serialize and write an event to the configured connection.
ConsoleTransport$emit(event)
eventA RunEvent model.
event, invisibly.
ConsoleTransport$clone()The objects of this class are cloneable with this method.
ConsoleTransport$clone(deep = FALSE)
deepWhether to make a deep clone.
OpenLineageTransport -> NoopTransport
OpenLineageTransport$close()NoopTransport$emit()Validate an event without emitting it.
NoopTransport$emit(event)
eventA RunEvent model.
event, invisibly.
NoopTransport$clone()The objects of this class are cloneable with this method.
NoopTransport$clone(deep = FALSE)
deepWhether to make a deep clone.
transport <- AccumulatingTransport$new() event <- RunEvent( Run(new_run_id()), Job("example", "task"), event_type = "START" ) transport$emit(event) length(transport$events) console <- ConsoleTransport$new(pretty = FALSE) noop <- NoopTransport$new() noop$emit(event)transport <- AccumulatingTransport$new() event <- RunEvent( Run(new_run_id()), Job("example", "task"), event_type = "START" ) transport$emit(event) length(transport$events) console <- ConsoleTransport$new(pretty = FALSE) noop <- NoopTransport$new() noop$emit(event)
Converts an R date-time to an ISO 8601 UTC timestamp with millisecond
precision, suitable for the eventTime field of an OpenLineage event.
new_event_time(time = Sys.time())new_event_time(time = Sys.time())
time |
A single, non-missing |
A single UTC timestamp string.
time <- as.POSIXct("2026-01-02 03:04:05", tz = "UTC") new_event_time(time)time <- as.POSIXct("2026-01-02 03:04:05", tz = "UTC") new_event_time(time)
Generates a random UUID suitable for the runId field of an OpenLineage
run. The UUID version is an implementation detail and may change.
new_run_id()new_run_id()
A single UUID string.
new_run_id()new_run_id()
Creates a facet for extensions or facet schemas without a typed constructor.
Names supplied through ... are preserved exactly at the JSON boundary.
ol_facet(schema_url, ..., producer = OPENLINEAGE_PRODUCER, deleted = NULL)ol_facet(schema_url, ..., producer = OPENLINEAGE_PRODUCER, deleted = NULL)
schema_url |
The URI of the facet's JSON Schema definition. |
... |
Named facet fields using their OpenLineage wire names. |
producer |
A URI identifying the facet producer. |
deleted |
Whether this facet deletes a previously emitted job or
dataset facet. Use only where the target schema supports |
A generic OpenLineage facet accepted in any facet map.
facet <- ol_facet( "https://example.com/CustomRunFacet.json", customValue = "example" ) Run(new_run_id(), facets = list(custom = facet))facet <- ol_facet( "https://example.com/CustomRunFacet.json", customValue = "example" ) Run(new_run_id(), facets = list(custom = facet))
Create an OpenLineage tag
ol_tag(key, value, source = NULL, field = NULL)ol_tag(key, value, source = NULL, field = NULL)
key |
The tag key. |
value |
The tag value. |
source |
An optional tag source. |
field |
An optional dataset field to which the tag applies. |
A tag record for a typed tags facet.
ol_tag("environment", "production", source = "USER")ol_tag("environment", "production", source = "USER")
Constants used by openlineage when constructing OpenLineage events.
OPENLINEAGE_SCHEMA_URL identifies the schema document, while
OPENLINEAGE_RUN_EVENT_SCHEMA_URL identifies its RunEvent definition.
OPENLINEAGE_SCHEMA_VERSION OPENLINEAGE_SCHEMA_URL OPENLINEAGE_RUN_EVENT_SCHEMA_URL OPENLINEAGE_PRODUCEROPENLINEAGE_SCHEMA_VERSION OPENLINEAGE_SCHEMA_URL OPENLINEAGE_RUN_EVENT_SCHEMA_URL OPENLINEAGE_PRODUCER
Character scalars.
OPENLINEAGE_SCHEMA_VERSION OPENLINEAGE_SCHEMA_URL OPENLINEAGE_RUN_EVENT_SCHEMA_URL OPENLINEAGE_PRODUCEROPENLINEAGE_SCHEMA_VERSION OPENLINEAGE_SCHEMA_URL OPENLINEAGE_RUN_EVENT_SCHEMA_URL OPENLINEAGE_PRODUCER
Coordinates event emission through an OpenLineage transport. Supply a
transport directly for local or custom delivery, or configure the built-in
HTTP transport with url and related arguments.
When an argument is absent, the client reads OPENLINEAGE_URL,
OPENLINEAGE_ENDPOINT, OPENLINEAGE_API_KEY, and
OPENLINEAGE_DISABLED. Explicit arguments take precedence over their
environment equivalents. OPENLINEAGE_DISABLED accepts only true or
false, ignoring case and surrounding whitespace.
A disabled client uses NoopTransport. An injected transport takes
precedence over HTTP environment variables. If neither a transport nor URL
is configured, the client uses ConsoleTransport. Supplying partial HTTP
settings without a URL is an error.
An R6 OpenLineage client object.
transportThe configured OpenLineage transport.
OpenLineageClient$new()Create an OpenLineage client.
OpenLineageClient$new( transport = NULL, url = NULL, endpoint = "api/v1/lineage", api_key = NULL, headers = character(), timeout = 5, verify_tls = TRUE, max_retries = 3L, disabled = NULL )
transportAn optional R6 transport with an emit(event) method.
urlAn optional HTTP or HTTPS base URL. If NULL,
OPENLINEAGE_URL is used when set.
endpointA relative OpenLineage endpoint path. If omitted,
OPENLINEAGE_ENDPOINT is used when set.
api_keyAn optional bearer API key. If NULL,
OPENLINEAGE_API_KEY is used when set.
headersOptional custom HTTP headers as a named character vector.
timeoutA positive HTTP request timeout in seconds.
verify_tlsWhether to verify TLS certificates.
max_retriesA non-negative number of HTTP retries after the first request attempt.
disabledWhether to disable emission. If NULL,
OPENLINEAGE_DISABLED is used when set.
A new OpenLineageClient object.
OpenLineageClient$emit()Emit an OpenLineage event through the configured transport.
OpenLineageClient$emit(event)
eventA RunEvent model.
event, invisibly, after successful delivery.
OpenLineageClient$print()Print a credential-free client summary.
OpenLineageClient$print(...)
...Unused.
The client, invisibly.
OpenLineageClient$clone()The objects of this class are cloneable with this method.
OpenLineageClient$clone(deep = FALSE)
deepWhether to make a deep clone.
local_transports, HttpTransport
transport <- AccumulatingTransport$new() client <- OpenLineageClient$new(transport = transport, disabled = FALSE) event <- RunEvent( Run(new_run_id()), Job("example", "task"), event_type = "START" ) client$emit(event) length(transport$events)transport <- AccumulatingTransport$new() client <- OpenLineageClient$new(transport = transport, disabled = FALSE) event <- RunEvent( Run(new_run_id()), Job("example", "task"), event_type = "START" ) client$emit(event) length(transport$events)
Identifies one execution of an OpenLineage job.
Run(run_id, facets = list())Run(run_id, facets = list())
run_id |
A valid UUID string. |
facets |
A named list of run facets, or |
A Run S7 object.
Run(new_run_id())Run(new_run_id())
Constructors for commonly used OpenLineage run facets.
NominalTimeRunFacet( nominal_start_time, nominal_end_time = NULL, producer = OPENLINEAGE_PRODUCER ) ParentRunFacet(run, job, root = NULL, producer = OPENLINEAGE_PRODUCER) ErrorMessageRunFacet( message, programming_language, stack_trace = NULL, producer = OPENLINEAGE_PRODUCER ) ProcessingEngineRunFacet( version, name = NULL, openlineage_adapter_version = NULL, producer = OPENLINEAGE_PRODUCER )NominalTimeRunFacet( nominal_start_time, nominal_end_time = NULL, producer = OPENLINEAGE_PRODUCER ) ParentRunFacet(run, job, root = NULL, producer = OPENLINEAGE_PRODUCER) ErrorMessageRunFacet( message, programming_language, stack_trace = NULL, producer = OPENLINEAGE_PRODUCER ) ProcessingEngineRunFacet( version, name = NULL, openlineage_adapter_version = NULL, producer = OPENLINEAGE_PRODUCER )
nominal_start_time |
The nominal start as an RFC 3339 date-time. |
nominal_end_time |
An optional nominal end date-time. |
producer |
A URI identifying the facet producer. |
run |
The parent |
job |
The parent |
root |
Optional |
message |
A human-readable error message. |
programming_language |
The language that produced the error. |
stack_trace |
An optional stack trace. |
version |
The processing engine version. |
name |
The optional processing engine name. |
openlineage_adapter_version |
The optional adapter version. |
A typed run facet S7 object.
NominalTimeRunFacet("2026-01-02T03:00:00.000Z") parent_run <- Run(new_run_id()) parent_job <- Job("example", "parent") ParentRunFacet(parent_run, parent_job) ErrorMessageRunFacet("Query failed", "R") ProcessingEngineRunFacet("4.6.0", name = "R")NominalTimeRunFacet("2026-01-02T03:00:00.000Z") parent_run <- Run(new_run_id()) parent_job <- Job("example", "parent") ParentRunFacet(parent_run, parent_job) ErrorMessageRunFacet("Query failed", "R") ProcessingEngineRunFacet("4.6.0", name = "R")
Describes a lifecycle transition for one job run and its input and output datasets.
RunEvent( run, job, event_type = NULL, event_time = new_event_time(), inputs = list(), outputs = list(), producer = OPENLINEAGE_PRODUCER, schema_url = OPENLINEAGE_RUN_EVENT_SCHEMA_URL )RunEvent( run, job, event_type = NULL, event_time = new_event_time(), inputs = list(), outputs = list(), producer = OPENLINEAGE_PRODUCER, schema_url = OPENLINEAGE_RUN_EVENT_SCHEMA_URL )
run |
A |
job |
A |
event_type |
A |
event_time |
An RFC 3339 date-time string with a time-zone offset. |
inputs |
An unnamed list of |
outputs |
An unnamed list of |
producer |
A URI identifying the event producer. |
schema_url |
The RunEvent JSON Schema URL. |
A RunEvent S7 object.
run <- Run(new_run_id()) job <- Job("example-scheduler", "daily-report") RunEvent( run, job, event_type = "START", event_time = new_event_time(as.POSIXct("2026-01-02", tz = "UTC")) )run <- Run(new_run_id()) job <- Job("example-scheduler", "daily-report") RunEvent( run, job, event_type = "START", event_time = new_event_time(as.POSIXct("2026-01-02", tz = "UTC")) )
A validated lifecycle state for an OpenLineage run.
RunState(value)RunState(value)
value |
One of |
A RunState S7 object.
RunState("START")RunState("START")
Typed tags facets
TagsJobFacet(tags = list(), producer = OPENLINEAGE_PRODUCER, deleted = NULL) TagsRunFacet(tags = list(), producer = OPENLINEAGE_PRODUCER) TagsDatasetFacet( tags = list(), producer = OPENLINEAGE_PRODUCER, deleted = NULL )TagsJobFacet(tags = list(), producer = OPENLINEAGE_PRODUCER, deleted = NULL) TagsRunFacet(tags = list(), producer = OPENLINEAGE_PRODUCER) TagsDatasetFacet( tags = list(), producer = OPENLINEAGE_PRODUCER, deleted = NULL )
tags |
An unnamed list created with |
producer |
A URI identifying the facet producer. |
deleted |
Whether a job or dataset facet is being deleted. |
A typed tags facet S7 object.
tag <- ol_tag("environment", "production") TagsJobFacet(list(tag)) TagsRunFacet(list(tag)) TagsDatasetFacet(list( ol_tag("sensitivity", "restricted", field = "customer_id") ))tag <- ol_tag("environment", "production") TagsJobFacet(list(tag)) TagsRunFacet(list(tag)) TagsDatasetFacet(list( ol_tag("sensitivity", "restricted", field = "customer_id") ))
Serialize an OpenLineage value to JSON
to_openlineage_json(x, pretty = FALSE)to_openlineage_json(x, pretty = FALSE)
x |
An OpenLineage model or supported nested value. |
pretty |
Whether to add indentation and line breaks. |
A single JSON string.
event <- RunEvent( Run("019c0000-0000-7000-8000-000000000001"), Job("example", "task"), event_type = "START", event_time = "2026-01-02T03:04:05.000Z" ) to_openlineage_json(event)event <- RunEvent( Run("019c0000-0000-7000-8000-000000000001"), Job("example", "task"), event_type = "START", event_time = "2026-01-02T03:04:05.000Z" ) to_openlineage_json(event)