feat: reset metrics on every iteration
This commit is contained in:
parent
d7f0ea20e1
commit
f249a35a8a
2 changed files with 17 additions and 0 deletions
2
main.go
2
main.go
|
@ -57,6 +57,8 @@ func main() {
|
||||||
|
|
||||||
func RecordMetrics(m Metrics) {
|
func RecordMetrics(m Metrics) {
|
||||||
for {
|
for {
|
||||||
|
m.Reset()
|
||||||
|
|
||||||
entries, err := os.ReadDir(*backupDir)
|
entries, err := os.ReadDir(*backupDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
|
|
15
metrics.go
15
metrics.go
|
@ -41,3 +41,18 @@ func NewMetrics(reg prometheus.Registerer) *Metrics {
|
||||||
|
|
||||||
return metrics
|
return metrics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset all metrics
|
||||||
|
//
|
||||||
|
// This should be called on every loop iteration.
|
||||||
|
func (m *Metrics) Reset() {
|
||||||
|
m.ArchiveCount.Reset()
|
||||||
|
m.LastArchiveTime.Reset()
|
||||||
|
m.LastModified.Reset()
|
||||||
|
m.TotalChunks.Reset()
|
||||||
|
m.TotalCsize.Reset()
|
||||||
|
m.TotalSize.Reset()
|
||||||
|
m.TotalUniqueChunks.Reset()
|
||||||
|
m.UniqueCsize.Reset()
|
||||||
|
m.UniqueSize.Reset()
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue