Skip to content

Commit

Permalink
Add support of per bucket scanner report
Browse files Browse the repository at this point in the history
Each bucket will be scanned individually, this commit will deprecate
old cycle scan metrics since there is no concept of a full cycle in the
upcoming per bucket scan change.
  • Loading branch information
Anis Elleuch committed Sep 19, 2023
1 parent abd696d commit 5eabada
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,22 @@ func (r *RealtimeMetrics) Merge(other *RealtimeMetrics) {
}
}

// BucketsScanInfo holds scan information summary of all buckets
type BucketsScanInfo struct {
OngoingBuckets int
}

// ScannerMetrics contains scanner information.
type ScannerMetrics struct {
// Time these metrics were collected
CollectedAt time.Time `json:"collected"`

// Current scanner cycle
CurrentCycle uint64 `json:"current_cycle"`
CurrentCycle uint64 `json:"current_cycle"` // Deprecated Sep 2023
CurrentStarted time.Time `json:"current_started"` // Deprecated Sep 2023
CyclesCompletedAt []time.Time `json:"cycle_complete_times"` // Deprecated Sep 2023

// Start time of current cycle
CurrentStarted time.Time `json:"current_started"`

// History of when last cycles completed
CyclesCompletedAt []time.Time `json:"cycle_complete_times"`
// Current scanner cycle
BucketsScanInfo BucketsScanInfo `json:"buckets_scan_info"`

// Number of accumulated operations by type since server restart.
LifeTimeOps map[string]uint64 `json:"life_time_ops,omitempty"`
Expand Down Expand Up @@ -290,10 +293,16 @@ func (s *ScannerMetrics) Merge(other *ScannerMetrics) {
if other == nil {
return
}

if s.CollectedAt.Before(other.CollectedAt) {
// Use latest timestamp
s.CollectedAt = other.CollectedAt
}

if s.BucketsScanInfo.OngoingBuckets < other.BucketsScanInfo.OngoingBuckets {
s.BucketsScanInfo.OngoingBuckets = other.BucketsScanInfo.OngoingBuckets
}

if s.CurrentCycle < other.CurrentCycle {
s.CurrentCycle = other.CurrentCycle
s.CyclesCompletedAt = other.CyclesCompletedAt
Expand Down

0 comments on commit 5eabada

Please sign in to comment.