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§
Sourcefn bind_address(&self) -> Option<SocketAddr>
fn bind_address(&self) -> Option<SocketAddr>
Return the bind address for the http server.
Sourcefn http_server_name(&self) -> &str
fn http_server_name(&self) -> &str
Return the http server name.
Sourcefn health_check(&self) -> impl Future<Output = Result<(), Error>> + Send
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.
Sourcefn prometheus_metrics_registry(&self) -> Option<&Registry>
Available on crate feature prometheus
only.
fn prometheus_metrics_registry(&self) -> Option<&Registry>
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.
Sourcefn opentelemetry(&self) -> Option<&OpenTelemetry>
Available on crate feature opentelemetry
only.
fn opentelemetry(&self) -> Option<&OpenTelemetry>
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.