pub struct OpenLineageClient { /* private fields */ }Expand description
Non-blocking front-end for emitting OpenLineage events.
Must be constructed from within a Tokio runtime (it spawns a background
drain task); see OpenLineageClient::try_new for the non-panicking form.
Implementations§
Source§impl OpenLineageClient
impl OpenLineageClient
Sourcepub fn new(transport: Arc<dyn Transport>) -> Self
pub fn new(transport: Arc<dyn Transport>) -> Self
Start a client that drains events into transport on a background task.
§Panics
Panics if called outside a Tokio runtime. Use Self::try_new to get a
clear error instead.
Sourcepub fn try_new(transport: Arc<dyn Transport>) -> Result<Self, ClientError>
pub fn try_new(transport: Arc<dyn Transport>) -> Result<Self, ClientError>
Fallible Self::new: returns ClientError::Config instead of
panicking when no Tokio runtime is available to host the drain task.
Sourcepub fn with_queue_size(transport: Arc<dyn Transport>, queue_size: usize) -> Self
pub fn with_queue_size(transport: Arc<dyn Transport>, queue_size: usize) -> Self
Self::new with an explicit in-flight queue bound.
§Panics
Panics if called outside a Tokio runtime; see Self::try_with_queue_size.
Sourcepub fn try_with_queue_size(
transport: Arc<dyn Transport>,
queue_size: usize,
) -> Result<Self, ClientError>
pub fn try_with_queue_size( transport: Arc<dyn Transport>, queue_size: usize, ) -> Result<Self, ClientError>
Fallible Self::with_queue_size: returns ClientError::Config
instead of panicking when no Tokio runtime is available.
§Errors
Returns ClientError::Config if called outside a Tokio runtime.
Sourcepub fn builder() -> OpenLineageClientBuilder
pub fn builder() -> OpenLineageClientBuilder
Returns a builder for configuring a client’s transport and queue size.
Sourcepub fn noop() -> Self
pub fn noop() -> Self
A client whose transport drops everything (NoopTransport).
Sourcepub fn from_env() -> Result<Self, ClientError>
pub fn from_env() -> Result<Self, ClientError>
Construct from the standard OpenLineage environment.
If OPENLINEAGE_URL is set, builds an HTTP transport (requires the
http feature); otherwise returns a no-op client. OPENLINEAGE_API_KEY,
if present, is sent as a bearer token.
Sourcepub fn emit(&self, event: RunEvent)
pub fn emit(&self, event: RunEvent)
Emit an event without blocking. On a full queue the event is dropped with a warning — lineage never applies back-pressure to the query.
Sourcepub fn dropped_count(&self) -> u64
pub fn dropped_count(&self) -> u64
Total events dropped so far — on a full/closed queue (back-pressure) or by transport failure. Process-global (shared across clones).
Sourcepub async fn shutdown(self)
pub async fn shutdown(self)
Flush queued events, flush the transport, and stop the background drain task.
Awaits the drain task to completion so events still queued at process exit
are delivered rather than lost, then calls Transport::flush so a
transport that buffers internally (e.g. a Kafka producer) delivers its
tail before exit. The drain task ends once the event channel closes, which
requires every sender to be dropped — so call this after (or while)
dropping all other clones of the client; this consumes the clone it is
called on. Idempotent across clones: only the clone holding the drain
handle awaits it, the rest return immediately.
Trait Implementations§
Source§impl Clone for OpenLineageClient
impl Clone for OpenLineageClient
Source§fn clone(&self) -> OpenLineageClient
fn clone(&self) -> OpenLineageClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more