@@ -18,19 +18,19 @@ func initRegistry() *Registry {
18
18
19
19
registry := & Registry {
20
20
reg : prometheus .NewRegistry (),
21
- backupBytesProcessed : prometheus .NewSummaryVec (prometheus.SummaryOpts {
21
+ backupBytesProcessed : prometheus .NewGaugeVec (prometheus.GaugeOpts {
22
22
Name : "backrest_backup_bytes_processed" ,
23
23
Help : "The total number of bytes processed during a backup" ,
24
24
}, commonDims ),
25
- backupBytesAdded : prometheus .NewSummaryVec (prometheus.SummaryOpts {
25
+ backupBytesAdded : prometheus .NewGaugeVec (prometheus.GaugeOpts {
26
26
Name : "backrest_backup_bytes_added" ,
27
27
Help : "The total number of bytes added during a backup" ,
28
28
}, commonDims ),
29
- backupFileWarnings : prometheus .NewSummaryVec (prometheus.SummaryOpts {
29
+ backupFileWarnings : prometheus .NewGaugeVec (prometheus.GaugeOpts {
30
30
Name : "backrest_backup_file_warnings" ,
31
31
Help : "The total number of file warnings during a backup" ,
32
32
}, commonDims ),
33
- tasksDuration : prometheus .NewSummaryVec (prometheus.SummaryOpts {
33
+ tasksDuration : prometheus .NewGaugeVec (prometheus.GaugeOpts {
34
34
Name : "backrest_tasks_duration_secs" ,
35
35
Help : "The duration of a task in seconds" ,
36
36
}, append (slices .Clone (commonDims ), "task_type" )),
@@ -55,10 +55,10 @@ func GetRegistry() *Registry {
55
55
56
56
type Registry struct {
57
57
reg * prometheus.Registry
58
- backupBytesProcessed * prometheus.SummaryVec
59
- backupBytesAdded * prometheus.SummaryVec
60
- backupFileWarnings * prometheus.SummaryVec
61
- tasksDuration * prometheus.SummaryVec
58
+ backupBytesProcessed * prometheus.GaugeVec
59
+ backupBytesAdded * prometheus.GaugeVec
60
+ backupFileWarnings * prometheus.GaugeVec
61
+ tasksDuration * prometheus.GaugeVec
62
62
tasksRun * prometheus.CounterVec
63
63
}
64
64
@@ -73,12 +73,13 @@ func (r *Registry) RecordTaskRun(repoID, planID, taskType string, duration_secs
73
73
if planID == "" {
74
74
planID = "_unassociated_"
75
75
}
76
+ r .tasksRun .DeletePartialMatch (prometheus.Labels {"repo_id" : repoID , "plan_id" : planID , "task_type" : taskType })
76
77
r .tasksRun .WithLabelValues (repoID , planID , taskType , status ).Inc ()
77
- r .tasksDuration .WithLabelValues (repoID , planID , taskType ).Observe (duration_secs )
78
+ r .tasksDuration .WithLabelValues (repoID , planID , taskType ).Set (duration_secs )
78
79
}
79
80
80
81
func (r * Registry ) RecordBackupSummary (repoID , planID string , bytesProcessed , bytesAdded int64 , fileWarnings int64 ) {
81
- r .backupBytesProcessed .WithLabelValues (repoID , planID ).Observe (float64 (bytesProcessed ))
82
- r .backupBytesAdded .WithLabelValues (repoID , planID ).Observe (float64 (bytesAdded ))
83
- r .backupFileWarnings .WithLabelValues (repoID , planID ).Observe (float64 (fileWarnings ))
82
+ r .backupBytesProcessed .WithLabelValues (repoID , planID ).Set (float64 (bytesProcessed ))
83
+ r .backupBytesAdded .WithLabelValues (repoID , planID ).Set (float64 (bytesAdded ))
84
+ r .backupFileWarnings .WithLabelValues (repoID , planID ).Set (float64 (fileWarnings ))
84
85
}
0 commit comments