Trait TelemetryConfig

Source
pub trait TelemetryConfig: Global {
    // Provided methods
    fn enabled(&self) -> bool { ... }
    fn bind_address(&self) -> Option<SocketAddr> { ... }
    fn http_server_name(&self) -> &str { ... }
    fn health_check(&self) -> impl Future<Output = Result<(), Error>> + Send { ... }
    fn prometheus_metrics_registry(&self) -> Option<&Registry> { ... }
    fn opentelemetry(&self) -> Option<&OpenTelemetry> { ... }
}
Expand description

Implement this trait to configure the telemetry service.

Provided Methods§

Source

fn enabled(&self) -> bool

Return true if the service is enabled.

Source

fn bind_address(&self) -> Option<SocketAddr>

Return the bind address for the http server.

Source

fn http_server_name(&self) -> &str

Return the http server name.

Source

fn health_check(&self) -> impl Future<Output = Result<(), Error>> + Send

Return a health check to determine if the service is healthy.

Always healthy by default.

Source

fn prometheus_metrics_registry(&self) -> Option<&Registry>

Available on crate feature prometheus only.

Return a Prometheus metrics registry to scrape metrics from.

Returning Some will enable the /metrics http endpoint which can be used by Prometheus to scrape metrics.

Disabled (None) by default.

Source

fn opentelemetry(&self) -> Option<&OpenTelemetry>

Available on crate feature opentelemetry only.

Pass an OpenTelemetry instance to the service.

If provided the service will flush and shutdown the OpenTelemetry instance when it shuts down. Additionally, the service provides the /opentelemetry/flush http endpoint to manually flush the data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§