pub struct Metrics {
pub registry: Registry,
/* private fields */
}Fields§
§registry: RegistryImplementations§
Source§impl Metrics
impl Metrics
pub fn new() -> Self
Sourcepub fn record_request(&self, kind: &str, result: &str, repo: &str)
pub fn record_request(&self, kind: &str, result: &str, repo: &str)
Record the outcome of a client request. repo is the served repo path on
success and - on any failure, so unbounded client-supplied paths cannot
inflate label cardinality. kind is info_refs, upload_pack, auth or
receive_pack; result is ok, error, upstream_error,
unauthorized or rejected.
Sourcepub fn record_upstream(&self, op: &str, result: &str, repo: &str)
pub fn record_upstream(&self, op: &str, result: &str, repo: &str)
Record an upstream clone/fetch. Errors are recorded too (result = "error"); pass the repo path on success and - on error, matching
record_request.
Sourcepub fn set_cache_size(&self, bytes: u64, mirrors: usize)
pub fn set_cache_size(&self, bytes: u64, mirrors: usize)
Refresh the cache-size gauges from the eviction index.
Sourcepub fn record_eviction(&self)
pub fn record_eviction(&self)
Record one evicted mirror.
Sourcepub fn observe_upstream(&self, op: &str, repo: &str, seconds: f64)
pub fn observe_upstream(&self, op: &str, repo: &str, seconds: f64)
Observe an upstream op’s duration. Call only on success with the real repo,
matching the counters’ bounded-repo cardinality discipline.
Sourcepub fn observe_serve(&self, kind: &str, repo: &str, seconds: f64)
pub fn observe_serve(&self, kind: &str, repo: &str, seconds: f64)
Observe a client serve duration (kind = info_refs | upload_pack),
same cardinality discipline as observe_upstream.