pub struct OpenLineageBuilder { /* private fields */ }Expand description
Builds and installs OpenLineage instrumentation on a SessionState.
Set a transport (or client) and, optionally, a context provider and config;
then call Self::instrument. Self::from_env is the one-call path that
derives everything from the standard OpenLineage environment.
Implementations§
Source§impl OpenLineageBuilder
impl OpenLineageBuilder
Sourcepub fn from_env(self) -> Result<Self, ClientError>
pub fn from_env(self) -> Result<Self, ClientError>
Derive client, context, and config from the standard OpenLineage environment in one call.
Builds the client via OpenLineageClient::from_env (reads
OPENLINEAGE_URL / OPENLINEAGE_ENDPOINT / OPENLINEAGE_API_KEY), the
config via OpenLineageConfig::for_datafusion_from_env (reads
OPENLINEAGE_NAMESPACE / OPENLINEAGE_TIMEOUT_MS), and the context via
LineageContext::from_env (reads the parent-run variables). Anything
set explicitly on the builder beforehand is preserved.
§Errors
Returns ClientError if the client cannot be built — e.g. called
outside a Tokio runtime, or OPENLINEAGE_URL is malformed.
Sourcepub fn client(self, client: OpenLineageClient) -> Self
pub fn client(self, client: OpenLineageClient) -> Self
Use a pre-built OpenLineageClient. Takes precedence over
Self::transport.
Sourcepub fn transport(self, transport: Arc<dyn Transport>) -> Self
pub fn transport(self, transport: Arc<dyn Transport>) -> Self
Drain events into transport. A client is constructed around it at
Self::instrument time. Ignored if Self::client is also set.
Sourcepub fn context(self, context: Arc<dyn LineageContextProvider>) -> Self
pub fn context(self, context: Arc<dyn LineageContextProvider>) -> Self
Set the per-query context provider. Defaults to an empty
StaticContextProvider.
Sourcepub fn config(self, config: OpenLineageConfig) -> Self
pub fn config(self, config: OpenLineageConfig) -> Self
Set the static config. Defaults to OpenLineageConfig::for_datafusion.
Sourcepub fn instrument(self, state: SessionState) -> SessionState
pub fn instrument(self, state: SessionState) -> SessionState
Install the instrumentation on state, returning the wired
SessionState.
Sets the session’s query planner to an OpenLineageQueryPlanner. A
pre-existing custom QueryPlanner is replaced; standard physical planning
(including extension nodes) is preserved because the new planner delegates
to a DefaultPhysicalPlanner.
§Panics
Panics if no client or transport was set and a default client must be
built outside a Tokio runtime. Prefer Self::from_env (which surfaces a
ClientError) or set a client built with
OpenLineageClient::try_new.
Trait Implementations§
Source§impl Debug for OpenLineageBuilder
impl Debug for OpenLineageBuilder
Source§impl Default for OpenLineageBuilder
impl Default for OpenLineageBuilder
Source§fn default() -> OpenLineageBuilder
fn default() -> OpenLineageBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for OpenLineageBuilder
impl !UnwindSafe for OpenLineageBuilder
impl Freeze for OpenLineageBuilder
impl Send for OpenLineageBuilder
impl Sync for OpenLineageBuilder
impl Unpin for OpenLineageBuilder
impl UnsafeUnpin for OpenLineageBuilder
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> 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