pub struct MetricsProvider { /* private fields */ }Expand description
Clones share one instance; instruments always remain bound to their original instance.
Implementations§
Source§impl MetricsProvider
impl MetricsProvider
pub fn builder() -> MetricsProviderBuilder
pub fn enabled(&self) -> bool
Sourcepub fn otlp_diagnostics(&self) -> Option<OtlpExportDiagnostics>
pub fn otlp_diagnostics(&self) -> Option<OtlpExportDiagnostics>
Returns local push-export diagnostics without invoking the exporter.
Sourcepub fn register_batch(
&self,
descriptors: &[MetricDescriptor],
) -> MetricResult<Vec<MetricHandle>>
pub fn register_batch( &self, descriptors: &[MetricDescriptor], ) -> MetricResult<Vec<MetricHandle>>
Validate the complete batch and reserve every derived exposition name before constructing SDK instruments. Failure leaves this instance unchanged.
§Errors
Returns an error for a closed instance, invalid descriptors, duplicate names or instrument limits. The catalog is unchanged on failure.
pub fn descriptors(&self) -> Vec<MetricDescriptor>
Sourcepub async fn export_prometheus(&self, timeout: Duration) -> MetricResult<String>
pub async fn export_prometheus(&self, timeout: Duration) -> MetricResult<String>
Prometheus export is blocking work with retained concurrency permits. A timed-out caller cannot start unlimited gathers that are still running.
§Errors
Returns an error for unavailable or closed providers, concurrent overload, timeout, encoding failure or oversized output.
Sourcepub async fn shutdown(&self, timeout: Duration) -> MetricResult<()>
pub async fn shutdown(&self, timeout: Duration) -> MetricResult<()>
Idempotent shutdown. If the caller times out, the job retains its permit;
callers can poll the actual result with shutdown_result.
§Errors
Returns an error on concurrent lifecycle operations, timeout or SDK shutdown failure.
pub fn shutdown_result(&self) -> Option<MetricResult<()>>
Sourcepub async fn force_flush(&self, timeout: Duration) -> MetricResult<()>
pub async fn force_flush(&self, timeout: Duration) -> MetricResult<()>
§Errors
Returns an error for closed providers, concurrent lifecycle operations, timeout or SDK export failure.
Trait Implementations§
Source§impl Clone for MetricsProvider
impl Clone for MetricsProvider
Source§fn clone(&self) -> MetricsProvider
fn clone(&self) -> MetricsProvider
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more