pub struct StatsExporter { /* private fields */ }Expand description
An exporter that concentrates and sends stats to the agent
Implementations§
Source§impl StatsExporter
impl StatsExporter
Sourcepub fn new(
flush_interval: Duration,
concentrator: Arc<Mutex<SpanConcentrator>>,
meta: TracerMetadata,
endpoint: Endpoint,
cancellation_token: CancellationToken,
client: HttpClient,
) -> Self
pub fn new( flush_interval: Duration, concentrator: Arc<Mutex<SpanConcentrator>>, meta: TracerMetadata, endpoint: Endpoint, cancellation_token: CancellationToken, client: HttpClient, ) -> Self
Return a new StatsExporter
flush_intervalthe interval on which the concentrator is flushedconcentratorSpanConcentrator storing the stats to be sent to the agentmetametadata used in ClientStatsPayload and as headers to send stats to the agentendpointthe Endpoint used to send stats to the agentcancellation_tokenToken used to safely shutdown the exporter by force flushing the concentrator
Sourcepub async fn send(&self, force_flush: bool) -> Result<()>
pub async fn send(&self, force_flush: bool) -> Result<()>
Flush the stats stored in the concentrator and send them
If the stats flushed from the concentrator contain at least one time bucket the stats are
sent to self.endpoint. The stats are serialized as msgpack.
§Errors
The function will return an error in the following case:
- The endpoint failed to build
- The stats payload cannot be serialized as a valid http body
- The http client failed while sending the request
- The http status of the response is not 2xx
§Panic
Will panic if another thread panicked while holding the concentrator lock in which case stats cannot be flushed since the concentrator might be corrupted.
Trait Implementations§
Source§impl Debug for StatsExporter
impl Debug for StatsExporter
Auto Trait Implementations§
impl !Freeze for StatsExporter
impl !RefUnwindSafe for StatsExporter
impl Send for StatsExporter
impl Sync for StatsExporter
impl Unpin for StatsExporter
impl UnsafeUnpin for StatsExporter
impl !UnwindSafe for StatsExporter
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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