pub struct TelemetrySvc;
Expand description
The telemetry service.
This is supposed to be used with the scuffle-bootstrap
crate.
§HTTP Server
This service provides an http server which will bind to the address provided
by the config. (See TelemetryConfig
)
§Endpoints
The server provides the following endpoints:
§/health
Health check endpoint.
This endpoint calls the health check function provided by the config and
responds with 200 OK
if the health check returns Ok(())
. If the health
check returns an error, the endpoint returns 500 Internal Server Error
along with the error message.
§/metrics
Metrics endpoint which can be used by Prometheus to scrape metrics.
This endpoint is only enabled if the prometheus
feature flag is enabled
and a metrics registry is provided through the config.
§/pprof/cpu
(Unix only)
pprof cpu endpoint to capture a cpu profile.
§Query Parameters
freq
: Sampling frequency in Hz.duration
: Duration the profile should be captured for in s.ignore
: List of functions to exclude from the profile.
This endpoint is only enabled if the pprof
feature flag is enabled.
§/opentelemetry/flush
OpenTelemetry flush endpoint.
This endpoint is only enabled if one of the opentelemetry
feature flags is
enabled and an OpenTelemetry config is provided through the config.
Trait Implementations§
Source§impl<Global: TelemetryConfig> Service<Global> for TelemetrySvc
impl<Global: TelemetryConfig> Service<Global> for TelemetrySvc
Source§async fn enabled(&self, global: &Arc<Global>) -> Result<bool>
async fn enabled(&self, global: &Arc<Global>) -> Result<bool>
Ok(true)
if the service should be
run.Source§async fn run(self, global: Arc<Global>, ctx: Context) -> Result<()>
async fn run(self, global: Arc<Global>, ctx: Context) -> Result<()>
Ok(())
. As a best practice, the
service should stop as soon as the provided context is done. Read more