pub struct Observability { /* private fields */ }Expand description
Production observability configuration and in-process metrics state.
Implementations§
Source§impl Observability
impl Observability
Sourcepub fn production(service_name: impl Into<String>) -> Self
pub fn production(service_name: impl Into<String>) -> Self
Creates production observability metadata for a service.
Sourcepub fn version(self, version: impl Into<String>) -> Self
pub fn version(self, version: impl Into<String>) -> Self
Sets the service version label used by tracing and OpenTelemetry config.
Sourcepub fn environment(self, environment: impl Into<String>) -> Self
pub fn environment(self, environment: impl Into<String>) -> Self
Sets the deployment environment label.
Sourcepub fn prometheus(self) -> Self
pub fn prometheus(self) -> Self
Enables Prometheus text exposition for configured metrics.
Sourcepub fn tracing(self) -> Self
pub fn tracing(self) -> Self
Enables HTTP tracing when this observability object is applied by Nidus.
Sourcepub fn otel_from_env(self) -> Self
pub fn otel_from_env(self) -> Self
No-op OpenTelemetry setup when the otel feature is disabled.
Sourcepub fn without_http_metrics(self) -> Self
pub fn without_http_metrics(self) -> Self
Disables HTTP request metrics.
Sourcepub fn without_event_metrics(self) -> Self
pub fn without_event_metrics(self) -> Self
Disables observed event metrics.
Sourcepub fn without_job_metrics(self) -> Self
pub fn without_job_metrics(self) -> Self
Disables observed job metrics.
Sourcepub fn without_adapter_instrumentation(self) -> Self
pub fn without_adapter_instrumentation(self) -> Self
Disables adapter-owned operation instrumentation.
Sourcepub fn max_series(self, max_series: usize) -> Self
pub fn max_series(self, max_series: usize) -> Self
Caps distinct low-cardinality labels per metric family.
Sourcepub fn exclude_route(self, route: impl Into<String>) -> Self
pub fn exclude_route(self, route: impl Into<String>) -> Self
Excludes an HTTP route label from HTTP metrics.
Sourcepub fn service_name(&self) -> &str
pub fn service_name(&self) -> &str
Returns the service name.
Sourcepub fn version_label(&self) -> Option<&str>
pub fn version_label(&self) -> Option<&str>
Returns the configured service version label.
Sourcepub fn environment_label(&self) -> Option<&str>
pub fn environment_label(&self) -> Option<&str>
Returns the configured deployment environment label.
Sourcepub fn http_metrics_enabled(&self) -> bool
pub fn http_metrics_enabled(&self) -> bool
Returns whether HTTP metrics are enabled.
Sourcepub fn prometheus_enabled(&self) -> bool
pub fn prometheus_enabled(&self) -> bool
Returns whether Prometheus exposition is enabled.
Sourcepub fn tracing_enabled(&self) -> bool
pub fn tracing_enabled(&self) -> bool
Returns whether HTTP tracing should be applied by Nidus.
Sourcepub fn prometheus_metrics(&self) -> PrometheusMetrics
pub fn prometheus_metrics(&self) -> PrometheusMetrics
Returns the underlying HTTP Prometheus collector.
Sourcepub fn http_layer(&self) -> MetricsLayer<ObservabilityHttpMetricsHook>
pub fn http_layer(&self) -> MetricsLayer<ObservabilityHttpMetricsHook>
Creates a Tower HTTP metrics layer.
Sourcepub fn event_observer(&self) -> ObservabilityEventObserver
pub fn event_observer(&self) -> ObservabilityEventObserver
Creates an event observer for nidus_events::ObservedEventBus.
Sourcepub fn observed_event_bus<T>(
&self,
) -> ObservedEventBus<T, ObservabilityEventObserver>
pub fn observed_event_bus<T>( &self, ) -> ObservedEventBus<T, ObservabilityEventObserver>
Creates an observed in-process event bus wired to this observability object.
Sourcepub fn job_observer(&self) -> ObservabilityJobObserver
pub fn job_observer(&self) -> ObservabilityJobObserver
Creates a job observer for nidus_jobs::ObservedJobRunner.
Sourcepub fn job_runner(&self) -> ObservedJobRunner<ObservabilityJobObserver>
pub fn job_runner(&self) -> ObservedJobRunner<ObservabilityJobObserver>
Creates an observed job runner wired to this observability object.
Sourcepub fn adapter_observer(&self) -> ObservabilityAdapterObserver
pub fn adapter_observer(&self) -> ObservabilityAdapterObserver
Creates an adapter observer for Nidus-owned adapter operations.
Sourcepub async fn instrument<Fut, T>(
&self,
operation: impl Into<Cow<'static, str>>,
future: Fut,
) -> Twhere
Fut: Future<Output = T>,
pub async fn instrument<Fut, T>(
&self,
operation: impl Into<Cow<'static, str>>,
future: Fut,
) -> Twhere
Fut: Future<Output = T>,
Runs a future inside a named tracing span.
Sourcepub fn record_module_graph_validation(
&self,
status: OperationStatus,
duration: Duration,
)
pub fn record_module_graph_validation( &self, status: OperationStatus, duration: Duration, )
Records module graph validation owned by Nidus application bootstrap.
Sourcepub fn record_lifecycle_operation(
&self,
operation: &'static str,
status: OperationStatus,
duration: Duration,
)
pub fn record_lifecycle_operation( &self, operation: &'static str, status: OperationStatus, duration: Duration, )
Records application lifecycle operation telemetry.
Sourcepub fn render_prometheus(&self) -> String
pub fn render_prometheus(&self) -> String
Renders all configured Prometheus metrics.
Trait Implementations§
Source§impl Clone for Observability
impl Clone for Observability
Source§fn clone(&self) -> Observability
fn clone(&self) -> Observability
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more