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>) -> OpenLineageClient
pub fn new(transport: Arc<dyn Transport>) -> OpenLineageClient
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<OpenLineageClient, ClientError>
pub fn try_new( transport: Arc<dyn Transport>, ) -> Result<OpenLineageClient, 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,
) -> OpenLineageClient
pub fn with_queue_size( transport: Arc<dyn Transport>, queue_size: usize, ) -> OpenLineageClient
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<OpenLineageClient, ClientError>
pub fn try_with_queue_size( transport: Arc<dyn Transport>, queue_size: usize, ) -> Result<OpenLineageClient, 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() -> OpenLineageClient
pub fn noop() -> OpenLineageClient
A client whose transport drops everything (NoopTransport).
Sourcepub fn from_env() -> Result<OpenLineageClient, ClientError>
pub fn from_env() -> Result<OpenLineageClient, 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 moreAuto Trait Implementations§
impl !RefUnwindSafe for OpenLineageClient
impl !UnwindSafe for OpenLineageClient
impl Freeze for OpenLineageClient
impl Send for OpenLineageClient
impl Sync for OpenLineageClient
impl Unpin for OpenLineageClient
impl UnsafeUnpin for OpenLineageClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more