From 867c8ae086cdacf489ef629a979f9929806a9cb2 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Tue, 21 Apr 2026 14:08:44 -0700 Subject: [PATCH 1/3] feat: add BucketLifeTimeILM to ScannerMetrics Add BucketLifeTimeILM map[string]map[string]uint64 to ScannerMetrics to carry per-bucket ILM action counts from nodes to the console fan-out aggregation path. Gated on opts.bucket in the caller so the payload does not grow with total bucket count on unconstrained queries. Update Merge() to sum action counts per bucket across nodes. Regenerate msgp serialisation code. Add table-driven tests covering same-bucket summation, multi-bucket merges, and nil-safety on both sides. --- estream/blockid_string.go | 8 +- estream/checksumtype_string.go | 5 +- heal-commands-drive-reason_gen.go | 5 +- heal-commands-offline-decision_gen.go | 5 +- heal-commands-offline-reason_gen.go | 5 +- metrics.go | 18 + metrics_gen.go | 722 ++++++++++++++++---------- metrics_test.go | 77 +++ 8 files changed, 561 insertions(+), 284 deletions(-) diff --git a/estream/blockid_string.go b/estream/blockid_string.go index f1eac2db..416adb64 100644 --- a/estream/blockid_string.go +++ b/estream/blockid_string.go @@ -23,9 +23,9 @@ const _blockID_name = "PlainKeyEncryptedKeyEncStreamPlainStreamDatablockEOSEOFEr var _blockID_index = [...]uint8{0, 8, 20, 29, 40, 49, 52, 55, 60} func (i blockID) String() string { - i -= 1 - if i < 0 || i >= blockID(len(_blockID_index)-1) { - return "blockID(" + strconv.FormatInt(int64(i+1), 10) + ")" + idx := int(i) - 1 + if i < 1 || idx >= len(_blockID_index)-1 { + return "blockID(" + strconv.FormatInt(int64(i), 10) + ")" } - return _blockID_name[_blockID_index[i]:_blockID_index[i+1]] + return _blockID_name[_blockID_index[idx]:_blockID_index[idx+1]] } diff --git a/estream/checksumtype_string.go b/estream/checksumtype_string.go index 68b3161d..498a679c 100644 --- a/estream/checksumtype_string.go +++ b/estream/checksumtype_string.go @@ -18,8 +18,9 @@ const _checksumType_name = "NoneXxhashUnknown" var _checksumType_index = [...]uint8{0, 4, 10, 17} func (i checksumType) String() string { - if i >= checksumType(len(_checksumType_index)-1) { + idx := int(i) - 0 + if i < 0 || idx >= len(_checksumType_index)-1 { return "checksumType(" + strconv.FormatInt(int64(i), 10) + ")" } - return _checksumType_name[_checksumType_index[i]:_checksumType_index[i+1]] + return _checksumType_name[_checksumType_index[idx]:_checksumType_index[idx+1]] } diff --git a/heal-commands-drive-reason_gen.go b/heal-commands-drive-reason_gen.go index ca46634b..8a8920e0 100644 --- a/heal-commands-drive-reason_gen.go +++ b/heal-commands-drive-reason_gen.go @@ -17,8 +17,9 @@ const _HealingDriveReason_name = "FreshDiskOfflineDisk" var _HealingDriveReason_index = [...]uint8{0, 9, 20} func (i HealingDriveReason) String() string { - if i < 0 || i >= HealingDriveReason(len(_HealingDriveReason_index)-1) { + idx := int(i) - 0 + if i < 0 || idx >= len(_HealingDriveReason_index)-1 { return "HealingDriveReason(" + strconv.FormatInt(int64(i), 10) + ")" } - return _HealingDriveReason_name[_HealingDriveReason_index[i]:_HealingDriveReason_index[i+1]] + return _HealingDriveReason_name[_HealingDriveReason_index[idx]:_HealingDriveReason_index[idx+1]] } diff --git a/heal-commands-offline-decision_gen.go b/heal-commands-offline-decision_gen.go index 14f05e5c..aa7ffcef 100644 --- a/heal-commands-offline-decision_gen.go +++ b/heal-commands-offline-decision_gen.go @@ -18,8 +18,9 @@ const _OfflineDecision_name = "NoneHealDriveSkipHealing" var _OfflineDecision_index = [...]uint8{0, 4, 13, 24} func (i OfflineDecision) String() string { - if i < 0 || i >= OfflineDecision(len(_OfflineDecision_index)-1) { + idx := int(i) - 0 + if i < 0 || idx >= len(_OfflineDecision_index)-1 { return "OfflineDecision(" + strconv.FormatInt(int64(i), 10) + ")" } - return _OfflineDecision_name[_OfflineDecision_index[i]:_OfflineDecision_index[i+1]] + return _OfflineDecision_name[_OfflineDecision_index[idx]:_OfflineDecision_index[idx+1]] } diff --git a/heal-commands-offline-reason_gen.go b/heal-commands-offline-reason_gen.go index ea924a78..88f65e1c 100644 --- a/heal-commands-offline-reason_gen.go +++ b/heal-commands-offline-reason_gen.go @@ -20,8 +20,9 @@ const _OfflineReason_name = "InvalidNodeDownDriveIOErrorDriveDownDriveTimeout" var _OfflineReason_index = [...]uint8{0, 7, 15, 27, 36, 48} func (i OfflineReason) String() string { - if i < 0 || i >= OfflineReason(len(_OfflineReason_index)-1) { + idx := int(i) - 0 + if i < 0 || idx >= len(_OfflineReason_index)-1 { return "OfflineReason(" + strconv.FormatInt(int64(i), 10) + ")" } - return _OfflineReason_name[_OfflineReason_index[i]:_OfflineReason_index[i+1]] + return _OfflineReason_name[_OfflineReason_index[idx]:_OfflineReason_index[idx+1]] } diff --git a/metrics.go b/metrics.go index 3f4ce593..442dd7d0 100644 --- a/metrics.go +++ b/metrics.go @@ -476,6 +476,11 @@ type ScannerMetrics struct { // Number of accumulated ILM operations by type since server restart. LifeTimeILM map[string]uint64 `json:"ilm_ops,omitempty"` + // Number of accumulated ILM operations by type since server start, per bucket. + // Keyed by bucket name, then by action name. Only populated when a specific + // bucket is requested; nil otherwise. + BucketLifeTimeILM map[string]map[string]uint64 `json:"bucket_ilm_ops,omitempty"` + // Last minute operation statistics. LastMinute struct { // Scanner actions. @@ -603,6 +608,19 @@ func (s *ScannerMetrics) Merge(other *ScannerMetrics) { total := s.LifeTimeILM[k] + v s.LifeTimeILM[k] = total } + for bucket, actions := range other.BucketLifeTimeILM { + if s.BucketLifeTimeILM == nil { + s.BucketLifeTimeILM = make(map[string]map[string]uint64) + } + dst := s.BucketLifeTimeILM[bucket] + if dst == nil { + dst = make(map[string]uint64, len(actions)) + } + for action, n := range actions { + dst[action] += n + } + s.BucketLifeTimeILM[bucket] = dst + } if s.LastMinute.ILM == nil && len(other.LastMinute.ILM) > 0 { s.LastMinute.ILM = make(map[string]TimedAction, len(other.LastMinute.ILM)) } diff --git a/metrics_gen.go b/metrics_gen.go index 38bbed06..2ab6ef09 100644 --- a/metrics_gen.go +++ b/metrics_gen.go @@ -33263,7 +33263,7 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { err = msgp.WrapError(err) return } - var zb0001Mask uint16 /* 10 bits */ + var zb0001Mask uint16 /* 11 bits */ _ = zb0001Mask for zb0001 > 0 { zb0001-- @@ -33385,17 +33385,68 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { z.LifeTimeILM[za0006] = za0007 } zb0001Mask |= 0x4 - case "last_minute": + case "bucket_ilm_ops": var zb0006 uint32 zb0006, err = dc.ReadMapHeader() if err != nil { - err = msgp.WrapError(err, "LastMinute") + err = msgp.WrapError(err, "BucketLifeTimeILM") return } - var zb0006Mask uint8 /* 2 bits */ - _ = zb0006Mask + if z.BucketLifeTimeILM == nil { + z.BucketLifeTimeILM = make(map[string]map[string]uint64, zb0006) + } else if len(z.BucketLifeTimeILM) > 0 { + clear(z.BucketLifeTimeILM) + } for zb0006 > 0 { zb0006-- + var za0008 string + za0008, err = dc.ReadString() + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM") + return + } + var za0009 map[string]uint64 + var zb0007 uint32 + zb0007, err = dc.ReadMapHeader() + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) + return + } + if za0009 == nil { + za0009 = make(map[string]uint64, zb0007) + } else if len(za0009) > 0 { + clear(za0009) + } + for zb0007 > 0 { + zb0007-- + var za0010 string + za0010, err = dc.ReadString() + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) + return + } + var za0011 uint64 + za0011, err = dc.ReadUint64() + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008, za0010) + return + } + za0009[za0010] = za0011 + } + z.BucketLifeTimeILM[za0008] = za0009 + } + zb0001Mask |= 0x8 + case "last_minute": + var zb0008 uint32 + zb0008, err = dc.ReadMapHeader() + if err != nil { + err = msgp.WrapError(err, "LastMinute") + return + } + var zb0008Mask uint8 /* 2 bits */ + _ = zb0008Mask + for zb0008 > 0 { + zb0008-- field, err = dc.ReadMapKeyPtr() if err != nil { err = msgp.WrapError(err, "LastMinute") @@ -33403,63 +33454,63 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { } switch msgp.UnsafeString(field) { case "actions": - var zb0007 uint32 - zb0007, err = dc.ReadMapHeader() + var zb0009 uint32 + zb0009, err = dc.ReadMapHeader() if err != nil { err = msgp.WrapError(err, "LastMinute", "Actions") return } if z.LastMinute.Actions == nil { - z.LastMinute.Actions = make(map[string]TimedAction, zb0007) + z.LastMinute.Actions = make(map[string]TimedAction, zb0009) } else if len(z.LastMinute.Actions) > 0 { clear(z.LastMinute.Actions) } - for zb0007 > 0 { - zb0007-- - var za0008 string - za0008, err = dc.ReadString() + for zb0009 > 0 { + zb0009-- + var za0012 string + za0012, err = dc.ReadString() if err != nil { err = msgp.WrapError(err, "LastMinute", "Actions") return } - var za0009 TimedAction - err = za0009.DecodeMsg(dc) + var za0013 TimedAction + err = za0013.DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "LastMinute", "Actions", za0008) + err = msgp.WrapError(err, "LastMinute", "Actions", za0012) return } - z.LastMinute.Actions[za0008] = za0009 + z.LastMinute.Actions[za0012] = za0013 } - zb0006Mask |= 0x1 + zb0008Mask |= 0x1 case "ilm": - var zb0008 uint32 - zb0008, err = dc.ReadMapHeader() + var zb0010 uint32 + zb0010, err = dc.ReadMapHeader() if err != nil { err = msgp.WrapError(err, "LastMinute", "ILM") return } if z.LastMinute.ILM == nil { - z.LastMinute.ILM = make(map[string]TimedAction, zb0008) + z.LastMinute.ILM = make(map[string]TimedAction, zb0010) } else if len(z.LastMinute.ILM) > 0 { clear(z.LastMinute.ILM) } - for zb0008 > 0 { - zb0008-- - var za0010 string - za0010, err = dc.ReadString() + for zb0010 > 0 { + zb0010-- + var za0014 string + za0014, err = dc.ReadString() if err != nil { err = msgp.WrapError(err, "LastMinute", "ILM") return } - var za0011 TimedAction - err = za0011.DecodeMsg(dc) + var za0015 TimedAction + err = za0015.DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "LastMinute", "ILM", za0010) + err = msgp.WrapError(err, "LastMinute", "ILM", za0014) return } - z.LastMinute.ILM[za0010] = za0011 + z.LastMinute.ILM[za0014] = za0015 } - zb0006Mask |= 0x2 + zb0008Mask |= 0x2 default: err = dc.Skip() if err != nil { @@ -33469,117 +33520,117 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { } } // Clear omitted fields. - if zb0006Mask != 0x3 { - if (zb0006Mask & 0x1) == 0 { + if zb0008Mask != 0x3 { + if (zb0008Mask & 0x1) == 0 { z.LastMinute.Actions = nil } - if (zb0006Mask & 0x2) == 0 { + if (zb0008Mask & 0x2) == 0 { z.LastMinute.ILM = nil } } case "last_day": - var zb0009 uint32 - zb0009, err = dc.ReadMapHeader() + var zb0011 uint32 + zb0011, err = dc.ReadMapHeader() if err != nil { err = msgp.WrapError(err, "LastDay") return } if z.LastDay == nil { - z.LastDay = make(map[string]SegmentedActions, zb0009) + z.LastDay = make(map[string]SegmentedActions, zb0011) } else if len(z.LastDay) > 0 { clear(z.LastDay) } - for zb0009 > 0 { - zb0009-- - var za0012 string - za0012, err = dc.ReadString() + for zb0011 > 0 { + zb0011-- + var za0016 string + za0016, err = dc.ReadString() if err != nil { err = msgp.WrapError(err, "LastDay") return } - var za0013 SegmentedActions - err = (*Segmented[TimedAction, *TimedAction])(&za0013).DecodeMsg(dc) + var za0017 SegmentedActions + err = (*Segmented[TimedAction, *TimedAction])(&za0017).DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "LastDay", za0012) + err = msgp.WrapError(err, "LastDay", za0016) return } - z.LastDay[za0012] = za0013 + z.LastDay[za0016] = za0017 } - zb0001Mask |= 0x8 + zb0001Mask |= 0x10 case "active": - var zb0010 uint32 - zb0010, err = dc.ReadArrayHeader() + var zb0012 uint32 + zb0012, err = dc.ReadArrayHeader() if err != nil { err = msgp.WrapError(err, "ActivePaths") return } - if cap(z.ActivePaths) >= int(zb0010) { - z.ActivePaths = (z.ActivePaths)[:zb0010] + if cap(z.ActivePaths) >= int(zb0012) { + z.ActivePaths = (z.ActivePaths)[:zb0012] } else { - z.ActivePaths = make([]string, zb0010) + z.ActivePaths = make([]string, zb0012) } - for za0014 := range z.ActivePaths { - z.ActivePaths[za0014], err = dc.ReadString() + for za0018 := range z.ActivePaths { + z.ActivePaths[za0018], err = dc.ReadString() if err != nil { - err = msgp.WrapError(err, "ActivePaths", za0014) + err = msgp.WrapError(err, "ActivePaths", za0018) return } } - zb0001Mask |= 0x10 + zb0001Mask |= 0x20 case "excessive": - var zb0011 uint32 - zb0011, err = dc.ReadArrayHeader() + var zb0013 uint32 + zb0013, err = dc.ReadArrayHeader() if err != nil { err = msgp.WrapError(err, "ExcessivePrefixes") return } - if cap(z.ExcessivePrefixes) >= int(zb0011) { - z.ExcessivePrefixes = (z.ExcessivePrefixes)[:zb0011] + if cap(z.ExcessivePrefixes) >= int(zb0013) { + z.ExcessivePrefixes = (z.ExcessivePrefixes)[:zb0013] } else { - z.ExcessivePrefixes = make([]string, zb0011) + z.ExcessivePrefixes = make([]string, zb0013) } - for za0015 := range z.ExcessivePrefixes { - z.ExcessivePrefixes[za0015], err = dc.ReadString() + for za0019 := range z.ExcessivePrefixes { + z.ExcessivePrefixes[za0019], err = dc.ReadString() if err != nil { - err = msgp.WrapError(err, "ExcessivePrefixes", za0015) + err = msgp.WrapError(err, "ExcessivePrefixes", za0019) return } } - zb0001Mask |= 0x20 + zb0001Mask |= 0x40 case "excessive_versions": - var zb0012 uint32 - zb0012, err = dc.ReadArrayHeader() + var zb0014 uint32 + zb0014, err = dc.ReadArrayHeader() if err != nil { err = msgp.WrapError(err, "ExcessiveVersionObjects") return } - if cap(z.ExcessiveVersionObjects) >= int(zb0012) { - z.ExcessiveVersionObjects = (z.ExcessiveVersionObjects)[:zb0012] + if cap(z.ExcessiveVersionObjects) >= int(zb0014) { + z.ExcessiveVersionObjects = (z.ExcessiveVersionObjects)[:zb0014] } else { - z.ExcessiveVersionObjects = make([]string, zb0012) + z.ExcessiveVersionObjects = make([]string, zb0014) } - for za0016 := range z.ExcessiveVersionObjects { - z.ExcessiveVersionObjects[za0016], err = dc.ReadString() + for za0020 := range z.ExcessiveVersionObjects { + z.ExcessiveVersionObjects[za0020], err = dc.ReadString() if err != nil { - err = msgp.WrapError(err, "ExcessiveVersionObjects", za0016) + err = msgp.WrapError(err, "ExcessiveVersionObjects", za0020) return } } - zb0001Mask |= 0x40 + zb0001Mask |= 0x80 case "discarded_excess_entries": z.DiscardedExcessEntries, err = dc.ReadUint64() if err != nil { err = msgp.WrapError(err, "DiscardedExcessEntries") return } - zb0001Mask |= 0x80 + zb0001Mask |= 0x100 case "ilm_expiry_pending_tasks": z.ILMExpiryPendingTasks, err = dc.ReadInt() if err != nil { err = msgp.WrapError(err, "ILMExpiryPendingTasks") return } - zb0001Mask |= 0x100 + zb0001Mask |= 0x200 case "ilm_expiry_tasks_cleanup": err = z.ILMExpiryTasksServiced.DecodeMsg(dc) if err != nil { @@ -33587,25 +33638,25 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { return } case "queued_for_expiry": - var zb0013 uint32 - zb0013, err = dc.ReadArrayHeader() + var zb0015 uint32 + zb0015, err = dc.ReadArrayHeader() if err != nil { err = msgp.WrapError(err, "QueuedForExpiry") return } - if cap(z.QueuedForExpiry) >= int(zb0013) { - z.QueuedForExpiry = (z.QueuedForExpiry)[:zb0013] + if cap(z.QueuedForExpiry) >= int(zb0015) { + z.QueuedForExpiry = (z.QueuedForExpiry)[:zb0015] } else { - z.QueuedForExpiry = make([]ExpiryObject, zb0013) + z.QueuedForExpiry = make([]ExpiryObject, zb0015) } - for za0017 := range z.QueuedForExpiry { - err = z.QueuedForExpiry[za0017].DecodeMsg(dc) + for za0021 := range z.QueuedForExpiry { + err = z.QueuedForExpiry[za0021].DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "QueuedForExpiry", za0017) + err = msgp.WrapError(err, "QueuedForExpiry", za0021) return } } - zb0001Mask |= 0x200 + zb0001Mask |= 0x400 default: err = dc.Skip() if err != nil { @@ -33615,7 +33666,7 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { } } // Clear omitted fields. - if zb0001Mask != 0x3ff { + if zb0001Mask != 0x7ff { if (zb0001Mask & 0x1) == 0 { z.PerBucketStats = nil } @@ -33626,24 +33677,27 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { z.LifeTimeILM = nil } if (zb0001Mask & 0x8) == 0 { - z.LastDay = nil + z.BucketLifeTimeILM = nil } if (zb0001Mask & 0x10) == 0 { - z.ActivePaths = nil + z.LastDay = nil } if (zb0001Mask & 0x20) == 0 { - z.ExcessivePrefixes = nil + z.ActivePaths = nil } if (zb0001Mask & 0x40) == 0 { - z.ExcessiveVersionObjects = nil + z.ExcessivePrefixes = nil } if (zb0001Mask & 0x80) == 0 { - z.DiscardedExcessEntries = 0 + z.ExcessiveVersionObjects = nil } if (zb0001Mask & 0x100) == 0 { - z.ILMExpiryPendingTasks = 0 + z.DiscardedExcessEntries = 0 } if (zb0001Mask & 0x200) == 0 { + z.ILMExpiryPendingTasks = 0 + } + if (zb0001Mask & 0x400) == 0 { z.QueuedForExpiry = nil } } @@ -33653,8 +33707,8 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { // EncodeMsg implements msgp.Encodable func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { // check for omitted fields - zb0001Len := uint32(14) - var zb0001Mask uint16 /* 14 bits */ + zb0001Len := uint32(15) + var zb0001Mask uint16 /* 15 bits */ _ = zb0001Mask if z.PerBucketStats == nil { zb0001Len-- @@ -33668,33 +33722,37 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { zb0001Len-- zb0001Mask |= 0x10 } + if z.BucketLifeTimeILM == nil { + zb0001Len-- + zb0001Mask |= 0x20 + } if z.LastDay == nil { zb0001Len-- - zb0001Mask |= 0x40 + zb0001Mask |= 0x80 } if z.ActivePaths == nil { zb0001Len-- - zb0001Mask |= 0x80 + zb0001Mask |= 0x100 } if z.ExcessivePrefixes == nil { zb0001Len-- - zb0001Mask |= 0x100 + zb0001Mask |= 0x200 } if z.ExcessiveVersionObjects == nil { zb0001Len-- - zb0001Mask |= 0x200 + zb0001Mask |= 0x400 } if z.DiscardedExcessEntries == 0 { zb0001Len-- - zb0001Mask |= 0x400 + zb0001Mask |= 0x800 } if z.ILMExpiryPendingTasks == 0 { zb0001Len-- - zb0001Mask |= 0x800 + zb0001Mask |= 0x1000 } if z.QueuedForExpiry == nil { zb0001Len-- - zb0001Mask |= 0x2000 + zb0001Mask |= 0x4000 } // variable map header, size zb0001Len err = en.Append(0x80 | uint8(zb0001Len)) @@ -33803,6 +33861,42 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { } } } + if (zb0001Mask & 0x20) == 0 { // if not omitted + // write "bucket_ilm_ops" + err = en.Append(0xae, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x6c, 0x6d, 0x5f, 0x6f, 0x70, 0x73) + if err != nil { + return + } + err = en.WriteMapHeader(uint32(len(z.BucketLifeTimeILM))) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM") + return + } + for za0008, za0009 := range z.BucketLifeTimeILM { + err = en.WriteString(za0008) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM") + return + } + err = en.WriteMapHeader(uint32(len(za0009))) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) + return + } + for za0010, za0011 := range za0009 { + err = en.WriteString(za0010) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) + return + } + err = en.WriteUint64(za0011) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008, za0010) + return + } + } + } + } // write "last_minute" err = en.Append(0xab, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65) if err != nil { @@ -33839,15 +33933,15 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "LastMinute", "Actions") return } - for za0008, za0009 := range z.LastMinute.Actions { - err = en.WriteString(za0008) + for za0012, za0013 := range z.LastMinute.Actions { + err = en.WriteString(za0012) if err != nil { err = msgp.WrapError(err, "LastMinute", "Actions") return } - err = za0009.EncodeMsg(en) + err = za0013.EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "LastMinute", "Actions", za0008) + err = msgp.WrapError(err, "LastMinute", "Actions", za0012) return } } @@ -33863,21 +33957,21 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "LastMinute", "ILM") return } - for za0010, za0011 := range z.LastMinute.ILM { - err = en.WriteString(za0010) + for za0014, za0015 := range z.LastMinute.ILM { + err = en.WriteString(za0014) if err != nil { err = msgp.WrapError(err, "LastMinute", "ILM") return } - err = za0011.EncodeMsg(en) + err = za0015.EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "LastMinute", "ILM", za0010) + err = msgp.WrapError(err, "LastMinute", "ILM", za0014) return } } } } - if (zb0001Mask & 0x40) == 0 { // if not omitted + if (zb0001Mask & 0x80) == 0 { // if not omitted // write "last_day" err = en.Append(0xa8, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x64, 0x61, 0x79) if err != nil { @@ -33888,20 +33982,20 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "LastDay") return } - for za0012, za0013 := range z.LastDay { - err = en.WriteString(za0012) + for za0016, za0017 := range z.LastDay { + err = en.WriteString(za0016) if err != nil { err = msgp.WrapError(err, "LastDay") return } - err = (*Segmented[TimedAction, *TimedAction])(&za0013).EncodeMsg(en) + err = (*Segmented[TimedAction, *TimedAction])(&za0017).EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "LastDay", za0012) + err = msgp.WrapError(err, "LastDay", za0016) return } } } - if (zb0001Mask & 0x80) == 0 { // if not omitted + if (zb0001Mask & 0x100) == 0 { // if not omitted // write "active" err = en.Append(0xa6, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65) if err != nil { @@ -33912,15 +34006,15 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "ActivePaths") return } - for za0014 := range z.ActivePaths { - err = en.WriteString(z.ActivePaths[za0014]) + for za0018 := range z.ActivePaths { + err = en.WriteString(z.ActivePaths[za0018]) if err != nil { - err = msgp.WrapError(err, "ActivePaths", za0014) + err = msgp.WrapError(err, "ActivePaths", za0018) return } } } - if (zb0001Mask & 0x100) == 0 { // if not omitted + if (zb0001Mask & 0x200) == 0 { // if not omitted // write "excessive" err = en.Append(0xa9, 0x65, 0x78, 0x63, 0x65, 0x73, 0x73, 0x69, 0x76, 0x65) if err != nil { @@ -33931,15 +34025,15 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "ExcessivePrefixes") return } - for za0015 := range z.ExcessivePrefixes { - err = en.WriteString(z.ExcessivePrefixes[za0015]) + for za0019 := range z.ExcessivePrefixes { + err = en.WriteString(z.ExcessivePrefixes[za0019]) if err != nil { - err = msgp.WrapError(err, "ExcessivePrefixes", za0015) + err = msgp.WrapError(err, "ExcessivePrefixes", za0019) return } } } - if (zb0001Mask & 0x200) == 0 { // if not omitted + if (zb0001Mask & 0x400) == 0 { // if not omitted // write "excessive_versions" err = en.Append(0xb2, 0x65, 0x78, 0x63, 0x65, 0x73, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73) if err != nil { @@ -33950,15 +34044,15 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "ExcessiveVersionObjects") return } - for za0016 := range z.ExcessiveVersionObjects { - err = en.WriteString(z.ExcessiveVersionObjects[za0016]) + for za0020 := range z.ExcessiveVersionObjects { + err = en.WriteString(z.ExcessiveVersionObjects[za0020]) if err != nil { - err = msgp.WrapError(err, "ExcessiveVersionObjects", za0016) + err = msgp.WrapError(err, "ExcessiveVersionObjects", za0020) return } } } - if (zb0001Mask & 0x400) == 0 { // if not omitted + if (zb0001Mask & 0x800) == 0 { // if not omitted // write "discarded_excess_entries" err = en.Append(0xb8, 0x64, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x65, 0x64, 0x5f, 0x65, 0x78, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73) if err != nil { @@ -33970,7 +34064,7 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { return } } - if (zb0001Mask & 0x800) == 0 { // if not omitted + if (zb0001Mask & 0x1000) == 0 { // if not omitted // write "ilm_expiry_pending_tasks" err = en.Append(0xb8, 0x69, 0x6c, 0x6d, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x5f, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x73) if err != nil { @@ -33992,7 +34086,7 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "ILMExpiryTasksServiced") return } - if (zb0001Mask & 0x2000) == 0 { // if not omitted + if (zb0001Mask & 0x4000) == 0 { // if not omitted // write "queued_for_expiry" err = en.Append(0xb1, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79) if err != nil { @@ -34003,10 +34097,10 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "QueuedForExpiry") return } - for za0017 := range z.QueuedForExpiry { - err = z.QueuedForExpiry[za0017].EncodeMsg(en) + for za0021 := range z.QueuedForExpiry { + err = z.QueuedForExpiry[za0021].EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "QueuedForExpiry", za0017) + err = msgp.WrapError(err, "QueuedForExpiry", za0021) return } } @@ -34019,8 +34113,8 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { func (z *ScannerMetrics) MarshalMsg(b []byte) (o []byte, err error) { o = msgp.Require(b, z.Msgsize()) // check for omitted fields - zb0001Len := uint32(14) - var zb0001Mask uint16 /* 14 bits */ + zb0001Len := uint32(15) + var zb0001Mask uint16 /* 15 bits */ _ = zb0001Mask if z.PerBucketStats == nil { zb0001Len-- @@ -34034,33 +34128,37 @@ func (z *ScannerMetrics) MarshalMsg(b []byte) (o []byte, err error) { zb0001Len-- zb0001Mask |= 0x10 } + if z.BucketLifeTimeILM == nil { + zb0001Len-- + zb0001Mask |= 0x20 + } if z.LastDay == nil { zb0001Len-- - zb0001Mask |= 0x40 + zb0001Mask |= 0x80 } if z.ActivePaths == nil { zb0001Len-- - zb0001Mask |= 0x80 + zb0001Mask |= 0x100 } if z.ExcessivePrefixes == nil { zb0001Len-- - zb0001Mask |= 0x100 + zb0001Mask |= 0x200 } if z.ExcessiveVersionObjects == nil { zb0001Len-- - zb0001Mask |= 0x200 + zb0001Mask |= 0x400 } if z.DiscardedExcessEntries == 0 { zb0001Len-- - zb0001Mask |= 0x400 + zb0001Mask |= 0x800 } if z.ILMExpiryPendingTasks == 0 { zb0001Len-- - zb0001Mask |= 0x800 + zb0001Mask |= 0x1000 } if z.QueuedForExpiry == nil { zb0001Len-- - zb0001Mask |= 0x2000 + zb0001Mask |= 0x4000 } // variable map header, size zb0001Len o = append(o, 0x80|uint8(zb0001Len)) @@ -34107,6 +34205,19 @@ func (z *ScannerMetrics) MarshalMsg(b []byte) (o []byte, err error) { o = msgp.AppendUint64(o, za0007) } } + if (zb0001Mask & 0x20) == 0 { // if not omitted + // string "bucket_ilm_ops" + o = append(o, 0xae, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x6c, 0x6d, 0x5f, 0x6f, 0x70, 0x73) + o = msgp.AppendMapHeader(o, uint32(len(z.BucketLifeTimeILM))) + for za0008, za0009 := range z.BucketLifeTimeILM { + o = msgp.AppendString(o, za0008) + o = msgp.AppendMapHeader(o, uint32(len(za0009))) + for za0010, za0011 := range za0009 { + o = msgp.AppendString(o, za0010) + o = msgp.AppendUint64(o, za0011) + } + } + } // string "last_minute" o = append(o, 0xab, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65) // check for omitted fields @@ -34130,11 +34241,11 @@ func (z *ScannerMetrics) MarshalMsg(b []byte) (o []byte, err error) { // string "actions" o = append(o, 0xa7, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73) o = msgp.AppendMapHeader(o, uint32(len(z.LastMinute.Actions))) - for za0008, za0009 := range z.LastMinute.Actions { - o = msgp.AppendString(o, za0008) - o, err = za0009.MarshalMsg(o) + for za0012, za0013 := range z.LastMinute.Actions { + o = msgp.AppendString(o, za0012) + o, err = za0013.MarshalMsg(o) if err != nil { - err = msgp.WrapError(err, "LastMinute", "Actions", za0008) + err = msgp.WrapError(err, "LastMinute", "Actions", za0012) return } } @@ -34143,59 +34254,59 @@ func (z *ScannerMetrics) MarshalMsg(b []byte) (o []byte, err error) { // string "ilm" o = append(o, 0xa3, 0x69, 0x6c, 0x6d) o = msgp.AppendMapHeader(o, uint32(len(z.LastMinute.ILM))) - for za0010, za0011 := range z.LastMinute.ILM { - o = msgp.AppendString(o, za0010) - o, err = za0011.MarshalMsg(o) + for za0014, za0015 := range z.LastMinute.ILM { + o = msgp.AppendString(o, za0014) + o, err = za0015.MarshalMsg(o) if err != nil { - err = msgp.WrapError(err, "LastMinute", "ILM", za0010) + err = msgp.WrapError(err, "LastMinute", "ILM", za0014) return } } } } - if (zb0001Mask & 0x40) == 0 { // if not omitted + if (zb0001Mask & 0x80) == 0 { // if not omitted // string "last_day" o = append(o, 0xa8, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x64, 0x61, 0x79) o = msgp.AppendMapHeader(o, uint32(len(z.LastDay))) - for za0012, za0013 := range z.LastDay { - o = msgp.AppendString(o, za0012) - o, err = (*Segmented[TimedAction, *TimedAction])(&za0013).MarshalMsg(o) + for za0016, za0017 := range z.LastDay { + o = msgp.AppendString(o, za0016) + o, err = (*Segmented[TimedAction, *TimedAction])(&za0017).MarshalMsg(o) if err != nil { - err = msgp.WrapError(err, "LastDay", za0012) + err = msgp.WrapError(err, "LastDay", za0016) return } } } - if (zb0001Mask & 0x80) == 0 { // if not omitted + if (zb0001Mask & 0x100) == 0 { // if not omitted // string "active" o = append(o, 0xa6, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65) o = msgp.AppendArrayHeader(o, uint32(len(z.ActivePaths))) - for za0014 := range z.ActivePaths { - o = msgp.AppendString(o, z.ActivePaths[za0014]) + for za0018 := range z.ActivePaths { + o = msgp.AppendString(o, z.ActivePaths[za0018]) } } - if (zb0001Mask & 0x100) == 0 { // if not omitted + if (zb0001Mask & 0x200) == 0 { // if not omitted // string "excessive" o = append(o, 0xa9, 0x65, 0x78, 0x63, 0x65, 0x73, 0x73, 0x69, 0x76, 0x65) o = msgp.AppendArrayHeader(o, uint32(len(z.ExcessivePrefixes))) - for za0015 := range z.ExcessivePrefixes { - o = msgp.AppendString(o, z.ExcessivePrefixes[za0015]) + for za0019 := range z.ExcessivePrefixes { + o = msgp.AppendString(o, z.ExcessivePrefixes[za0019]) } } - if (zb0001Mask & 0x200) == 0 { // if not omitted + if (zb0001Mask & 0x400) == 0 { // if not omitted // string "excessive_versions" o = append(o, 0xb2, 0x65, 0x78, 0x63, 0x65, 0x73, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73) o = msgp.AppendArrayHeader(o, uint32(len(z.ExcessiveVersionObjects))) - for za0016 := range z.ExcessiveVersionObjects { - o = msgp.AppendString(o, z.ExcessiveVersionObjects[za0016]) + for za0020 := range z.ExcessiveVersionObjects { + o = msgp.AppendString(o, z.ExcessiveVersionObjects[za0020]) } } - if (zb0001Mask & 0x400) == 0 { // if not omitted + if (zb0001Mask & 0x800) == 0 { // if not omitted // string "discarded_excess_entries" o = append(o, 0xb8, 0x64, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x65, 0x64, 0x5f, 0x65, 0x78, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73) o = msgp.AppendUint64(o, z.DiscardedExcessEntries) } - if (zb0001Mask & 0x800) == 0 { // if not omitted + if (zb0001Mask & 0x1000) == 0 { // if not omitted // string "ilm_expiry_pending_tasks" o = append(o, 0xb8, 0x69, 0x6c, 0x6d, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x5f, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x73) o = msgp.AppendInt(o, z.ILMExpiryPendingTasks) @@ -34207,14 +34318,14 @@ func (z *ScannerMetrics) MarshalMsg(b []byte) (o []byte, err error) { err = msgp.WrapError(err, "ILMExpiryTasksServiced") return } - if (zb0001Mask & 0x2000) == 0 { // if not omitted + if (zb0001Mask & 0x4000) == 0 { // if not omitted // string "queued_for_expiry" o = append(o, 0xb1, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79) o = msgp.AppendArrayHeader(o, uint32(len(z.QueuedForExpiry))) - for za0017 := range z.QueuedForExpiry { - o, err = z.QueuedForExpiry[za0017].MarshalMsg(o) + for za0021 := range z.QueuedForExpiry { + o, err = z.QueuedForExpiry[za0021].MarshalMsg(o) if err != nil { - err = msgp.WrapError(err, "QueuedForExpiry", za0017) + err = msgp.WrapError(err, "QueuedForExpiry", za0021) return } } @@ -34233,7 +34344,7 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { err = msgp.WrapError(err) return } - var zb0001Mask uint16 /* 10 bits */ + var zb0001Mask uint16 /* 11 bits */ _ = zb0001Mask for zb0001 > 0 { zb0001-- @@ -34355,17 +34466,68 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { z.LifeTimeILM[za0006] = za0007 } zb0001Mask |= 0x4 - case "last_minute": + case "bucket_ilm_ops": var zb0006 uint32 zb0006, bts, err = msgp.ReadMapHeaderBytes(bts) if err != nil { - err = msgp.WrapError(err, "LastMinute") + err = msgp.WrapError(err, "BucketLifeTimeILM") return } - var zb0006Mask uint8 /* 2 bits */ - _ = zb0006Mask + if z.BucketLifeTimeILM == nil { + z.BucketLifeTimeILM = make(map[string]map[string]uint64, zb0006) + } else if len(z.BucketLifeTimeILM) > 0 { + clear(z.BucketLifeTimeILM) + } for zb0006 > 0 { + var za0009 map[string]uint64 zb0006-- + var za0008 string + za0008, bts, err = msgp.ReadStringBytes(bts) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM") + return + } + var zb0007 uint32 + zb0007, bts, err = msgp.ReadMapHeaderBytes(bts) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) + return + } + if za0009 == nil { + za0009 = make(map[string]uint64, zb0007) + } else if len(za0009) > 0 { + clear(za0009) + } + for zb0007 > 0 { + var za0011 uint64 + zb0007-- + var za0010 string + za0010, bts, err = msgp.ReadStringBytes(bts) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) + return + } + za0011, bts, err = msgp.ReadUint64Bytes(bts) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008, za0010) + return + } + za0009[za0010] = za0011 + } + z.BucketLifeTimeILM[za0008] = za0009 + } + zb0001Mask |= 0x8 + case "last_minute": + var zb0008 uint32 + zb0008, bts, err = msgp.ReadMapHeaderBytes(bts) + if err != nil { + err = msgp.WrapError(err, "LastMinute") + return + } + var zb0008Mask uint8 /* 2 bits */ + _ = zb0008Mask + for zb0008 > 0 { + zb0008-- field, bts, err = msgp.ReadMapKeyZC(bts) if err != nil { err = msgp.WrapError(err, "LastMinute") @@ -34373,63 +34535,63 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { } switch msgp.UnsafeString(field) { case "actions": - var zb0007 uint32 - zb0007, bts, err = msgp.ReadMapHeaderBytes(bts) + var zb0009 uint32 + zb0009, bts, err = msgp.ReadMapHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "LastMinute", "Actions") return } if z.LastMinute.Actions == nil { - z.LastMinute.Actions = make(map[string]TimedAction, zb0007) + z.LastMinute.Actions = make(map[string]TimedAction, zb0009) } else if len(z.LastMinute.Actions) > 0 { clear(z.LastMinute.Actions) } - for zb0007 > 0 { - var za0009 TimedAction - zb0007-- - var za0008 string - za0008, bts, err = msgp.ReadStringBytes(bts) + for zb0009 > 0 { + var za0013 TimedAction + zb0009-- + var za0012 string + za0012, bts, err = msgp.ReadStringBytes(bts) if err != nil { err = msgp.WrapError(err, "LastMinute", "Actions") return } - bts, err = za0009.UnmarshalMsg(bts) + bts, err = za0013.UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "LastMinute", "Actions", za0008) + err = msgp.WrapError(err, "LastMinute", "Actions", za0012) return } - z.LastMinute.Actions[za0008] = za0009 + z.LastMinute.Actions[za0012] = za0013 } - zb0006Mask |= 0x1 + zb0008Mask |= 0x1 case "ilm": - var zb0008 uint32 - zb0008, bts, err = msgp.ReadMapHeaderBytes(bts) + var zb0010 uint32 + zb0010, bts, err = msgp.ReadMapHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "LastMinute", "ILM") return } if z.LastMinute.ILM == nil { - z.LastMinute.ILM = make(map[string]TimedAction, zb0008) + z.LastMinute.ILM = make(map[string]TimedAction, zb0010) } else if len(z.LastMinute.ILM) > 0 { clear(z.LastMinute.ILM) } - for zb0008 > 0 { - var za0011 TimedAction - zb0008-- - var za0010 string - za0010, bts, err = msgp.ReadStringBytes(bts) + for zb0010 > 0 { + var za0015 TimedAction + zb0010-- + var za0014 string + za0014, bts, err = msgp.ReadStringBytes(bts) if err != nil { err = msgp.WrapError(err, "LastMinute", "ILM") return } - bts, err = za0011.UnmarshalMsg(bts) + bts, err = za0015.UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "LastMinute", "ILM", za0010) + err = msgp.WrapError(err, "LastMinute", "ILM", za0014) return } - z.LastMinute.ILM[za0010] = za0011 + z.LastMinute.ILM[za0014] = za0015 } - zb0006Mask |= 0x2 + zb0008Mask |= 0x2 default: bts, err = msgp.Skip(bts) if err != nil { @@ -34439,117 +34601,117 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { } } // Clear omitted fields. - if zb0006Mask != 0x3 { - if (zb0006Mask & 0x1) == 0 { + if zb0008Mask != 0x3 { + if (zb0008Mask & 0x1) == 0 { z.LastMinute.Actions = nil } - if (zb0006Mask & 0x2) == 0 { + if (zb0008Mask & 0x2) == 0 { z.LastMinute.ILM = nil } } case "last_day": - var zb0009 uint32 - zb0009, bts, err = msgp.ReadMapHeaderBytes(bts) + var zb0011 uint32 + zb0011, bts, err = msgp.ReadMapHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "LastDay") return } if z.LastDay == nil { - z.LastDay = make(map[string]SegmentedActions, zb0009) + z.LastDay = make(map[string]SegmentedActions, zb0011) } else if len(z.LastDay) > 0 { clear(z.LastDay) } - for zb0009 > 0 { - var za0013 SegmentedActions - zb0009-- - var za0012 string - za0012, bts, err = msgp.ReadStringBytes(bts) + for zb0011 > 0 { + var za0017 SegmentedActions + zb0011-- + var za0016 string + za0016, bts, err = msgp.ReadStringBytes(bts) if err != nil { err = msgp.WrapError(err, "LastDay") return } - bts, err = (*Segmented[TimedAction, *TimedAction])(&za0013).UnmarshalMsg(bts) + bts, err = (*Segmented[TimedAction, *TimedAction])(&za0017).UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "LastDay", za0012) + err = msgp.WrapError(err, "LastDay", za0016) return } - z.LastDay[za0012] = za0013 + z.LastDay[za0016] = za0017 } - zb0001Mask |= 0x8 + zb0001Mask |= 0x10 case "active": - var zb0010 uint32 - zb0010, bts, err = msgp.ReadArrayHeaderBytes(bts) + var zb0012 uint32 + zb0012, bts, err = msgp.ReadArrayHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "ActivePaths") return } - if cap(z.ActivePaths) >= int(zb0010) { - z.ActivePaths = (z.ActivePaths)[:zb0010] + if cap(z.ActivePaths) >= int(zb0012) { + z.ActivePaths = (z.ActivePaths)[:zb0012] } else { - z.ActivePaths = make([]string, zb0010) + z.ActivePaths = make([]string, zb0012) } - for za0014 := range z.ActivePaths { - z.ActivePaths[za0014], bts, err = msgp.ReadStringBytes(bts) + for za0018 := range z.ActivePaths { + z.ActivePaths[za0018], bts, err = msgp.ReadStringBytes(bts) if err != nil { - err = msgp.WrapError(err, "ActivePaths", za0014) + err = msgp.WrapError(err, "ActivePaths", za0018) return } } - zb0001Mask |= 0x10 + zb0001Mask |= 0x20 case "excessive": - var zb0011 uint32 - zb0011, bts, err = msgp.ReadArrayHeaderBytes(bts) + var zb0013 uint32 + zb0013, bts, err = msgp.ReadArrayHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "ExcessivePrefixes") return } - if cap(z.ExcessivePrefixes) >= int(zb0011) { - z.ExcessivePrefixes = (z.ExcessivePrefixes)[:zb0011] + if cap(z.ExcessivePrefixes) >= int(zb0013) { + z.ExcessivePrefixes = (z.ExcessivePrefixes)[:zb0013] } else { - z.ExcessivePrefixes = make([]string, zb0011) + z.ExcessivePrefixes = make([]string, zb0013) } - for za0015 := range z.ExcessivePrefixes { - z.ExcessivePrefixes[za0015], bts, err = msgp.ReadStringBytes(bts) + for za0019 := range z.ExcessivePrefixes { + z.ExcessivePrefixes[za0019], bts, err = msgp.ReadStringBytes(bts) if err != nil { - err = msgp.WrapError(err, "ExcessivePrefixes", za0015) + err = msgp.WrapError(err, "ExcessivePrefixes", za0019) return } } - zb0001Mask |= 0x20 + zb0001Mask |= 0x40 case "excessive_versions": - var zb0012 uint32 - zb0012, bts, err = msgp.ReadArrayHeaderBytes(bts) + var zb0014 uint32 + zb0014, bts, err = msgp.ReadArrayHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "ExcessiveVersionObjects") return } - if cap(z.ExcessiveVersionObjects) >= int(zb0012) { - z.ExcessiveVersionObjects = (z.ExcessiveVersionObjects)[:zb0012] + if cap(z.ExcessiveVersionObjects) >= int(zb0014) { + z.ExcessiveVersionObjects = (z.ExcessiveVersionObjects)[:zb0014] } else { - z.ExcessiveVersionObjects = make([]string, zb0012) + z.ExcessiveVersionObjects = make([]string, zb0014) } - for za0016 := range z.ExcessiveVersionObjects { - z.ExcessiveVersionObjects[za0016], bts, err = msgp.ReadStringBytes(bts) + for za0020 := range z.ExcessiveVersionObjects { + z.ExcessiveVersionObjects[za0020], bts, err = msgp.ReadStringBytes(bts) if err != nil { - err = msgp.WrapError(err, "ExcessiveVersionObjects", za0016) + err = msgp.WrapError(err, "ExcessiveVersionObjects", za0020) return } } - zb0001Mask |= 0x40 + zb0001Mask |= 0x80 case "discarded_excess_entries": z.DiscardedExcessEntries, bts, err = msgp.ReadUint64Bytes(bts) if err != nil { err = msgp.WrapError(err, "DiscardedExcessEntries") return } - zb0001Mask |= 0x80 + zb0001Mask |= 0x100 case "ilm_expiry_pending_tasks": z.ILMExpiryPendingTasks, bts, err = msgp.ReadIntBytes(bts) if err != nil { err = msgp.WrapError(err, "ILMExpiryPendingTasks") return } - zb0001Mask |= 0x100 + zb0001Mask |= 0x200 case "ilm_expiry_tasks_cleanup": bts, err = z.ILMExpiryTasksServiced.UnmarshalMsg(bts) if err != nil { @@ -34557,25 +34719,25 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { return } case "queued_for_expiry": - var zb0013 uint32 - zb0013, bts, err = msgp.ReadArrayHeaderBytes(bts) + var zb0015 uint32 + zb0015, bts, err = msgp.ReadArrayHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "QueuedForExpiry") return } - if cap(z.QueuedForExpiry) >= int(zb0013) { - z.QueuedForExpiry = (z.QueuedForExpiry)[:zb0013] + if cap(z.QueuedForExpiry) >= int(zb0015) { + z.QueuedForExpiry = (z.QueuedForExpiry)[:zb0015] } else { - z.QueuedForExpiry = make([]ExpiryObject, zb0013) + z.QueuedForExpiry = make([]ExpiryObject, zb0015) } - for za0017 := range z.QueuedForExpiry { - bts, err = z.QueuedForExpiry[za0017].UnmarshalMsg(bts) + for za0021 := range z.QueuedForExpiry { + bts, err = z.QueuedForExpiry[za0021].UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "QueuedForExpiry", za0017) + err = msgp.WrapError(err, "QueuedForExpiry", za0021) return } } - zb0001Mask |= 0x200 + zb0001Mask |= 0x400 default: bts, err = msgp.Skip(bts) if err != nil { @@ -34585,7 +34747,7 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { } } // Clear omitted fields. - if zb0001Mask != 0x3ff { + if zb0001Mask != 0x7ff { if (zb0001Mask & 0x1) == 0 { z.PerBucketStats = nil } @@ -34596,24 +34758,27 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { z.LifeTimeILM = nil } if (zb0001Mask & 0x8) == 0 { - z.LastDay = nil + z.BucketLifeTimeILM = nil } if (zb0001Mask & 0x10) == 0 { - z.ActivePaths = nil + z.LastDay = nil } if (zb0001Mask & 0x20) == 0 { - z.ExcessivePrefixes = nil + z.ActivePaths = nil } if (zb0001Mask & 0x40) == 0 { - z.ExcessiveVersionObjects = nil + z.ExcessivePrefixes = nil } if (zb0001Mask & 0x80) == 0 { - z.DiscardedExcessEntries = 0 + z.ExcessiveVersionObjects = nil } if (zb0001Mask & 0x100) == 0 { - z.ILMExpiryPendingTasks = 0 + z.DiscardedExcessEntries = 0 } if (zb0001Mask & 0x200) == 0 { + z.ILMExpiryPendingTasks = 0 + } + if (zb0001Mask & 0x400) == 0 { z.QueuedForExpiry = nil } } @@ -34647,42 +34812,55 @@ func (z *ScannerMetrics) Msgsize() (s int) { s += msgp.StringPrefixSize + len(za0006) + msgp.Uint64Size } } + s += 15 + msgp.MapHeaderSize + if z.BucketLifeTimeILM != nil { + for za0008, za0009 := range z.BucketLifeTimeILM { + _ = za0009 + s += msgp.StringPrefixSize + len(za0008) + msgp.MapHeaderSize + if za0009 != nil { + for za0010, za0011 := range za0009 { + _ = za0011 + s += msgp.StringPrefixSize + len(za0010) + msgp.Uint64Size + } + } + } + } s += 12 + 1 + 8 + msgp.MapHeaderSize if z.LastMinute.Actions != nil { - for za0008, za0009 := range z.LastMinute.Actions { - _ = za0009 - s += msgp.StringPrefixSize + len(za0008) + za0009.Msgsize() + for za0012, za0013 := range z.LastMinute.Actions { + _ = za0013 + s += msgp.StringPrefixSize + len(za0012) + za0013.Msgsize() } } s += 4 + msgp.MapHeaderSize if z.LastMinute.ILM != nil { - for za0010, za0011 := range z.LastMinute.ILM { - _ = za0011 - s += msgp.StringPrefixSize + len(za0010) + za0011.Msgsize() + for za0014, za0015 := range z.LastMinute.ILM { + _ = za0015 + s += msgp.StringPrefixSize + len(za0014) + za0015.Msgsize() } } s += 9 + msgp.MapHeaderSize if z.LastDay != nil { - for za0012, za0013 := range z.LastDay { - _ = za0013 - s += msgp.StringPrefixSize + len(za0012) + (*Segmented[TimedAction, *TimedAction])(&za0013).Msgsize() + for za0016, za0017 := range z.LastDay { + _ = za0017 + s += msgp.StringPrefixSize + len(za0016) + (*Segmented[TimedAction, *TimedAction])(&za0017).Msgsize() } } s += 7 + msgp.ArrayHeaderSize - for za0014 := range z.ActivePaths { - s += msgp.StringPrefixSize + len(z.ActivePaths[za0014]) + for za0018 := range z.ActivePaths { + s += msgp.StringPrefixSize + len(z.ActivePaths[za0018]) } s += 10 + msgp.ArrayHeaderSize - for za0015 := range z.ExcessivePrefixes { - s += msgp.StringPrefixSize + len(z.ExcessivePrefixes[za0015]) + for za0019 := range z.ExcessivePrefixes { + s += msgp.StringPrefixSize + len(z.ExcessivePrefixes[za0019]) } s += 19 + msgp.ArrayHeaderSize - for za0016 := range z.ExcessiveVersionObjects { - s += msgp.StringPrefixSize + len(z.ExcessiveVersionObjects[za0016]) + for za0020 := range z.ExcessiveVersionObjects { + s += msgp.StringPrefixSize + len(z.ExcessiveVersionObjects[za0020]) } s += 25 + msgp.Uint64Size + 25 + msgp.IntSize + 25 + z.ILMExpiryTasksServiced.Msgsize() + 18 + msgp.ArrayHeaderSize - for za0017 := range z.QueuedForExpiry { - s += z.QueuedForExpiry[za0017].Msgsize() + for za0021 := range z.QueuedForExpiry { + s += z.QueuedForExpiry[za0021].Msgsize() } return } diff --git a/metrics_test.go b/metrics_test.go index d2e1ecc6..3aa879c9 100644 --- a/metrics_test.go +++ b/metrics_test.go @@ -189,6 +189,83 @@ func TestScannerMetricsMerge(t *testing.T) { } }, }, + { + name: "merge bucket lifetime ILM same bucket same action summed", + base: &ScannerMetrics{ + BucketLifeTimeILM: map[string]map[string]uint64{ + "bucket-a": {"DeleteAction": 100, "TransitionAction": 50}, + }, + }, + other: &ScannerMetrics{ + BucketLifeTimeILM: map[string]map[string]uint64{ + "bucket-a": {"DeleteAction": 200, "TransitionAction": 25}, + }, + }, + verify: func(t *testing.T, result *ScannerMetrics) { + expected := map[string]map[string]uint64{ + "bucket-a": {"DeleteAction": 300, "TransitionAction": 75}, + } + if !reflect.DeepEqual(result.BucketLifeTimeILM, expected) { + t.Errorf("BucketLifeTimeILM = %v, want %v", result.BucketLifeTimeILM, expected) + } + }, + }, + { + name: "merge bucket lifetime ILM different buckets both appear", + base: &ScannerMetrics{ + BucketLifeTimeILM: map[string]map[string]uint64{ + "bucket-a": {"DeleteAction": 10}, + }, + }, + other: &ScannerMetrics{ + BucketLifeTimeILM: map[string]map[string]uint64{ + "bucket-b": {"TransitionAction": 20}, + }, + }, + verify: func(t *testing.T, result *ScannerMetrics) { + if len(result.BucketLifeTimeILM) != 2 { + t.Fatalf("BucketLifeTimeILM len = %d, want 2", len(result.BucketLifeTimeILM)) + } + if result.BucketLifeTimeILM["bucket-a"]["DeleteAction"] != 10 { + t.Errorf("bucket-a DeleteAction = %d, want 10", result.BucketLifeTimeILM["bucket-a"]["DeleteAction"]) + } + if result.BucketLifeTimeILM["bucket-b"]["TransitionAction"] != 20 { + t.Errorf("bucket-b TransitionAction = %d, want 20", result.BucketLifeTimeILM["bucket-b"]["TransitionAction"]) + } + }, + }, + { + name: "merge bucket lifetime ILM nil on one side does not panic", + base: &ScannerMetrics{ + BucketLifeTimeILM: map[string]map[string]uint64{ + "bucket-a": {"DeleteAction": 5}, + }, + }, + other: &ScannerMetrics{ + BucketLifeTimeILM: nil, + }, + verify: func(t *testing.T, result *ScannerMetrics) { + if result.BucketLifeTimeILM["bucket-a"]["DeleteAction"] != 5 { + t.Errorf("bucket-a DeleteAction = %d, want 5", result.BucketLifeTimeILM["bucket-a"]["DeleteAction"]) + } + }, + }, + { + name: "merge bucket lifetime ILM nil base populated by other", + base: &ScannerMetrics{ + BucketLifeTimeILM: nil, + }, + other: &ScannerMetrics{ + BucketLifeTimeILM: map[string]map[string]uint64{ + "bucket-c": {"DeleteVersionAction": 7}, + }, + }, + verify: func(t *testing.T, result *ScannerMetrics) { + if result.BucketLifeTimeILM["bucket-c"]["DeleteVersionAction"] != 7 { + t.Errorf("bucket-c DeleteVersionAction = %d, want 7", result.BucketLifeTimeILM["bucket-c"]["DeleteVersionAction"]) + } + }, + }, } for _, tt := range tests { From 363c9bb2a099bfbbcce0c3d9dcd16872de5e9e25 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Thu, 23 Apr 2026 11:31:47 -0700 Subject: [PATCH 2/3] fix: pin stringer to module-managed version in generate directives Replace bare `stringer` invocations with `go tool stringer` so that go generate always uses the version pinned via the tool directive in go.mod (golang.org/x/tools v0.37.0) rather than whatever stringer binary happens to be on PATH. --- estream/types.go | 4 ++-- heal-commands.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/estream/types.go b/estream/types.go index e9ee8b7a..391b5125 100644 --- a/estream/types.go +++ b/estream/types.go @@ -19,7 +19,7 @@ package estream -//go:generate stringer -type=blockID -trimprefix=block +//go:generate go tool stringer -type=blockID -trimprefix=block type blockID int8 @@ -36,7 +36,7 @@ const ( type checksumType uint8 -//go:generate stringer -type=checksumType -trimprefix=checksumType +//go:generate go tool stringer -type=checksumType -trimprefix=checksumType const ( checksumTypeNone checksumType = iota diff --git a/heal-commands.go b/heal-commands.go index 465c1ff0..1ffc920b 100644 --- a/heal-commands.go +++ b/heal-commands.go @@ -364,7 +364,7 @@ type SetStatus struct { Disks []Disk `json:"disks"` } -//go:generate stringer -type=HealingDriveReason -output=heal-commands-drive-reason_gen.go -trimprefix=HealingReason $GOFILE +//go:generate go tool stringer -type=HealingDriveReason -output=heal-commands-drive-reason_gen.go -trimprefix=HealingReason $GOFILE type HealingDriveReason int8 const ( @@ -374,7 +374,7 @@ const ( HealingReasonOfflineDisk ) -//go:generate stringer -type=OfflineReason -output=heal-commands-offline-reason_gen.go -trimprefix=OfflineReason $GOFILE +//go:generate go tool stringer -type=OfflineReason -output=heal-commands-offline-reason_gen.go -trimprefix=OfflineReason $GOFILE type OfflineReason int8 const ( @@ -385,7 +385,7 @@ const ( OfflineReasonDriveTimeout ) -//go:generate stringer -type=OfflineDecision -output=heal-commands-offline-decision_gen.go -trimprefix=OfflineDecision $GOFILE +//go:generate go tool stringer -type=OfflineDecision -output=heal-commands-offline-decision_gen.go -trimprefix=OfflineDecision $GOFILE type OfflineDecision int8 const ( From 83723e6abf6e40cc8df522e782c6598c00a73eb9 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Wed, 13 May 2026 11:38:41 -0700 Subject: [PATCH 3/3] refactor: use *BucketILMStats for per-bucket ILM data Change ScannerMetrics.BucketLifeTimeILM from map[string]map[string]uint64 to map[string]*BucketILMStats so future per-bucket scanner fields can be added without growing the map signature. BucketILMStats carries Bucket and ActionCounters, with a nil-safe Merge that adopts the Bucket from either side. JSON and msgp tags use snake_case field names. The msgp generator emits encode/decode methods on the new type. --- estream/blockid_string.go | 8 +- estream/checksumtype_string.go | 5 +- heal-commands-drive-reason_gen.go | 5 +- heal-commands-offline-decision_gen.go | 5 +- heal-commands-offline-reason_gen.go | 5 +- metrics.go | 52 +- metrics_gen.go | 810 +++++++++++++++++--------- metrics_gen_test.go | 113 ++++ metrics_test.go | 44 +- 9 files changed, 712 insertions(+), 335 deletions(-) diff --git a/estream/blockid_string.go b/estream/blockid_string.go index 416adb64..f1eac2db 100644 --- a/estream/blockid_string.go +++ b/estream/blockid_string.go @@ -23,9 +23,9 @@ const _blockID_name = "PlainKeyEncryptedKeyEncStreamPlainStreamDatablockEOSEOFEr var _blockID_index = [...]uint8{0, 8, 20, 29, 40, 49, 52, 55, 60} func (i blockID) String() string { - idx := int(i) - 1 - if i < 1 || idx >= len(_blockID_index)-1 { - return "blockID(" + strconv.FormatInt(int64(i), 10) + ")" + i -= 1 + if i < 0 || i >= blockID(len(_blockID_index)-1) { + return "blockID(" + strconv.FormatInt(int64(i+1), 10) + ")" } - return _blockID_name[_blockID_index[idx]:_blockID_index[idx+1]] + return _blockID_name[_blockID_index[i]:_blockID_index[i+1]] } diff --git a/estream/checksumtype_string.go b/estream/checksumtype_string.go index 498a679c..68b3161d 100644 --- a/estream/checksumtype_string.go +++ b/estream/checksumtype_string.go @@ -18,9 +18,8 @@ const _checksumType_name = "NoneXxhashUnknown" var _checksumType_index = [...]uint8{0, 4, 10, 17} func (i checksumType) String() string { - idx := int(i) - 0 - if i < 0 || idx >= len(_checksumType_index)-1 { + if i >= checksumType(len(_checksumType_index)-1) { return "checksumType(" + strconv.FormatInt(int64(i), 10) + ")" } - return _checksumType_name[_checksumType_index[idx]:_checksumType_index[idx+1]] + return _checksumType_name[_checksumType_index[i]:_checksumType_index[i+1]] } diff --git a/heal-commands-drive-reason_gen.go b/heal-commands-drive-reason_gen.go index 8a8920e0..ca46634b 100644 --- a/heal-commands-drive-reason_gen.go +++ b/heal-commands-drive-reason_gen.go @@ -17,9 +17,8 @@ const _HealingDriveReason_name = "FreshDiskOfflineDisk" var _HealingDriveReason_index = [...]uint8{0, 9, 20} func (i HealingDriveReason) String() string { - idx := int(i) - 0 - if i < 0 || idx >= len(_HealingDriveReason_index)-1 { + if i < 0 || i >= HealingDriveReason(len(_HealingDriveReason_index)-1) { return "HealingDriveReason(" + strconv.FormatInt(int64(i), 10) + ")" } - return _HealingDriveReason_name[_HealingDriveReason_index[idx]:_HealingDriveReason_index[idx+1]] + return _HealingDriveReason_name[_HealingDriveReason_index[i]:_HealingDriveReason_index[i+1]] } diff --git a/heal-commands-offline-decision_gen.go b/heal-commands-offline-decision_gen.go index aa7ffcef..14f05e5c 100644 --- a/heal-commands-offline-decision_gen.go +++ b/heal-commands-offline-decision_gen.go @@ -18,9 +18,8 @@ const _OfflineDecision_name = "NoneHealDriveSkipHealing" var _OfflineDecision_index = [...]uint8{0, 4, 13, 24} func (i OfflineDecision) String() string { - idx := int(i) - 0 - if i < 0 || idx >= len(_OfflineDecision_index)-1 { + if i < 0 || i >= OfflineDecision(len(_OfflineDecision_index)-1) { return "OfflineDecision(" + strconv.FormatInt(int64(i), 10) + ")" } - return _OfflineDecision_name[_OfflineDecision_index[idx]:_OfflineDecision_index[idx+1]] + return _OfflineDecision_name[_OfflineDecision_index[i]:_OfflineDecision_index[i+1]] } diff --git a/heal-commands-offline-reason_gen.go b/heal-commands-offline-reason_gen.go index 88f65e1c..ea924a78 100644 --- a/heal-commands-offline-reason_gen.go +++ b/heal-commands-offline-reason_gen.go @@ -20,9 +20,8 @@ const _OfflineReason_name = "InvalidNodeDownDriveIOErrorDriveDownDriveTimeout" var _OfflineReason_index = [...]uint8{0, 7, 15, 27, 36, 48} func (i OfflineReason) String() string { - idx := int(i) - 0 - if i < 0 || idx >= len(_OfflineReason_index)-1 { + if i < 0 || i >= OfflineReason(len(_OfflineReason_index)-1) { return "OfflineReason(" + strconv.FormatInt(int64(i), 10) + ")" } - return _OfflineReason_name[_OfflineReason_index[idx]:_OfflineReason_index[idx+1]] + return _OfflineReason_name[_OfflineReason_index[i]:_OfflineReason_index[i+1]] } diff --git a/metrics.go b/metrics.go index 442dd7d0..73c55e81 100644 --- a/metrics.go +++ b/metrics.go @@ -459,6 +459,34 @@ func (r *Metrics) Merge(other *Metrics) { } } +// BucketILMStats reports the cumulative ILM action counters for a single +// bucket carried in a ScannerMetrics value. +type BucketILMStats struct { + Bucket string `json:"bucket,omitempty" msg:"bucket,omitempty"` + ActionCounters map[string]uint64 `json:"action_counters,omitempty" msg:"action_counters,omitempty"` +} + +// Merge adds other.ActionCounters into b.ActionCounters. b.Bucket is preserved +// when set, otherwise adopted from other (even when other has no counters). A +// nil other is a no-op. +func (b *BucketILMStats) Merge(other *BucketILMStats) { + if other == nil { + return + } + if b.Bucket == "" { + b.Bucket = other.Bucket + } + if len(other.ActionCounters) == 0 { + return + } + if b.ActionCounters == nil { + b.ActionCounters = make(map[string]uint64, len(other.ActionCounters)) + } + for action, n := range other.ActionCounters { + b.ActionCounters[action] += n + } +} + // ScannerMetrics contains scanner information. type ScannerMetrics struct { // Time these metrics were collected @@ -476,10 +504,10 @@ type ScannerMetrics struct { // Number of accumulated ILM operations by type since server restart. LifeTimeILM map[string]uint64 `json:"ilm_ops,omitempty"` - // Number of accumulated ILM operations by type since server start, per bucket. - // Keyed by bucket name, then by action name. Only populated when a specific - // bucket is requested; nil otherwise. - BucketLifeTimeILM map[string]map[string]uint64 `json:"bucket_ilm_ops,omitempty"` + // BucketLifeTimeILM reports cumulative ILM action counters per bucket, + // keyed by bucket name. Populated only when a specific bucket is + // requested; nil otherwise. + BucketLifeTimeILM map[string]*BucketILMStats `json:"bucket_ilm_stats,omitempty"` // Last minute operation statistics. LastMinute struct { @@ -608,18 +636,16 @@ func (s *ScannerMetrics) Merge(other *ScannerMetrics) { total := s.LifeTimeILM[k] + v s.LifeTimeILM[k] = total } - for bucket, actions := range other.BucketLifeTimeILM { + for bucket, otherStats := range other.BucketLifeTimeILM { if s.BucketLifeTimeILM == nil { - s.BucketLifeTimeILM = make(map[string]map[string]uint64) - } - dst := s.BucketLifeTimeILM[bucket] - if dst == nil { - dst = make(map[string]uint64, len(actions)) + s.BucketLifeTimeILM = make(map[string]*BucketILMStats, len(other.BucketLifeTimeILM)) } - for action, n := range actions { - dst[action] += n + dst, ok := s.BucketLifeTimeILM[bucket] + if !ok { + dst = &BucketILMStats{Bucket: bucket} + s.BucketLifeTimeILM[bucket] = dst } - s.BucketLifeTimeILM[bucket] = dst + dst.Merge(otherStats) } if s.LastMinute.ILM == nil && len(other.LastMinute.ILM) > 0 { s.LastMinute.ILM = make(map[string]TimedAction, len(other.LastMinute.ILM)) diff --git a/metrics_gen.go b/metrics_gen.go index 2ab6ef09..f25b5f0b 100644 --- a/metrics_gen.go +++ b/metrics_gen.go @@ -2386,6 +2386,271 @@ func (z *BucketAPIMetrics) Msgsize() (s int) { return } +// DecodeMsg implements msgp.Decodable +func (z *BucketILMStats) DecodeMsg(dc *msgp.Reader) (err error) { + var field []byte + _ = field + var zb0001 uint32 + zb0001, err = dc.ReadMapHeader() + if err != nil { + err = msgp.WrapError(err) + return + } + var zb0001Mask uint8 /* 2 bits */ + _ = zb0001Mask + for zb0001 > 0 { + zb0001-- + field, err = dc.ReadMapKeyPtr() + if err != nil { + err = msgp.WrapError(err) + return + } + switch msgp.UnsafeString(field) { + case "bucket": + z.Bucket, err = dc.ReadString() + if err != nil { + err = msgp.WrapError(err, "Bucket") + return + } + zb0001Mask |= 0x1 + case "action_counters": + var zb0002 uint32 + zb0002, err = dc.ReadMapHeader() + if err != nil { + err = msgp.WrapError(err, "ActionCounters") + return + } + if z.ActionCounters == nil { + z.ActionCounters = make(map[string]uint64, zb0002) + } else if len(z.ActionCounters) > 0 { + clear(z.ActionCounters) + } + for zb0002 > 0 { + zb0002-- + var za0001 string + za0001, err = dc.ReadString() + if err != nil { + err = msgp.WrapError(err, "ActionCounters") + return + } + var za0002 uint64 + za0002, err = dc.ReadUint64() + if err != nil { + err = msgp.WrapError(err, "ActionCounters", za0001) + return + } + z.ActionCounters[za0001] = za0002 + } + zb0001Mask |= 0x2 + default: + err = dc.Skip() + if err != nil { + err = msgp.WrapError(err) + return + } + } + } + // Clear omitted fields. + if zb0001Mask != 0x3 { + if (zb0001Mask & 0x1) == 0 { + z.Bucket = "" + } + if (zb0001Mask & 0x2) == 0 { + z.ActionCounters = nil + } + } + return +} + +// EncodeMsg implements msgp.Encodable +func (z *BucketILMStats) EncodeMsg(en *msgp.Writer) (err error) { + // check for omitted fields + zb0001Len := uint32(2) + var zb0001Mask uint8 /* 2 bits */ + _ = zb0001Mask + if z.Bucket == "" { + zb0001Len-- + zb0001Mask |= 0x1 + } + if z.ActionCounters == nil { + zb0001Len-- + zb0001Mask |= 0x2 + } + // variable map header, size zb0001Len + err = en.Append(0x80 | uint8(zb0001Len)) + if err != nil { + return + } + + // skip if no fields are to be emitted + if zb0001Len != 0 { + if (zb0001Mask & 0x1) == 0 { // if not omitted + // write "bucket" + err = en.Append(0xa6, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74) + if err != nil { + return + } + err = en.WriteString(z.Bucket) + if err != nil { + err = msgp.WrapError(err, "Bucket") + return + } + } + if (zb0001Mask & 0x2) == 0 { // if not omitted + // write "action_counters" + err = en.Append(0xaf, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73) + if err != nil { + return + } + err = en.WriteMapHeader(uint32(len(z.ActionCounters))) + if err != nil { + err = msgp.WrapError(err, "ActionCounters") + return + } + for za0001, za0002 := range z.ActionCounters { + err = en.WriteString(za0001) + if err != nil { + err = msgp.WrapError(err, "ActionCounters") + return + } + err = en.WriteUint64(za0002) + if err != nil { + err = msgp.WrapError(err, "ActionCounters", za0001) + return + } + } + } + } + return +} + +// MarshalMsg implements msgp.Marshaler +func (z *BucketILMStats) MarshalMsg(b []byte) (o []byte, err error) { + o = msgp.Require(b, z.Msgsize()) + // check for omitted fields + zb0001Len := uint32(2) + var zb0001Mask uint8 /* 2 bits */ + _ = zb0001Mask + if z.Bucket == "" { + zb0001Len-- + zb0001Mask |= 0x1 + } + if z.ActionCounters == nil { + zb0001Len-- + zb0001Mask |= 0x2 + } + // variable map header, size zb0001Len + o = append(o, 0x80|uint8(zb0001Len)) + + // skip if no fields are to be emitted + if zb0001Len != 0 { + if (zb0001Mask & 0x1) == 0 { // if not omitted + // string "bucket" + o = append(o, 0xa6, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74) + o = msgp.AppendString(o, z.Bucket) + } + if (zb0001Mask & 0x2) == 0 { // if not omitted + // string "action_counters" + o = append(o, 0xaf, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73) + o = msgp.AppendMapHeader(o, uint32(len(z.ActionCounters))) + for za0001, za0002 := range z.ActionCounters { + o = msgp.AppendString(o, za0001) + o = msgp.AppendUint64(o, za0002) + } + } + } + return +} + +// UnmarshalMsg implements msgp.Unmarshaler +func (z *BucketILMStats) UnmarshalMsg(bts []byte) (o []byte, err error) { + var field []byte + _ = field + var zb0001 uint32 + zb0001, bts, err = msgp.ReadMapHeaderBytes(bts) + if err != nil { + err = msgp.WrapError(err) + return + } + var zb0001Mask uint8 /* 2 bits */ + _ = zb0001Mask + for zb0001 > 0 { + zb0001-- + field, bts, err = msgp.ReadMapKeyZC(bts) + if err != nil { + err = msgp.WrapError(err) + return + } + switch msgp.UnsafeString(field) { + case "bucket": + z.Bucket, bts, err = msgp.ReadStringBytes(bts) + if err != nil { + err = msgp.WrapError(err, "Bucket") + return + } + zb0001Mask |= 0x1 + case "action_counters": + var zb0002 uint32 + zb0002, bts, err = msgp.ReadMapHeaderBytes(bts) + if err != nil { + err = msgp.WrapError(err, "ActionCounters") + return + } + if z.ActionCounters == nil { + z.ActionCounters = make(map[string]uint64, zb0002) + } else if len(z.ActionCounters) > 0 { + clear(z.ActionCounters) + } + for zb0002 > 0 { + var za0002 uint64 + zb0002-- + var za0001 string + za0001, bts, err = msgp.ReadStringBytes(bts) + if err != nil { + err = msgp.WrapError(err, "ActionCounters") + return + } + za0002, bts, err = msgp.ReadUint64Bytes(bts) + if err != nil { + err = msgp.WrapError(err, "ActionCounters", za0001) + return + } + z.ActionCounters[za0001] = za0002 + } + zb0001Mask |= 0x2 + default: + bts, err = msgp.Skip(bts) + if err != nil { + err = msgp.WrapError(err) + return + } + } + } + // Clear omitted fields. + if zb0001Mask != 0x3 { + if (zb0001Mask & 0x1) == 0 { + z.Bucket = "" + } + if (zb0001Mask & 0x2) == 0 { + z.ActionCounters = nil + } + } + o = bts + return +} + +// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message +func (z *BucketILMStats) Msgsize() (s int) { + s = 1 + 7 + msgp.StringPrefixSize + len(z.Bucket) + 16 + msgp.MapHeaderSize + if z.ActionCounters != nil { + for za0001, za0002 := range z.ActionCounters { + _ = za0002 + s += msgp.StringPrefixSize + len(za0001) + msgp.Uint64Size + } + } + return +} + // DecodeMsg implements msgp.Decodable func (z *BucketMetrics) DecodeMsg(dc *msgp.Reader) (err error) { var field []byte @@ -33385,7 +33650,7 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { z.LifeTimeILM[za0006] = za0007 } zb0001Mask |= 0x4 - case "bucket_ilm_ops": + case "bucket_ilm_stats": var zb0006 uint32 zb0006, err = dc.ReadMapHeader() if err != nil { @@ -33393,7 +33658,7 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { return } if z.BucketLifeTimeILM == nil { - z.BucketLifeTimeILM = make(map[string]map[string]uint64, zb0006) + z.BucketLifeTimeILM = make(map[string]*BucketILMStats, zb0006) } else if len(z.BucketLifeTimeILM) > 0 { clear(z.BucketLifeTimeILM) } @@ -33405,48 +33670,38 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { err = msgp.WrapError(err, "BucketLifeTimeILM") return } - var za0009 map[string]uint64 - var zb0007 uint32 - zb0007, err = dc.ReadMapHeader() - if err != nil { - err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) - return - } - if za0009 == nil { - za0009 = make(map[string]uint64, zb0007) - } else if len(za0009) > 0 { - clear(za0009) - } - for zb0007 > 0 { - zb0007-- - var za0010 string - za0010, err = dc.ReadString() + var za0009 *BucketILMStats + if dc.IsNil() { + err = dc.ReadNil() if err != nil { err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) return } - var za0011 uint64 - za0011, err = dc.ReadUint64() + za0009 = nil + } else { + if za0009 == nil { + za0009 = new(BucketILMStats) + } + err = za0009.DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "BucketLifeTimeILM", za0008, za0010) + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) return } - za0009[za0010] = za0011 } z.BucketLifeTimeILM[za0008] = za0009 } zb0001Mask |= 0x8 case "last_minute": - var zb0008 uint32 - zb0008, err = dc.ReadMapHeader() + var zb0007 uint32 + zb0007, err = dc.ReadMapHeader() if err != nil { err = msgp.WrapError(err, "LastMinute") return } - var zb0008Mask uint8 /* 2 bits */ - _ = zb0008Mask - for zb0008 > 0 { - zb0008-- + var zb0007Mask uint8 /* 2 bits */ + _ = zb0007Mask + for zb0007 > 0 { + zb0007-- field, err = dc.ReadMapKeyPtr() if err != nil { err = msgp.WrapError(err, "LastMinute") @@ -33454,63 +33709,63 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { } switch msgp.UnsafeString(field) { case "actions": - var zb0009 uint32 - zb0009, err = dc.ReadMapHeader() + var zb0008 uint32 + zb0008, err = dc.ReadMapHeader() if err != nil { err = msgp.WrapError(err, "LastMinute", "Actions") return } if z.LastMinute.Actions == nil { - z.LastMinute.Actions = make(map[string]TimedAction, zb0009) + z.LastMinute.Actions = make(map[string]TimedAction, zb0008) } else if len(z.LastMinute.Actions) > 0 { clear(z.LastMinute.Actions) } - for zb0009 > 0 { - zb0009-- - var za0012 string - za0012, err = dc.ReadString() + for zb0008 > 0 { + zb0008-- + var za0010 string + za0010, err = dc.ReadString() if err != nil { err = msgp.WrapError(err, "LastMinute", "Actions") return } - var za0013 TimedAction - err = za0013.DecodeMsg(dc) + var za0011 TimedAction + err = za0011.DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "LastMinute", "Actions", za0012) + err = msgp.WrapError(err, "LastMinute", "Actions", za0010) return } - z.LastMinute.Actions[za0012] = za0013 + z.LastMinute.Actions[za0010] = za0011 } - zb0008Mask |= 0x1 + zb0007Mask |= 0x1 case "ilm": - var zb0010 uint32 - zb0010, err = dc.ReadMapHeader() + var zb0009 uint32 + zb0009, err = dc.ReadMapHeader() if err != nil { err = msgp.WrapError(err, "LastMinute", "ILM") return } if z.LastMinute.ILM == nil { - z.LastMinute.ILM = make(map[string]TimedAction, zb0010) + z.LastMinute.ILM = make(map[string]TimedAction, zb0009) } else if len(z.LastMinute.ILM) > 0 { clear(z.LastMinute.ILM) } - for zb0010 > 0 { - zb0010-- - var za0014 string - za0014, err = dc.ReadString() + for zb0009 > 0 { + zb0009-- + var za0012 string + za0012, err = dc.ReadString() if err != nil { err = msgp.WrapError(err, "LastMinute", "ILM") return } - var za0015 TimedAction - err = za0015.DecodeMsg(dc) + var za0013 TimedAction + err = za0013.DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "LastMinute", "ILM", za0014) + err = msgp.WrapError(err, "LastMinute", "ILM", za0012) return } - z.LastMinute.ILM[za0014] = za0015 + z.LastMinute.ILM[za0012] = za0013 } - zb0008Mask |= 0x2 + zb0007Mask |= 0x2 default: err = dc.Skip() if err != nil { @@ -33520,99 +33775,99 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { } } // Clear omitted fields. - if zb0008Mask != 0x3 { - if (zb0008Mask & 0x1) == 0 { + if zb0007Mask != 0x3 { + if (zb0007Mask & 0x1) == 0 { z.LastMinute.Actions = nil } - if (zb0008Mask & 0x2) == 0 { + if (zb0007Mask & 0x2) == 0 { z.LastMinute.ILM = nil } } case "last_day": - var zb0011 uint32 - zb0011, err = dc.ReadMapHeader() + var zb0010 uint32 + zb0010, err = dc.ReadMapHeader() if err != nil { err = msgp.WrapError(err, "LastDay") return } if z.LastDay == nil { - z.LastDay = make(map[string]SegmentedActions, zb0011) + z.LastDay = make(map[string]SegmentedActions, zb0010) } else if len(z.LastDay) > 0 { clear(z.LastDay) } - for zb0011 > 0 { - zb0011-- - var za0016 string - za0016, err = dc.ReadString() + for zb0010 > 0 { + zb0010-- + var za0014 string + za0014, err = dc.ReadString() if err != nil { err = msgp.WrapError(err, "LastDay") return } - var za0017 SegmentedActions - err = (*Segmented[TimedAction, *TimedAction])(&za0017).DecodeMsg(dc) + var za0015 SegmentedActions + err = (*Segmented[TimedAction, *TimedAction])(&za0015).DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "LastDay", za0016) + err = msgp.WrapError(err, "LastDay", za0014) return } - z.LastDay[za0016] = za0017 + z.LastDay[za0014] = za0015 } zb0001Mask |= 0x10 case "active": - var zb0012 uint32 - zb0012, err = dc.ReadArrayHeader() + var zb0011 uint32 + zb0011, err = dc.ReadArrayHeader() if err != nil { err = msgp.WrapError(err, "ActivePaths") return } - if cap(z.ActivePaths) >= int(zb0012) { - z.ActivePaths = (z.ActivePaths)[:zb0012] + if cap(z.ActivePaths) >= int(zb0011) { + z.ActivePaths = (z.ActivePaths)[:zb0011] } else { - z.ActivePaths = make([]string, zb0012) + z.ActivePaths = make([]string, zb0011) } - for za0018 := range z.ActivePaths { - z.ActivePaths[za0018], err = dc.ReadString() + for za0016 := range z.ActivePaths { + z.ActivePaths[za0016], err = dc.ReadString() if err != nil { - err = msgp.WrapError(err, "ActivePaths", za0018) + err = msgp.WrapError(err, "ActivePaths", za0016) return } } zb0001Mask |= 0x20 case "excessive": - var zb0013 uint32 - zb0013, err = dc.ReadArrayHeader() + var zb0012 uint32 + zb0012, err = dc.ReadArrayHeader() if err != nil { err = msgp.WrapError(err, "ExcessivePrefixes") return } - if cap(z.ExcessivePrefixes) >= int(zb0013) { - z.ExcessivePrefixes = (z.ExcessivePrefixes)[:zb0013] + if cap(z.ExcessivePrefixes) >= int(zb0012) { + z.ExcessivePrefixes = (z.ExcessivePrefixes)[:zb0012] } else { - z.ExcessivePrefixes = make([]string, zb0013) + z.ExcessivePrefixes = make([]string, zb0012) } - for za0019 := range z.ExcessivePrefixes { - z.ExcessivePrefixes[za0019], err = dc.ReadString() + for za0017 := range z.ExcessivePrefixes { + z.ExcessivePrefixes[za0017], err = dc.ReadString() if err != nil { - err = msgp.WrapError(err, "ExcessivePrefixes", za0019) + err = msgp.WrapError(err, "ExcessivePrefixes", za0017) return } } zb0001Mask |= 0x40 case "excessive_versions": - var zb0014 uint32 - zb0014, err = dc.ReadArrayHeader() + var zb0013 uint32 + zb0013, err = dc.ReadArrayHeader() if err != nil { err = msgp.WrapError(err, "ExcessiveVersionObjects") return } - if cap(z.ExcessiveVersionObjects) >= int(zb0014) { - z.ExcessiveVersionObjects = (z.ExcessiveVersionObjects)[:zb0014] + if cap(z.ExcessiveVersionObjects) >= int(zb0013) { + z.ExcessiveVersionObjects = (z.ExcessiveVersionObjects)[:zb0013] } else { - z.ExcessiveVersionObjects = make([]string, zb0014) + z.ExcessiveVersionObjects = make([]string, zb0013) } - for za0020 := range z.ExcessiveVersionObjects { - z.ExcessiveVersionObjects[za0020], err = dc.ReadString() + for za0018 := range z.ExcessiveVersionObjects { + z.ExcessiveVersionObjects[za0018], err = dc.ReadString() if err != nil { - err = msgp.WrapError(err, "ExcessiveVersionObjects", za0020) + err = msgp.WrapError(err, "ExcessiveVersionObjects", za0018) return } } @@ -33638,21 +33893,21 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { return } case "queued_for_expiry": - var zb0015 uint32 - zb0015, err = dc.ReadArrayHeader() + var zb0014 uint32 + zb0014, err = dc.ReadArrayHeader() if err != nil { err = msgp.WrapError(err, "QueuedForExpiry") return } - if cap(z.QueuedForExpiry) >= int(zb0015) { - z.QueuedForExpiry = (z.QueuedForExpiry)[:zb0015] + if cap(z.QueuedForExpiry) >= int(zb0014) { + z.QueuedForExpiry = (z.QueuedForExpiry)[:zb0014] } else { - z.QueuedForExpiry = make([]ExpiryObject, zb0015) + z.QueuedForExpiry = make([]ExpiryObject, zb0014) } - for za0021 := range z.QueuedForExpiry { - err = z.QueuedForExpiry[za0021].DecodeMsg(dc) + for za0019 := range z.QueuedForExpiry { + err = z.QueuedForExpiry[za0019].DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "QueuedForExpiry", za0021) + err = msgp.WrapError(err, "QueuedForExpiry", za0019) return } } @@ -33862,8 +34117,8 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { } } if (zb0001Mask & 0x20) == 0 { // if not omitted - // write "bucket_ilm_ops" - err = en.Append(0xae, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x6c, 0x6d, 0x5f, 0x6f, 0x70, 0x73) + // write "bucket_ilm_stats" + err = en.Append(0xb0, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x6c, 0x6d, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x73) if err != nil { return } @@ -33878,20 +34133,15 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "BucketLifeTimeILM") return } - err = en.WriteMapHeader(uint32(len(za0009))) - if err != nil { - err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) - return - } - for za0010, za0011 := range za0009 { - err = en.WriteString(za0010) + if za0009 == nil { + err = en.WriteNil() if err != nil { - err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) return } - err = en.WriteUint64(za0011) + } else { + err = za0009.EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "BucketLifeTimeILM", za0008, za0010) + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) return } } @@ -33933,15 +34183,15 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "LastMinute", "Actions") return } - for za0012, za0013 := range z.LastMinute.Actions { - err = en.WriteString(za0012) + for za0010, za0011 := range z.LastMinute.Actions { + err = en.WriteString(za0010) if err != nil { err = msgp.WrapError(err, "LastMinute", "Actions") return } - err = za0013.EncodeMsg(en) + err = za0011.EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "LastMinute", "Actions", za0012) + err = msgp.WrapError(err, "LastMinute", "Actions", za0010) return } } @@ -33957,15 +34207,15 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "LastMinute", "ILM") return } - for za0014, za0015 := range z.LastMinute.ILM { - err = en.WriteString(za0014) + for za0012, za0013 := range z.LastMinute.ILM { + err = en.WriteString(za0012) if err != nil { err = msgp.WrapError(err, "LastMinute", "ILM") return } - err = za0015.EncodeMsg(en) + err = za0013.EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "LastMinute", "ILM", za0014) + err = msgp.WrapError(err, "LastMinute", "ILM", za0012) return } } @@ -33982,15 +34232,15 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "LastDay") return } - for za0016, za0017 := range z.LastDay { - err = en.WriteString(za0016) + for za0014, za0015 := range z.LastDay { + err = en.WriteString(za0014) if err != nil { err = msgp.WrapError(err, "LastDay") return } - err = (*Segmented[TimedAction, *TimedAction])(&za0017).EncodeMsg(en) + err = (*Segmented[TimedAction, *TimedAction])(&za0015).EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "LastDay", za0016) + err = msgp.WrapError(err, "LastDay", za0014) return } } @@ -34006,10 +34256,10 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "ActivePaths") return } - for za0018 := range z.ActivePaths { - err = en.WriteString(z.ActivePaths[za0018]) + for za0016 := range z.ActivePaths { + err = en.WriteString(z.ActivePaths[za0016]) if err != nil { - err = msgp.WrapError(err, "ActivePaths", za0018) + err = msgp.WrapError(err, "ActivePaths", za0016) return } } @@ -34025,10 +34275,10 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "ExcessivePrefixes") return } - for za0019 := range z.ExcessivePrefixes { - err = en.WriteString(z.ExcessivePrefixes[za0019]) + for za0017 := range z.ExcessivePrefixes { + err = en.WriteString(z.ExcessivePrefixes[za0017]) if err != nil { - err = msgp.WrapError(err, "ExcessivePrefixes", za0019) + err = msgp.WrapError(err, "ExcessivePrefixes", za0017) return } } @@ -34044,10 +34294,10 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "ExcessiveVersionObjects") return } - for za0020 := range z.ExcessiveVersionObjects { - err = en.WriteString(z.ExcessiveVersionObjects[za0020]) + for za0018 := range z.ExcessiveVersionObjects { + err = en.WriteString(z.ExcessiveVersionObjects[za0018]) if err != nil { - err = msgp.WrapError(err, "ExcessiveVersionObjects", za0020) + err = msgp.WrapError(err, "ExcessiveVersionObjects", za0018) return } } @@ -34097,10 +34347,10 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { err = msgp.WrapError(err, "QueuedForExpiry") return } - for za0021 := range z.QueuedForExpiry { - err = z.QueuedForExpiry[za0021].EncodeMsg(en) + for za0019 := range z.QueuedForExpiry { + err = z.QueuedForExpiry[za0019].EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "QueuedForExpiry", za0021) + err = msgp.WrapError(err, "QueuedForExpiry", za0019) return } } @@ -34206,15 +34456,19 @@ func (z *ScannerMetrics) MarshalMsg(b []byte) (o []byte, err error) { } } if (zb0001Mask & 0x20) == 0 { // if not omitted - // string "bucket_ilm_ops" - o = append(o, 0xae, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x6c, 0x6d, 0x5f, 0x6f, 0x70, 0x73) + // string "bucket_ilm_stats" + o = append(o, 0xb0, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x6c, 0x6d, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x73) o = msgp.AppendMapHeader(o, uint32(len(z.BucketLifeTimeILM))) for za0008, za0009 := range z.BucketLifeTimeILM { o = msgp.AppendString(o, za0008) - o = msgp.AppendMapHeader(o, uint32(len(za0009))) - for za0010, za0011 := range za0009 { - o = msgp.AppendString(o, za0010) - o = msgp.AppendUint64(o, za0011) + if za0009 == nil { + o = msgp.AppendNil(o) + } else { + o, err = za0009.MarshalMsg(o) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) + return + } } } } @@ -34241,11 +34495,11 @@ func (z *ScannerMetrics) MarshalMsg(b []byte) (o []byte, err error) { // string "actions" o = append(o, 0xa7, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73) o = msgp.AppendMapHeader(o, uint32(len(z.LastMinute.Actions))) - for za0012, za0013 := range z.LastMinute.Actions { - o = msgp.AppendString(o, za0012) - o, err = za0013.MarshalMsg(o) + for za0010, za0011 := range z.LastMinute.Actions { + o = msgp.AppendString(o, za0010) + o, err = za0011.MarshalMsg(o) if err != nil { - err = msgp.WrapError(err, "LastMinute", "Actions", za0012) + err = msgp.WrapError(err, "LastMinute", "Actions", za0010) return } } @@ -34254,11 +34508,11 @@ func (z *ScannerMetrics) MarshalMsg(b []byte) (o []byte, err error) { // string "ilm" o = append(o, 0xa3, 0x69, 0x6c, 0x6d) o = msgp.AppendMapHeader(o, uint32(len(z.LastMinute.ILM))) - for za0014, za0015 := range z.LastMinute.ILM { - o = msgp.AppendString(o, za0014) - o, err = za0015.MarshalMsg(o) + for za0012, za0013 := range z.LastMinute.ILM { + o = msgp.AppendString(o, za0012) + o, err = za0013.MarshalMsg(o) if err != nil { - err = msgp.WrapError(err, "LastMinute", "ILM", za0014) + err = msgp.WrapError(err, "LastMinute", "ILM", za0012) return } } @@ -34268,11 +34522,11 @@ func (z *ScannerMetrics) MarshalMsg(b []byte) (o []byte, err error) { // string "last_day" o = append(o, 0xa8, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x64, 0x61, 0x79) o = msgp.AppendMapHeader(o, uint32(len(z.LastDay))) - for za0016, za0017 := range z.LastDay { - o = msgp.AppendString(o, za0016) - o, err = (*Segmented[TimedAction, *TimedAction])(&za0017).MarshalMsg(o) + for za0014, za0015 := range z.LastDay { + o = msgp.AppendString(o, za0014) + o, err = (*Segmented[TimedAction, *TimedAction])(&za0015).MarshalMsg(o) if err != nil { - err = msgp.WrapError(err, "LastDay", za0016) + err = msgp.WrapError(err, "LastDay", za0014) return } } @@ -34281,24 +34535,24 @@ func (z *ScannerMetrics) MarshalMsg(b []byte) (o []byte, err error) { // string "active" o = append(o, 0xa6, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65) o = msgp.AppendArrayHeader(o, uint32(len(z.ActivePaths))) - for za0018 := range z.ActivePaths { - o = msgp.AppendString(o, z.ActivePaths[za0018]) + for za0016 := range z.ActivePaths { + o = msgp.AppendString(o, z.ActivePaths[za0016]) } } if (zb0001Mask & 0x200) == 0 { // if not omitted // string "excessive" o = append(o, 0xa9, 0x65, 0x78, 0x63, 0x65, 0x73, 0x73, 0x69, 0x76, 0x65) o = msgp.AppendArrayHeader(o, uint32(len(z.ExcessivePrefixes))) - for za0019 := range z.ExcessivePrefixes { - o = msgp.AppendString(o, z.ExcessivePrefixes[za0019]) + for za0017 := range z.ExcessivePrefixes { + o = msgp.AppendString(o, z.ExcessivePrefixes[za0017]) } } if (zb0001Mask & 0x400) == 0 { // if not omitted // string "excessive_versions" o = append(o, 0xb2, 0x65, 0x78, 0x63, 0x65, 0x73, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73) o = msgp.AppendArrayHeader(o, uint32(len(z.ExcessiveVersionObjects))) - for za0020 := range z.ExcessiveVersionObjects { - o = msgp.AppendString(o, z.ExcessiveVersionObjects[za0020]) + for za0018 := range z.ExcessiveVersionObjects { + o = msgp.AppendString(o, z.ExcessiveVersionObjects[za0018]) } } if (zb0001Mask & 0x800) == 0 { // if not omitted @@ -34322,10 +34576,10 @@ func (z *ScannerMetrics) MarshalMsg(b []byte) (o []byte, err error) { // string "queued_for_expiry" o = append(o, 0xb1, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79) o = msgp.AppendArrayHeader(o, uint32(len(z.QueuedForExpiry))) - for za0021 := range z.QueuedForExpiry { - o, err = z.QueuedForExpiry[za0021].MarshalMsg(o) + for za0019 := range z.QueuedForExpiry { + o, err = z.QueuedForExpiry[za0019].MarshalMsg(o) if err != nil { - err = msgp.WrapError(err, "QueuedForExpiry", za0021) + err = msgp.WrapError(err, "QueuedForExpiry", za0019) return } } @@ -34466,7 +34720,7 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { z.LifeTimeILM[za0006] = za0007 } zb0001Mask |= 0x4 - case "bucket_ilm_ops": + case "bucket_ilm_stats": var zb0006 uint32 zb0006, bts, err = msgp.ReadMapHeaderBytes(bts) if err != nil { @@ -34474,12 +34728,12 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { return } if z.BucketLifeTimeILM == nil { - z.BucketLifeTimeILM = make(map[string]map[string]uint64, zb0006) + z.BucketLifeTimeILM = make(map[string]*BucketILMStats, zb0006) } else if len(z.BucketLifeTimeILM) > 0 { clear(z.BucketLifeTimeILM) } for zb0006 > 0 { - var za0009 map[string]uint64 + var za0009 *BucketILMStats zb0006-- var za0008 string za0008, bts, err = msgp.ReadStringBytes(bts) @@ -34487,47 +34741,36 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { err = msgp.WrapError(err, "BucketLifeTimeILM") return } - var zb0007 uint32 - zb0007, bts, err = msgp.ReadMapHeaderBytes(bts) - if err != nil { - err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) - return - } - if za0009 == nil { - za0009 = make(map[string]uint64, zb0007) - } else if len(za0009) > 0 { - clear(za0009) - } - for zb0007 > 0 { - var za0011 uint64 - zb0007-- - var za0010 string - za0010, bts, err = msgp.ReadStringBytes(bts) + if msgp.IsNil(bts) { + bts, err = msgp.ReadNilBytes(bts) if err != nil { - err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) return } - za0011, bts, err = msgp.ReadUint64Bytes(bts) + za0009 = nil + } else { + if za0009 == nil { + za0009 = new(BucketILMStats) + } + bts, err = za0009.UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "BucketLifeTimeILM", za0008, za0010) + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) return } - za0009[za0010] = za0011 } z.BucketLifeTimeILM[za0008] = za0009 } zb0001Mask |= 0x8 case "last_minute": - var zb0008 uint32 - zb0008, bts, err = msgp.ReadMapHeaderBytes(bts) + var zb0007 uint32 + zb0007, bts, err = msgp.ReadMapHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "LastMinute") return } - var zb0008Mask uint8 /* 2 bits */ - _ = zb0008Mask - for zb0008 > 0 { - zb0008-- + var zb0007Mask uint8 /* 2 bits */ + _ = zb0007Mask + for zb0007 > 0 { + zb0007-- field, bts, err = msgp.ReadMapKeyZC(bts) if err != nil { err = msgp.WrapError(err, "LastMinute") @@ -34535,63 +34778,63 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { } switch msgp.UnsafeString(field) { case "actions": - var zb0009 uint32 - zb0009, bts, err = msgp.ReadMapHeaderBytes(bts) + var zb0008 uint32 + zb0008, bts, err = msgp.ReadMapHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "LastMinute", "Actions") return } if z.LastMinute.Actions == nil { - z.LastMinute.Actions = make(map[string]TimedAction, zb0009) + z.LastMinute.Actions = make(map[string]TimedAction, zb0008) } else if len(z.LastMinute.Actions) > 0 { clear(z.LastMinute.Actions) } - for zb0009 > 0 { - var za0013 TimedAction - zb0009-- - var za0012 string - za0012, bts, err = msgp.ReadStringBytes(bts) + for zb0008 > 0 { + var za0011 TimedAction + zb0008-- + var za0010 string + za0010, bts, err = msgp.ReadStringBytes(bts) if err != nil { err = msgp.WrapError(err, "LastMinute", "Actions") return } - bts, err = za0013.UnmarshalMsg(bts) + bts, err = za0011.UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "LastMinute", "Actions", za0012) + err = msgp.WrapError(err, "LastMinute", "Actions", za0010) return } - z.LastMinute.Actions[za0012] = za0013 + z.LastMinute.Actions[za0010] = za0011 } - zb0008Mask |= 0x1 + zb0007Mask |= 0x1 case "ilm": - var zb0010 uint32 - zb0010, bts, err = msgp.ReadMapHeaderBytes(bts) + var zb0009 uint32 + zb0009, bts, err = msgp.ReadMapHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "LastMinute", "ILM") return } if z.LastMinute.ILM == nil { - z.LastMinute.ILM = make(map[string]TimedAction, zb0010) + z.LastMinute.ILM = make(map[string]TimedAction, zb0009) } else if len(z.LastMinute.ILM) > 0 { clear(z.LastMinute.ILM) } - for zb0010 > 0 { - var za0015 TimedAction - zb0010-- - var za0014 string - za0014, bts, err = msgp.ReadStringBytes(bts) + for zb0009 > 0 { + var za0013 TimedAction + zb0009-- + var za0012 string + za0012, bts, err = msgp.ReadStringBytes(bts) if err != nil { err = msgp.WrapError(err, "LastMinute", "ILM") return } - bts, err = za0015.UnmarshalMsg(bts) + bts, err = za0013.UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "LastMinute", "ILM", za0014) + err = msgp.WrapError(err, "LastMinute", "ILM", za0012) return } - z.LastMinute.ILM[za0014] = za0015 + z.LastMinute.ILM[za0012] = za0013 } - zb0008Mask |= 0x2 + zb0007Mask |= 0x2 default: bts, err = msgp.Skip(bts) if err != nil { @@ -34601,99 +34844,99 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { } } // Clear omitted fields. - if zb0008Mask != 0x3 { - if (zb0008Mask & 0x1) == 0 { + if zb0007Mask != 0x3 { + if (zb0007Mask & 0x1) == 0 { z.LastMinute.Actions = nil } - if (zb0008Mask & 0x2) == 0 { + if (zb0007Mask & 0x2) == 0 { z.LastMinute.ILM = nil } } case "last_day": - var zb0011 uint32 - zb0011, bts, err = msgp.ReadMapHeaderBytes(bts) + var zb0010 uint32 + zb0010, bts, err = msgp.ReadMapHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "LastDay") return } if z.LastDay == nil { - z.LastDay = make(map[string]SegmentedActions, zb0011) + z.LastDay = make(map[string]SegmentedActions, zb0010) } else if len(z.LastDay) > 0 { clear(z.LastDay) } - for zb0011 > 0 { - var za0017 SegmentedActions - zb0011-- - var za0016 string - za0016, bts, err = msgp.ReadStringBytes(bts) + for zb0010 > 0 { + var za0015 SegmentedActions + zb0010-- + var za0014 string + za0014, bts, err = msgp.ReadStringBytes(bts) if err != nil { err = msgp.WrapError(err, "LastDay") return } - bts, err = (*Segmented[TimedAction, *TimedAction])(&za0017).UnmarshalMsg(bts) + bts, err = (*Segmented[TimedAction, *TimedAction])(&za0015).UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "LastDay", za0016) + err = msgp.WrapError(err, "LastDay", za0014) return } - z.LastDay[za0016] = za0017 + z.LastDay[za0014] = za0015 } zb0001Mask |= 0x10 case "active": - var zb0012 uint32 - zb0012, bts, err = msgp.ReadArrayHeaderBytes(bts) + var zb0011 uint32 + zb0011, bts, err = msgp.ReadArrayHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "ActivePaths") return } - if cap(z.ActivePaths) >= int(zb0012) { - z.ActivePaths = (z.ActivePaths)[:zb0012] + if cap(z.ActivePaths) >= int(zb0011) { + z.ActivePaths = (z.ActivePaths)[:zb0011] } else { - z.ActivePaths = make([]string, zb0012) + z.ActivePaths = make([]string, zb0011) } - for za0018 := range z.ActivePaths { - z.ActivePaths[za0018], bts, err = msgp.ReadStringBytes(bts) + for za0016 := range z.ActivePaths { + z.ActivePaths[za0016], bts, err = msgp.ReadStringBytes(bts) if err != nil { - err = msgp.WrapError(err, "ActivePaths", za0018) + err = msgp.WrapError(err, "ActivePaths", za0016) return } } zb0001Mask |= 0x20 case "excessive": - var zb0013 uint32 - zb0013, bts, err = msgp.ReadArrayHeaderBytes(bts) + var zb0012 uint32 + zb0012, bts, err = msgp.ReadArrayHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "ExcessivePrefixes") return } - if cap(z.ExcessivePrefixes) >= int(zb0013) { - z.ExcessivePrefixes = (z.ExcessivePrefixes)[:zb0013] + if cap(z.ExcessivePrefixes) >= int(zb0012) { + z.ExcessivePrefixes = (z.ExcessivePrefixes)[:zb0012] } else { - z.ExcessivePrefixes = make([]string, zb0013) + z.ExcessivePrefixes = make([]string, zb0012) } - for za0019 := range z.ExcessivePrefixes { - z.ExcessivePrefixes[za0019], bts, err = msgp.ReadStringBytes(bts) + for za0017 := range z.ExcessivePrefixes { + z.ExcessivePrefixes[za0017], bts, err = msgp.ReadStringBytes(bts) if err != nil { - err = msgp.WrapError(err, "ExcessivePrefixes", za0019) + err = msgp.WrapError(err, "ExcessivePrefixes", za0017) return } } zb0001Mask |= 0x40 case "excessive_versions": - var zb0014 uint32 - zb0014, bts, err = msgp.ReadArrayHeaderBytes(bts) + var zb0013 uint32 + zb0013, bts, err = msgp.ReadArrayHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "ExcessiveVersionObjects") return } - if cap(z.ExcessiveVersionObjects) >= int(zb0014) { - z.ExcessiveVersionObjects = (z.ExcessiveVersionObjects)[:zb0014] + if cap(z.ExcessiveVersionObjects) >= int(zb0013) { + z.ExcessiveVersionObjects = (z.ExcessiveVersionObjects)[:zb0013] } else { - z.ExcessiveVersionObjects = make([]string, zb0014) + z.ExcessiveVersionObjects = make([]string, zb0013) } - for za0020 := range z.ExcessiveVersionObjects { - z.ExcessiveVersionObjects[za0020], bts, err = msgp.ReadStringBytes(bts) + for za0018 := range z.ExcessiveVersionObjects { + z.ExcessiveVersionObjects[za0018], bts, err = msgp.ReadStringBytes(bts) if err != nil { - err = msgp.WrapError(err, "ExcessiveVersionObjects", za0020) + err = msgp.WrapError(err, "ExcessiveVersionObjects", za0018) return } } @@ -34719,21 +34962,21 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { return } case "queued_for_expiry": - var zb0015 uint32 - zb0015, bts, err = msgp.ReadArrayHeaderBytes(bts) + var zb0014 uint32 + zb0014, bts, err = msgp.ReadArrayHeaderBytes(bts) if err != nil { err = msgp.WrapError(err, "QueuedForExpiry") return } - if cap(z.QueuedForExpiry) >= int(zb0015) { - z.QueuedForExpiry = (z.QueuedForExpiry)[:zb0015] + if cap(z.QueuedForExpiry) >= int(zb0014) { + z.QueuedForExpiry = (z.QueuedForExpiry)[:zb0014] } else { - z.QueuedForExpiry = make([]ExpiryObject, zb0015) + z.QueuedForExpiry = make([]ExpiryObject, zb0014) } - for za0021 := range z.QueuedForExpiry { - bts, err = z.QueuedForExpiry[za0021].UnmarshalMsg(bts) + for za0019 := range z.QueuedForExpiry { + bts, err = z.QueuedForExpiry[za0019].UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "QueuedForExpiry", za0021) + err = msgp.WrapError(err, "QueuedForExpiry", za0019) return } } @@ -34812,55 +35055,54 @@ func (z *ScannerMetrics) Msgsize() (s int) { s += msgp.StringPrefixSize + len(za0006) + msgp.Uint64Size } } - s += 15 + msgp.MapHeaderSize + s += 17 + msgp.MapHeaderSize if z.BucketLifeTimeILM != nil { for za0008, za0009 := range z.BucketLifeTimeILM { _ = za0009 - s += msgp.StringPrefixSize + len(za0008) + msgp.MapHeaderSize - if za0009 != nil { - for za0010, za0011 := range za0009 { - _ = za0011 - s += msgp.StringPrefixSize + len(za0010) + msgp.Uint64Size - } + s += msgp.StringPrefixSize + len(za0008) + if za0009 == nil { + s += msgp.NilSize + } else { + s += za0009.Msgsize() } } } s += 12 + 1 + 8 + msgp.MapHeaderSize if z.LastMinute.Actions != nil { - for za0012, za0013 := range z.LastMinute.Actions { - _ = za0013 - s += msgp.StringPrefixSize + len(za0012) + za0013.Msgsize() + for za0010, za0011 := range z.LastMinute.Actions { + _ = za0011 + s += msgp.StringPrefixSize + len(za0010) + za0011.Msgsize() } } s += 4 + msgp.MapHeaderSize if z.LastMinute.ILM != nil { - for za0014, za0015 := range z.LastMinute.ILM { - _ = za0015 - s += msgp.StringPrefixSize + len(za0014) + za0015.Msgsize() + for za0012, za0013 := range z.LastMinute.ILM { + _ = za0013 + s += msgp.StringPrefixSize + len(za0012) + za0013.Msgsize() } } s += 9 + msgp.MapHeaderSize if z.LastDay != nil { - for za0016, za0017 := range z.LastDay { - _ = za0017 - s += msgp.StringPrefixSize + len(za0016) + (*Segmented[TimedAction, *TimedAction])(&za0017).Msgsize() + for za0014, za0015 := range z.LastDay { + _ = za0015 + s += msgp.StringPrefixSize + len(za0014) + (*Segmented[TimedAction, *TimedAction])(&za0015).Msgsize() } } s += 7 + msgp.ArrayHeaderSize - for za0018 := range z.ActivePaths { - s += msgp.StringPrefixSize + len(z.ActivePaths[za0018]) + for za0016 := range z.ActivePaths { + s += msgp.StringPrefixSize + len(z.ActivePaths[za0016]) } s += 10 + msgp.ArrayHeaderSize - for za0019 := range z.ExcessivePrefixes { - s += msgp.StringPrefixSize + len(z.ExcessivePrefixes[za0019]) + for za0017 := range z.ExcessivePrefixes { + s += msgp.StringPrefixSize + len(z.ExcessivePrefixes[za0017]) } s += 19 + msgp.ArrayHeaderSize - for za0020 := range z.ExcessiveVersionObjects { - s += msgp.StringPrefixSize + len(z.ExcessiveVersionObjects[za0020]) + for za0018 := range z.ExcessiveVersionObjects { + s += msgp.StringPrefixSize + len(z.ExcessiveVersionObjects[za0018]) } s += 25 + msgp.Uint64Size + 25 + msgp.IntSize + 25 + z.ILMExpiryTasksServiced.Msgsize() + 18 + msgp.ArrayHeaderSize - for za0021 := range z.QueuedForExpiry { - s += z.QueuedForExpiry[za0021].Msgsize() + for za0019 := range z.QueuedForExpiry { + s += z.QueuedForExpiry[za0019].Msgsize() } return } diff --git a/metrics_gen_test.go b/metrics_gen_test.go index 23cddb2d..73c8efc4 100644 --- a/metrics_gen_test.go +++ b/metrics_gen_test.go @@ -461,6 +461,119 @@ func BenchmarkDecodeBucketAPIMetrics(b *testing.B) { } } +func TestMarshalUnmarshalBucketILMStats(t *testing.T) { + v := BucketILMStats{} + bts, err := v.MarshalMsg(nil) + if err != nil { + t.Fatal(err) + } + left, err := v.UnmarshalMsg(bts) + if err != nil { + t.Fatal(err) + } + if len(left) > 0 { + t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) + } + + left, err = msgp.Skip(bts) + if err != nil { + t.Fatal(err) + } + if len(left) > 0 { + t.Errorf("%d bytes left over after Skip(): %q", len(left), left) + } +} + +func BenchmarkMarshalMsgBucketILMStats(b *testing.B) { + v := BucketILMStats{} + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + v.MarshalMsg(nil) + } +} + +func BenchmarkAppendMsgBucketILMStats(b *testing.B) { + v := BucketILMStats{} + bts := make([]byte, 0, v.Msgsize()) + bts, _ = v.MarshalMsg(bts[0:0]) + b.SetBytes(int64(len(bts))) + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + bts, _ = v.MarshalMsg(bts[0:0]) + } +} + +func BenchmarkUnmarshalBucketILMStats(b *testing.B) { + v := BucketILMStats{} + bts, _ := v.MarshalMsg(nil) + b.ReportAllocs() + b.SetBytes(int64(len(bts))) + b.ResetTimer() + for i := 0; i < b.N; i++ { + _, err := v.UnmarshalMsg(bts) + if err != nil { + b.Fatal(err) + } + } +} + +func TestEncodeDecodeBucketILMStats(t *testing.T) { + v := BucketILMStats{} + var buf bytes.Buffer + msgp.Encode(&buf, &v) + + m := v.Msgsize() + if buf.Len() > m { + t.Log("WARNING: TestEncodeDecodeBucketILMStats Msgsize() is inaccurate") + } + + vn := BucketILMStats{} + err := msgp.Decode(&buf, &vn) + if err != nil { + t.Error(err) + } + + buf.Reset() + msgp.Encode(&buf, &v) + err = msgp.NewReader(&buf).Skip() + if err != nil { + t.Error(err) + } +} + +func BenchmarkEncodeBucketILMStats(b *testing.B) { + v := BucketILMStats{} + var buf bytes.Buffer + msgp.Encode(&buf, &v) + b.SetBytes(int64(buf.Len())) + en := msgp.NewWriter(msgp.Nowhere) + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + v.EncodeMsg(en) + } + en.Flush() +} + +func BenchmarkDecodeBucketILMStats(b *testing.B) { + v := BucketILMStats{} + var buf bytes.Buffer + msgp.Encode(&buf, &v) + b.SetBytes(int64(buf.Len())) + rd := msgp.NewEndlessReader(buf.Bytes(), b) + dc := msgp.NewReader(rd) + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + err := v.DecodeMsg(dc) + if err != nil { + b.Fatal(err) + } + } +} + func TestMarshalUnmarshalBucketMetrics(t *testing.T) { v := BucketMetrics{} bts, err := v.MarshalMsg(nil) diff --git a/metrics_test.go b/metrics_test.go index 3aa879c9..c43263c8 100644 --- a/metrics_test.go +++ b/metrics_test.go @@ -192,18 +192,18 @@ func TestScannerMetricsMerge(t *testing.T) { { name: "merge bucket lifetime ILM same bucket same action summed", base: &ScannerMetrics{ - BucketLifeTimeILM: map[string]map[string]uint64{ - "bucket-a": {"DeleteAction": 100, "TransitionAction": 50}, + BucketLifeTimeILM: map[string]*BucketILMStats{ + "bucket-a": {Bucket: "bucket-a", ActionCounters: map[string]uint64{"DeleteAction": 100, "TransitionAction": 50}}, }, }, other: &ScannerMetrics{ - BucketLifeTimeILM: map[string]map[string]uint64{ - "bucket-a": {"DeleteAction": 200, "TransitionAction": 25}, + BucketLifeTimeILM: map[string]*BucketILMStats{ + "bucket-a": {Bucket: "bucket-a", ActionCounters: map[string]uint64{"DeleteAction": 200, "TransitionAction": 25}}, }, }, verify: func(t *testing.T, result *ScannerMetrics) { - expected := map[string]map[string]uint64{ - "bucket-a": {"DeleteAction": 300, "TransitionAction": 75}, + expected := map[string]*BucketILMStats{ + "bucket-a": {Bucket: "bucket-a", ActionCounters: map[string]uint64{"DeleteAction": 300, "TransitionAction": 75}}, } if !reflect.DeepEqual(result.BucketLifeTimeILM, expected) { t.Errorf("BucketLifeTimeILM = %v, want %v", result.BucketLifeTimeILM, expected) @@ -213,40 +213,40 @@ func TestScannerMetricsMerge(t *testing.T) { { name: "merge bucket lifetime ILM different buckets both appear", base: &ScannerMetrics{ - BucketLifeTimeILM: map[string]map[string]uint64{ - "bucket-a": {"DeleteAction": 10}, + BucketLifeTimeILM: map[string]*BucketILMStats{ + "bucket-a": {Bucket: "bucket-a", ActionCounters: map[string]uint64{"DeleteAction": 10}}, }, }, other: &ScannerMetrics{ - BucketLifeTimeILM: map[string]map[string]uint64{ - "bucket-b": {"TransitionAction": 20}, + BucketLifeTimeILM: map[string]*BucketILMStats{ + "bucket-b": {Bucket: "bucket-b", ActionCounters: map[string]uint64{"TransitionAction": 20}}, }, }, verify: func(t *testing.T, result *ScannerMetrics) { if len(result.BucketLifeTimeILM) != 2 { t.Fatalf("BucketLifeTimeILM len = %d, want 2", len(result.BucketLifeTimeILM)) } - if result.BucketLifeTimeILM["bucket-a"]["DeleteAction"] != 10 { - t.Errorf("bucket-a DeleteAction = %d, want 10", result.BucketLifeTimeILM["bucket-a"]["DeleteAction"]) + if got := result.BucketLifeTimeILM["bucket-a"].ActionCounters["DeleteAction"]; got != 10 { + t.Errorf("bucket-a DeleteAction = %d, want 10", got) } - if result.BucketLifeTimeILM["bucket-b"]["TransitionAction"] != 20 { - t.Errorf("bucket-b TransitionAction = %d, want 20", result.BucketLifeTimeILM["bucket-b"]["TransitionAction"]) + if got := result.BucketLifeTimeILM["bucket-b"].ActionCounters["TransitionAction"]; got != 20 { + t.Errorf("bucket-b TransitionAction = %d, want 20", got) } }, }, { name: "merge bucket lifetime ILM nil on one side does not panic", base: &ScannerMetrics{ - BucketLifeTimeILM: map[string]map[string]uint64{ - "bucket-a": {"DeleteAction": 5}, + BucketLifeTimeILM: map[string]*BucketILMStats{ + "bucket-a": {Bucket: "bucket-a", ActionCounters: map[string]uint64{"DeleteAction": 5}}, }, }, other: &ScannerMetrics{ BucketLifeTimeILM: nil, }, verify: func(t *testing.T, result *ScannerMetrics) { - if result.BucketLifeTimeILM["bucket-a"]["DeleteAction"] != 5 { - t.Errorf("bucket-a DeleteAction = %d, want 5", result.BucketLifeTimeILM["bucket-a"]["DeleteAction"]) + if got := result.BucketLifeTimeILM["bucket-a"].ActionCounters["DeleteAction"]; got != 5 { + t.Errorf("bucket-a DeleteAction = %d, want 5", got) } }, }, @@ -256,13 +256,13 @@ func TestScannerMetricsMerge(t *testing.T) { BucketLifeTimeILM: nil, }, other: &ScannerMetrics{ - BucketLifeTimeILM: map[string]map[string]uint64{ - "bucket-c": {"DeleteVersionAction": 7}, + BucketLifeTimeILM: map[string]*BucketILMStats{ + "bucket-c": {Bucket: "bucket-c", ActionCounters: map[string]uint64{"DeleteVersionAction": 7}}, }, }, verify: func(t *testing.T, result *ScannerMetrics) { - if result.BucketLifeTimeILM["bucket-c"]["DeleteVersionAction"] != 7 { - t.Errorf("bucket-c DeleteVersionAction = %d, want 7", result.BucketLifeTimeILM["bucket-c"]["DeleteVersionAction"]) + if got := result.BucketLifeTimeILM["bucket-c"].ActionCounters["DeleteVersionAction"]; got != 7 { + t.Errorf("bucket-c DeleteVersionAction = %d, want 7", got) } }, },