pub struct MetricsProviderBuilder { /* private fields */ }Expand description
Builder with independent pull and push capabilities. No global SDK provider is installed.
Implementations§
Source§impl MetricsProviderBuilder
impl MetricsProviderBuilder
pub fn with_limits(self, limits: MetricsLimits) -> Self
Sourcepub fn with_resource(self, resource: MetricsResource) -> MetricResult<Self>
pub fn with_resource(self, resource: MetricsResource) -> MetricResult<Self>
Explicit resource attributes only; SDK environment resource detectors are excluded.
§Errors
Returns a redacted error for an empty service name or oversized/control-character attributes.
Sourcepub fn with_prometheus(self) -> MetricResult<Self>
pub fn with_prometheus(self) -> MetricResult<Self>
§Errors
Returns an error if pull export is already configured or its reader cannot be created.
Sourcepub fn with_reader<R: MetricReader>(self, reader: R) -> Self
pub fn with_reader<R: MetricReader>(self, reader: R) -> Self
Reader injection also permits deterministic tests and custom exporters.
Sourcepub fn build(self) -> MetricResult<MetricsProvider>
pub fn build(self) -> MetricResult<MetricsProvider>
§Errors
Returns an error if the resource limits are invalid.
Source§impl MetricsProviderBuilder
impl MetricsProviderBuilder
Sourcepub fn with_otlp(
self,
config: OtlpMetricsConfig,
) -> MetricResult<(Self, OtlpExportDiagnostics)>
pub fn with_otlp( self, config: OtlpMetricsConfig, ) -> MetricResult<(Self, OtlpExportDiagnostics)>
The standard SDK owns cumulative aggregation and its one periodic worker. One observation feeds both readers; requests never run in product call paths.
§Errors
Returns a redacted error if configuration is invalid or the HTTP client cannot be created.
Auto Trait Implementations§
impl Freeze for MetricsProviderBuilder
impl !RefUnwindSafe for MetricsProviderBuilder
impl Send for MetricsProviderBuilder
impl Sync for MetricsProviderBuilder
impl Unpin for MetricsProviderBuilder
impl UnsafeUnpin for MetricsProviderBuilder
impl !UnwindSafe for MetricsProviderBuilder
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