1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
8 "github.com/prometheus/client_golang/prometheus"
11 type volumeMetricsVecs struct {
12 ioBytes *prometheus.CounterVec
13 errCounters *prometheus.CounterVec
14 opsCounters *prometheus.CounterVec
17 func newVolumeMetricsVecs(reg *prometheus.Registry) *volumeMetricsVecs {
18 m := &volumeMetricsVecs{}
19 m.opsCounters = prometheus.NewCounterVec(
20 prometheus.CounterOpts{
22 Subsystem: "keepstore",
23 Name: "volume_operations",
24 Help: "Number of volume operations",
26 []string{"device_id", "operation"},
28 reg.MustRegister(m.opsCounters)
29 m.errCounters = prometheus.NewCounterVec(
30 prometheus.CounterOpts{
32 Subsystem: "keepstore",
33 Name: "volume_errors",
34 Help: "Number of volume errors",
36 []string{"device_id", "error_type"},
38 reg.MustRegister(m.errCounters)
39 m.ioBytes = prometheus.NewCounterVec(
40 prometheus.CounterOpts{
42 Subsystem: "keepstore",
43 Name: "volume_io_bytes",
44 Help: "Volume I/O traffic in bytes",
46 []string{"device_id", "direction"},
48 reg.MustRegister(m.ioBytes)
53 func (vm *volumeMetricsVecs) getCounterVecsFor(lbls prometheus.Labels) (opsCV, errCV, ioCV *prometheus.CounterVec) {
54 opsCV = vm.opsCounters.MustCurryWith(lbls)
55 errCV = vm.errCounters.MustCurryWith(lbls)
56 ioCV = vm.ioBytes.MustCurryWith(lbls)