MCPcopy
hub / github.com/kopia/kopia / initMetricsStruct

Function initMetricsStruct

internal/cache/cache_metrics.go:15–49  ·  view source on GitHub ↗
(mr *metrics.Registry, cacheID string)

Source from the content-addressed store, hash-verified

13}
14
15func initMetricsStruct(mr *metrics.Registry, cacheID string) metricsStruct {
16 labels := map[string]string{
17 "cache": cacheID,
18 }
19
20 return metricsStruct{
21 metricHitCount: mr.CounterInt64(
22 "cache_hit",
23 "Number of time content was retrieved from the cache", labels),
24
25 metricHitBytes: mr.CounterInt64(
26 "cache_hit_bytes",
27 "Number of bytes retrieved from the cache", labels),
28
29 metricMissCount: mr.CounterInt64(
30 "cache_miss",
31 "Number of time content was not found in the cache and fetched from the storage", labels),
32
33 metricMalformedCacheDataCount: mr.CounterInt64(
34 "cache_malformed",
35 "Number of times malformed content was read from the cache", labels),
36
37 metricMissBytes: mr.CounterInt64(
38 "cache_miss_bytes",
39 "Number of bytes retrieved from the underlying storage", labels),
40
41 metricMissErrors: mr.CounterInt64(
42 "cache_miss_errors",
43 "Number of time content could not be found in the underlying storage", labels),
44
45 metricStoreErrors: mr.CounterInt64(
46 "cache_store_errors",
47 "Number of time content could not be saved in the cache", labels),
48 }
49}
50
51func (s *metricsStruct) reportMissError() {
52 s.metricMissErrors.Add(1)

Callers 1

NewPersistentCacheFunction · 0.70

Calls 1

CounterInt64Method · 0.80

Tested by

no test coverage detected