forked from restic/rest-server
-
Notifications
You must be signed in to change notification settings - Fork 2
/
metrics.go
63 lines (54 loc) · 1.65 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
60
61
62
63
package restserver
import "github.com/prometheus/client_golang/prometheus"
var metricLabelList = []string{"user", "repo", "type"}
var metricBlobWriteTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "rest_server_blob_write_total",
Help: "Total number of blobs written",
},
metricLabelList,
)
var metricBlobWriteBytesTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "rest_server_blob_write_bytes_total",
Help: "Total number of bytes written to blobs",
},
metricLabelList,
)
var metricBlobReadTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "rest_server_blob_read_total",
Help: "Total number of blobs read",
},
metricLabelList,
)
var metricBlobReadBytesTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "rest_server_blob_read_bytes_total",
Help: "Total number of bytes read from blobs",
},
metricLabelList,
)
var metricBlobDeleteTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "rest_server_blob_delete_total",
Help: "Total number of blobs deleted",
},
metricLabelList,
)
var metricBlobDeleteBytesTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "rest_server_blob_delete_bytes_total",
Help: "Total number of bytes of blobs deleted",
},
metricLabelList,
)
func init() {
// These are always initialized, but only updated if Config.Prometheus is set
prometheus.MustRegister(metricBlobWriteTotal)
prometheus.MustRegister(metricBlobWriteBytesTotal)
prometheus.MustRegister(metricBlobReadTotal)
prometheus.MustRegister(metricBlobReadBytesTotal)
prometheus.MustRegister(metricBlobDeleteTotal)
prometheus.MustRegister(metricBlobDeleteBytesTotal)
}