-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics.go
59 lines (53 loc) · 1.69 KB
/
metrics.go
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2021 The Swarm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package batchstore
import (
m "github.com/newswarm-lab/new-bee/pkg/metrics"
"github.com/prometheus/client_golang/prometheus"
)
type metrics struct {
AvailableCapacity prometheus.Gauge
Inner prometheus.Gauge
Outer prometheus.Gauge
Radius prometheus.Gauge
StorageRadius prometheus.Gauge
}
func newMetrics() metrics {
subsystem := "batchstore"
return metrics{
AvailableCapacity: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "available_capacity",
Help: "Available capacity observed by the batchstore.",
}),
Inner: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "inner",
Help: "Inner storage tier value observed by the batchstore.",
}),
Outer: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "outer",
Help: "Outer storage tier value observed by the batchstore.",
}),
Radius: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "radius",
Help: "Radius of responsibility observed by the batchstore.",
}),
StorageRadius: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "storage_radius",
Help: "Radius of responsibility communicated to the localstore",
}),
}
}
func (s *store) Metrics() []prometheus.Collector {
return m.PrometheusCollectorsFromFields(s.metrics)
}