pub struct MetricsClient { /* private fields */ }Expand description
Singleton client for managing OpenTelemetry metrics instruments.
The actual metrics export destination (console, OTLP endpoint, etc.) is configured through OpenTelemetry SDK configuration by users, not by this client.
Implementations§
Source§impl MetricsClient
impl MetricsClient
Sourcepub fn global() -> &'static MetricsClient
pub fn global() -> &'static MetricsClient
Get the singleton MetricsClient instance.
Uses the global OpenTelemetry meter provider. Users should configure the meter provider before calling this method.
Sourcepub fn record_cycle_count(
&self,
count: u64,
attributes: &HashMap<String, String>,
)
pub fn record_cycle_count( &self, count: u64, attributes: &HashMap<String, String>, )
Record event loop cycle count.
Sourcepub fn record_start_cycle(&self, attributes: &HashMap<String, String>)
pub fn record_start_cycle(&self, attributes: &HashMap<String, String>)
Record event loop start cycle.
Sourcepub fn record_end_cycle(&self, attributes: &HashMap<String, String>)
pub fn record_end_cycle(&self, attributes: &HashMap<String, String>)
Record event loop end cycle.
Sourcepub fn record_cycle_duration(
&self,
duration_secs: f64,
attributes: &HashMap<String, String>,
)
pub fn record_cycle_duration( &self, duration_secs: f64, attributes: &HashMap<String, String>, )
Record cycle duration.
Sourcepub fn record_latency(
&self,
latency_ms: u64,
attributes: &HashMap<String, String>,
)
pub fn record_latency( &self, latency_ms: u64, attributes: &HashMap<String, String>, )
Record latency.
Sourcepub fn record_input_tokens(
&self,
tokens: u32,
attributes: &HashMap<String, String>,
)
pub fn record_input_tokens( &self, tokens: u32, attributes: &HashMap<String, String>, )
Record input tokens.
Sourcepub fn record_output_tokens(
&self,
tokens: u32,
attributes: &HashMap<String, String>,
)
pub fn record_output_tokens( &self, tokens: u32, attributes: &HashMap<String, String>, )
Record output tokens.
Sourcepub fn record_cache_read_input_tokens(
&self,
tokens: u32,
attributes: &HashMap<String, String>,
)
pub fn record_cache_read_input_tokens( &self, tokens: u32, attributes: &HashMap<String, String>, )
Record cache read input tokens.
Sourcepub fn record_cache_write_input_tokens(
&self,
tokens: u32,
attributes: &HashMap<String, String>,
)
pub fn record_cache_write_input_tokens( &self, tokens: u32, attributes: &HashMap<String, String>, )
Record cache write input tokens.
Sourcepub fn record_time_to_first_token(
&self,
time_ms: u64,
attributes: &HashMap<String, String>,
)
pub fn record_time_to_first_token( &self, time_ms: u64, attributes: &HashMap<String, String>, )
Record model time to first token.
Sourcepub fn record_tool_call_count(
&self,
count: u64,
attributes: &HashMap<String, String>,
)
pub fn record_tool_call_count( &self, count: u64, attributes: &HashMap<String, String>, )
Record tool call count.
Sourcepub fn record_tool_success_count(
&self,
count: u64,
attributes: &HashMap<String, String>,
)
pub fn record_tool_success_count( &self, count: u64, attributes: &HashMap<String, String>, )
Record tool success count.
Sourcepub fn record_tool_error_count(
&self,
count: u64,
attributes: &HashMap<String, String>,
)
pub fn record_tool_error_count( &self, count: u64, attributes: &HashMap<String, String>, )
Record tool error count.
Auto Trait Implementations§
impl Freeze for MetricsClient
impl !RefUnwindSafe for MetricsClient
impl Send for MetricsClient
impl Sync for MetricsClient
impl Unpin for MetricsClient
impl !UnwindSafe for MetricsClient
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreCreates a shared type from an unshared type.