Skip to main content

TelemetryClient

Struct TelemetryClient 

Source
pub struct TelemetryClient<P> { /* private fields */ }
Expand description

A KIP-714 client telemetry runtime over one persistent broker connection.

The same connection is reused for subscription and push requests so Kafka’s telemetry throttling state remains attached to one broker connection. The runtime refreshes an invalid subscription, honors broker throttle windows, bounds payload allocation, and sends one terminating push when the shutdown channel is set.

Implementations§

Source§

impl<P> TelemetryClient<P>

Source

pub async fn connect( client_config: ClientConfig, provider: P, config: TelemetryConfig, ) -> Result<Self>

Connects to Kafka and creates a telemetry runtime.

Source

pub fn from_client(client: Client, provider: P, config: TelemetryConfig) -> Self

Wraps an already connected low-level client.

Source

pub fn subscription(&self) -> Option<&TelemetrySubscription>

Returns the last broker subscription, if one has been acquired.

Source

pub async fn refresh_subscription(&mut self) -> Result<&TelemetrySubscription>

Fetches a new broker subscription and replaces local subscription state.

Source

pub async fn push_once(&mut self) -> Result<Option<TelemetryPushSummary>>

Collects and pushes one non-terminating telemetry payload.

An empty broker metric subscription returns Ok(None) and does not send a payload. An outdated subscription or compression selection causes one refresh and retry on the same connection.

Source

pub async fn terminate(&mut self) -> Result<Option<TelemetryPushSummary>>

Sends one terminating payload, if a subscription has been acquired.

Source

pub async fn run_until_shutdown(self, shutdown: Receiver<bool>) -> Result<()>

Runs the telemetry loop until shutdown becomes true or is dropped.

The first push is immediate. Subsequent pushes use the broker interval with optional jitter in the range recommended by KIP-714. Shutdown sends a terminating push before returning.

Auto Trait Implementations§

§

impl<P> !RefUnwindSafe for TelemetryClient<P>

§

impl<P> !UnwindSafe for TelemetryClient<P>

§

impl<P> Freeze for TelemetryClient<P>
where P: Freeze,

§

impl<P> Send for TelemetryClient<P>
where P: Send,

§

impl<P> Sync for TelemetryClient<P>
where P: Sync,

§

impl<P> Unpin for TelemetryClient<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for TelemetryClient<P>
where P: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more