-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetrics.go
More file actions
40 lines (29 loc) · 1.45 KB
/
Copy pathmetrics.go
File metadata and controls
40 lines (29 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package zswap
import (
"github.com/KonishchevDmitry/server-metrics/internal/metrics"
)
var metricBuilder = metrics.MakeDescBuilder("kernel_zswap")
var enabledMetric = metricBuilder.Build(
"enabled", "Current zswap status.", []string{"zpool", "compressor"})
var maxPoolPercentMetric = metricBuilder.Build(
"max_pool_percent", "The maximum percentage of memory that the compressed pool can occupy", nil)
var poolSizeMetric = metricBuilder.Build(
"pool_size", "Current pool size", nil)
var storedSizeMetric = metricBuilder.Build(
"stored_size", "Amount of data stored in the pool", nil)
var compressionRatioMetric = metricBuilder.Build(
"compression_ratio", "Current compression ratio", nil)
var rejectsMetric = metricBuilder.Build(
"rejects_total", "The reason why page hasn't been saved to cache and was saved to swap (doesn't cover all cases such as accept_threshold_percent and shrinker_enabled).",
[]string{"type"})
const (
poolLimitReachedReject = "pool-limit-reached" // Pool limit has been reached
allocationFailureReject = "allocation-failure" // Unable to allocate memory for the cache entry
poorCompressionReject = "poor-compression" // Compressed page was to big to use it in cache
)
var errorsMetric = metricBuilder.Build(
"errors_total", "Unexpected errors.", []string{"type"})
const (
reclaimError = "reclaim" // Failed to reclaim (move to swap) a compressed page
compressionError = "compression" // Compression algorithm error
)