-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics.go
34 lines (29 loc) · 1.02 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
package metrics
import (
p "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
totals = promauto.NewCounterVec(
p.CounterOpts{
Name: "totals",
Namespace: "ark",
Help: "The total number of files affected by a given operation",
},
[]string{"duplicate"},
)
TotalDuplicates = totals.With(p.Labels{"duplicate": "true"})
TotalImported = totals.With(p.Labels{"duplicate": "false"})
duration = promauto.NewSummaryVec(
p.SummaryOpts{
Name: "duration_ms",
Namespace: "ark",
Help: "The duration of a given operation, in milliseconds",
Objectives: map[float64]float64{0.5: 0.05, 0.95: 0.01, 0.99: 0.001},
},
[]string{"operation"})
CopyFileDurationMs = duration.With(p.Labels{"operation": "copy_file"})
GetDurationMs = duration.With(p.Labels{"operation": "get"})
StoreDurationMs = duration.With(p.Labels{"operation": "store"})
UploadFileDurationMs = duration.With(p.Labels{"operation": "upload_file"})
)