pub struct TelemetryWorkerHandle<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> { /* private fields */ }Expand description
TelemetryWorkerHandle is a handle which allows interactions with the telemetry worker. The handle is safe to use across threads.
The worker won’t send data to the agent until you call TelemetryWorkerHandle::send_start
To stop the worker, call TelemetryWorkerHandle::send_stop which trigger flush asynchronously
then TelemetryWorkerHandle::wait_for_shutdown (native only — wasm callers rely on the
SharedRuntime worker JoinHandle instead).
Implementations§
Source§impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> TelemetryWorkerHandle<C>
impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> TelemetryWorkerHandle<C>
pub fn register_metric_context( &self, name: String, tags: Vec<Tag>, metric_type: MetricType, common: bool, namespace: MetricNamespace, ) -> ContextKey
pub fn try_send_msg(&self, msg: TelemetryActions) -> Result<()>
pub async fn send_msg(&self, msg: TelemetryActions) -> Result<()>
pub async fn send_msgs<T>(&self, msgs: T) -> Result<()>where
T: IntoIterator<Item = TelemetryActions>,
pub async fn send_msg_timeout( &self, msg: TelemetryActions, timeout: Duration, ) -> Result<()>
pub fn send_start(&self) -> Result<()>
pub fn send_stop(&self) -> Result<()>
Sourcepub fn cancel_requests_with_deadline(&self, deadline: Instant)
pub fn cancel_requests_with_deadline(&self, deadline: Instant)
Schedule a deferred CancellationToken::cancel() to fire after deadline.
Sourcepub fn wait_for_shutdown_deadline(&self, deadline: Instant)
pub fn wait_for_shutdown_deadline(&self, deadline: Instant)
Sync wrapper: schedule a cancellation deadline and block the current thread until shutdown finishes.
pub fn add_dependency( &self, name: String, version: Option<String>, metadata: Option<Vec<DependencyMetadata>>, ) -> Result<()>
pub fn add_product_change( &self, product: String, enabled: bool, version: Option<String>, ) -> Result<()>
pub fn add_integration( &self, name: String, enabled: bool, version: Option<String>, compatible: Option<bool>, auto_enabled: Option<bool>, error: Option<String>, ) -> Result<()>
pub fn add_log<T: Hash>( &self, identifier: T, message: String, level: LogLevel, stack_trace: Option<String>, ) -> Result<()>
pub fn add_point( &self, value: f64, context: &ContextKey, extra_tags: Vec<Tag>, ) -> Result<()>
pub fn wait_for_shutdown(&self)
pub fn stats(&self) -> Result<Receiver<TelemetryWorkerStats>>
Trait Implementations§
Source§impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> Clone for TelemetryWorkerHandle<C>
impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> Clone for TelemetryWorkerHandle<C>
Source§impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> Debug for TelemetryWorkerHandle<C>
impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> Debug for TelemetryWorkerHandle<C>
Auto Trait Implementations§
impl<C> !RefUnwindSafe for TelemetryWorkerHandle<C>
impl<C> !UnwindSafe for TelemetryWorkerHandle<C>
impl<C> Freeze for TelemetryWorkerHandle<C>
impl<C> Send for TelemetryWorkerHandle<C>
impl<C> Sync for TelemetryWorkerHandle<C>
impl<C> Unpin for TelemetryWorkerHandle<C>
impl<C> UnsafeUnpin for TelemetryWorkerHandle<C>
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