MCPcopy Create free account
hub / github.com/actix/examples / init

Function init

tracing/mainmatter-workshop/src/prometheus.rs:8–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6use crate::metric_names::*;
7
8pub(crate) fn init() -> PrometheusHandle {
9 metrics::describe_histogram!(
10 HISTOGRAM_HTTP_REQUEST_DURATION,
11 Unit::Seconds,
12 "Duration (in seconds) a request took to be processed"
13 );
14
15 PrometheusBuilder::new()
16 .set_buckets_for_metric(
17 metrics_exporter_prometheus::Matcher::Full(HISTOGRAM_HTTP_REQUEST_DURATION.to_owned()),
18 &exp_buckets::<28>(0.001), // values from ~0.3ms -> ~33s
19 )
20 .unwrap()
21 .install_recorder()
22 .unwrap()
23}
24
25fn exp_buckets<const N: usize>(base: f64) -> [f64; N] {
26 const RATIO: f64 = 1.5;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected