Skip to content

Commit b27f415

Browse files
committed
archive error stat
1 parent 2d9ce30 commit b27f415

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

archive/archive.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ func (a *archive) check(ctx context.Context) error {
267267
skip++
268268
continue
269269
}
270+
a.stat.archiveError.Add(1)
270271
return indexStore.MarkError(ctx, spaceId, err.Error())
271272
}
272273
log.Info("space is archived", zap.String("spaceId", spaceId), zap.Duration("dur", time.Since(st)))

archive/stat.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import (
77
)
88

99
type archiveStat struct {
10-
archived atomic.Uint32
11-
restored atomic.Uint32
10+
archived atomic.Uint32
11+
archiveError atomic.Uint32
12+
restored atomic.Uint32
1213
}
1314

1415
func registerMetric(s *archiveStat, registry *prometheus.Registry) {
@@ -26,4 +27,11 @@ func registerMetric(s *archiveStat, registry *prometheus.Registry) {
2627
}, func() float64 {
2728
return float64(s.restored.Load())
2829
}))
30+
registry.MustRegister(prometheus.NewGaugeFunc(prometheus.GaugeOpts{
31+
Namespace: "node",
32+
Subsystem: "archive",
33+
Name: "error",
34+
}, func() float64 {
35+
return float64(s.archiveError.Load())
36+
}))
2937
}

0 commit comments

Comments
 (0)