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 ( diff --git a/metrics.go b/metrics.go index 3f4ce593..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,6 +504,11 @@ type ScannerMetrics struct { // Number of accumulated ILM operations by type since server restart. LifeTimeILM map[string]uint64 `json:"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 { // Scanner actions. @@ -603,6 +636,17 @@ func (s *ScannerMetrics) Merge(other *ScannerMetrics) { total := s.LifeTimeILM[k] + v s.LifeTimeILM[k] = total } + for bucket, otherStats := range other.BucketLifeTimeILM { + if s.BucketLifeTimeILM == nil { + s.BucketLifeTimeILM = make(map[string]*BucketILMStats, len(other.BucketLifeTimeILM)) + } + dst, ok := s.BucketLifeTimeILM[bucket] + if !ok { + dst = &BucketILMStats{Bucket: bucket} + 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 38bbed06..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 @@ -33263,7 +33528,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 +33650,58 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { z.LifeTimeILM[za0006] = za0007 } zb0001Mask |= 0x4 - case "last_minute": + case "bucket_ilm_stats": 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]*BucketILMStats, 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 *BucketILMStats + if dc.IsNil() { + err = dc.ReadNil() + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) + return + } + za0009 = nil + } else { + if za0009 == nil { + za0009 = new(BucketILMStats) + } + err = za0009.DecodeMsg(dc) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) + return + } + } + z.BucketLifeTimeILM[za0008] = za0009 + } + zb0001Mask |= 0x8 + case "last_minute": + var zb0007 uint32 + zb0007, err = dc.ReadMapHeader() + if err != nil { + err = msgp.WrapError(err, "LastMinute") + return + } + var zb0007Mask uint8 /* 2 bits */ + _ = zb0007Mask + for zb0007 > 0 { + zb0007-- field, err = dc.ReadMapKeyPtr() if err != nil { err = msgp.WrapError(err, "LastMinute") @@ -33403,63 +33709,63 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { } switch msgp.UnsafeString(field) { case "actions": - var zb0007 uint32 - zb0007, 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, zb0007) + z.LastMinute.Actions = make(map[string]TimedAction, zb0008) } else if len(z.LastMinute.Actions) > 0 { clear(z.LastMinute.Actions) } - for zb0007 > 0 { - zb0007-- - var za0008 string - za0008, err = dc.ReadString() - if err != nil { - err = msgp.WrapError(err, "LastMinute", "Actions") + for zb0008 > 0 { + zb0008-- + var za0010 string + za0010, err = dc.ReadString() + if err != nil { + err = msgp.WrapError(err, "LastMinute", "Actions") return } - var za0009 TimedAction - err = za0009.DecodeMsg(dc) + var za0011 TimedAction + err = za0011.DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "LastMinute", "Actions", za0008) + err = msgp.WrapError(err, "LastMinute", "Actions", za0010) return } - z.LastMinute.Actions[za0008] = za0009 + z.LastMinute.Actions[za0010] = za0011 } - zb0006Mask |= 0x1 + zb0007Mask |= 0x1 case "ilm": - var zb0008 uint32 - zb0008, 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, zb0008) + z.LastMinute.ILM = make(map[string]TimedAction, zb0009) } else if len(z.LastMinute.ILM) > 0 { clear(z.LastMinute.ILM) } - for zb0008 > 0 { - zb0008-- - var za0010 string - za0010, 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 za0011 TimedAction - err = za0011.DecodeMsg(dc) + var za0013 TimedAction + err = za0013.DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "LastMinute", "ILM", za0010) + err = msgp.WrapError(err, "LastMinute", "ILM", za0012) return } - z.LastMinute.ILM[za0010] = za0011 + z.LastMinute.ILM[za0012] = za0013 } - zb0006Mask |= 0x2 + zb0007Mask |= 0x2 default: err = dc.Skip() if err != nil { @@ -33469,117 +33775,117 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { } } // Clear omitted fields. - if zb0006Mask != 0x3 { - if (zb0006Mask & 0x1) == 0 { + if zb0007Mask != 0x3 { + if (zb0007Mask & 0x1) == 0 { z.LastMinute.Actions = nil } - if (zb0006Mask & 0x2) == 0 { + if (zb0007Mask & 0x2) == 0 { z.LastMinute.ILM = nil } } case "last_day": - var zb0009 uint32 - zb0009, 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, zb0009) + z.LastDay = make(map[string]SegmentedActions, zb0010) } else if len(z.LastDay) > 0 { clear(z.LastDay) } - for zb0009 > 0 { - zb0009-- - var za0012 string - za0012, err = dc.ReadString() + for zb0010 > 0 { + zb0010-- + var za0014 string + za0014, err = dc.ReadString() if err != nil { err = msgp.WrapError(err, "LastDay") return } - var za0013 SegmentedActions - err = (*Segmented[TimedAction, *TimedAction])(&za0013).DecodeMsg(dc) + var za0015 SegmentedActions + err = (*Segmented[TimedAction, *TimedAction])(&za0015).DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "LastDay", za0012) + err = msgp.WrapError(err, "LastDay", za0014) return } - z.LastDay[za0012] = za0013 + z.LastDay[za0014] = za0015 } - zb0001Mask |= 0x8 + zb0001Mask |= 0x10 case "active": - var zb0010 uint32 - zb0010, err = dc.ReadArrayHeader() + var zb0011 uint32 + zb0011, 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(zb0011) { + z.ActivePaths = (z.ActivePaths)[:zb0011] } else { - z.ActivePaths = make([]string, zb0010) + z.ActivePaths = make([]string, zb0011) } - for za0014 := range z.ActivePaths { - z.ActivePaths[za0014], err = dc.ReadString() + for za0016 := range z.ActivePaths { + z.ActivePaths[za0016], err = dc.ReadString() if err != nil { - err = msgp.WrapError(err, "ActivePaths", za0014) + err = msgp.WrapError(err, "ActivePaths", za0016) return } } - zb0001Mask |= 0x10 + zb0001Mask |= 0x20 case "excessive": - var zb0011 uint32 - zb0011, err = dc.ReadArrayHeader() + var zb0012 uint32 + zb0012, 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(zb0012) { + z.ExcessivePrefixes = (z.ExcessivePrefixes)[:zb0012] } else { - z.ExcessivePrefixes = make([]string, zb0011) + z.ExcessivePrefixes = make([]string, zb0012) } - for za0015 := range z.ExcessivePrefixes { - z.ExcessivePrefixes[za0015], err = dc.ReadString() + for za0017 := range z.ExcessivePrefixes { + z.ExcessivePrefixes[za0017], err = dc.ReadString() if err != nil { - err = msgp.WrapError(err, "ExcessivePrefixes", za0015) + err = msgp.WrapError(err, "ExcessivePrefixes", za0017) return } } - zb0001Mask |= 0x20 + zb0001Mask |= 0x40 case "excessive_versions": - var zb0012 uint32 - zb0012, err = dc.ReadArrayHeader() + var zb0013 uint32 + zb0013, 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(zb0013) { + z.ExcessiveVersionObjects = (z.ExcessiveVersionObjects)[:zb0013] } else { - z.ExcessiveVersionObjects = make([]string, zb0012) + z.ExcessiveVersionObjects = make([]string, zb0013) } - for za0016 := range z.ExcessiveVersionObjects { - z.ExcessiveVersionObjects[za0016], err = dc.ReadString() + for za0018 := range z.ExcessiveVersionObjects { + z.ExcessiveVersionObjects[za0018], err = dc.ReadString() if err != nil { - err = msgp.WrapError(err, "ExcessiveVersionObjects", za0016) + err = msgp.WrapError(err, "ExcessiveVersionObjects", za0018) 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 +33893,25 @@ func (z *ScannerMetrics) DecodeMsg(dc *msgp.Reader) (err error) { return } case "queued_for_expiry": - var zb0013 uint32 - zb0013, err = dc.ReadArrayHeader() + var zb0014 uint32 + zb0014, 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(zb0014) { + z.QueuedForExpiry = (z.QueuedForExpiry)[:zb0014] } else { - z.QueuedForExpiry = make([]ExpiryObject, zb0013) + z.QueuedForExpiry = make([]ExpiryObject, zb0014) } - for za0017 := range z.QueuedForExpiry { - err = z.QueuedForExpiry[za0017].DecodeMsg(dc) + for za0019 := range z.QueuedForExpiry { + err = z.QueuedForExpiry[za0019].DecodeMsg(dc) if err != nil { - err = msgp.WrapError(err, "QueuedForExpiry", za0017) + err = msgp.WrapError(err, "QueuedForExpiry", za0019) return } } - zb0001Mask |= 0x200 + zb0001Mask |= 0x400 default: err = dc.Skip() if err != nil { @@ -33615,7 +33921,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 +33932,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 +33962,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 +33977,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 +34116,37 @@ func (z *ScannerMetrics) EncodeMsg(en *msgp.Writer) (err error) { } } } + if (zb0001Mask & 0x20) == 0 { // if not omitted + // 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 + } + 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 + } + if za0009 == nil { + err = en.WriteNil() + if err != nil { + return + } + } else { + err = za0009.EncodeMsg(en) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) + return + } + } + } + } // write "last_minute" err = en.Append(0xab, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65) if err != nil { @@ -33839,15 +34183,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 za0010, za0011 := range z.LastMinute.Actions { + err = en.WriteString(za0010) if err != nil { err = msgp.WrapError(err, "LastMinute", "Actions") return } - err = za0009.EncodeMsg(en) + err = za0011.EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "LastMinute", "Actions", za0008) + err = msgp.WrapError(err, "LastMinute", "Actions", za0010) return } } @@ -33863,21 +34207,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 za0012, za0013 := range z.LastMinute.ILM { + err = en.WriteString(za0012) if err != nil { err = msgp.WrapError(err, "LastMinute", "ILM") return } - err = za0011.EncodeMsg(en) + err = za0013.EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "LastMinute", "ILM", za0010) + err = msgp.WrapError(err, "LastMinute", "ILM", za0012) 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 +34232,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 za0014, za0015 := range z.LastDay { + err = en.WriteString(za0014) if err != nil { err = msgp.WrapError(err, "LastDay") return } - err = (*Segmented[TimedAction, *TimedAction])(&za0013).EncodeMsg(en) + err = (*Segmented[TimedAction, *TimedAction])(&za0015).EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "LastDay", za0012) + err = msgp.WrapError(err, "LastDay", za0014) 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 +34256,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 za0016 := range z.ActivePaths { + err = en.WriteString(z.ActivePaths[za0016]) if err != nil { - err = msgp.WrapError(err, "ActivePaths", za0014) + err = msgp.WrapError(err, "ActivePaths", za0016) 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 +34275,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 za0017 := range z.ExcessivePrefixes { + err = en.WriteString(z.ExcessivePrefixes[za0017]) if err != nil { - err = msgp.WrapError(err, "ExcessivePrefixes", za0015) + err = msgp.WrapError(err, "ExcessivePrefixes", za0017) 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 +34294,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 za0018 := range z.ExcessiveVersionObjects { + err = en.WriteString(z.ExcessiveVersionObjects[za0018]) if err != nil { - err = msgp.WrapError(err, "ExcessiveVersionObjects", za0016) + err = msgp.WrapError(err, "ExcessiveVersionObjects", za0018) 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 +34314,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 +34336,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 +34347,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 za0019 := range z.QueuedForExpiry { + err = z.QueuedForExpiry[za0019].EncodeMsg(en) if err != nil { - err = msgp.WrapError(err, "QueuedForExpiry", za0017) + err = msgp.WrapError(err, "QueuedForExpiry", za0019) return } } @@ -34019,8 +34363,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 +34378,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 +34455,23 @@ 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_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) + if za0009 == nil { + o = msgp.AppendNil(o) + } else { + o, err = za0009.MarshalMsg(o) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) + return + } + } + } + } // string "last_minute" o = append(o, 0xab, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65) // check for omitted fields @@ -34130,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 za0008, za0009 := range z.LastMinute.Actions { - o = msgp.AppendString(o, za0008) - o, err = za0009.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", za0008) + err = msgp.WrapError(err, "LastMinute", "Actions", za0010) return } } @@ -34143,59 +34508,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 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", za0010) + err = msgp.WrapError(err, "LastMinute", "ILM", za0012) 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 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", za0012) + err = msgp.WrapError(err, "LastDay", za0014) 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 za0016 := range z.ActivePaths { + o = msgp.AppendString(o, z.ActivePaths[za0016]) } } - 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 za0017 := range z.ExcessivePrefixes { + o = msgp.AppendString(o, z.ExcessivePrefixes[za0017]) } } - 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 za0018 := range z.ExcessiveVersionObjects { + o = msgp.AppendString(o, z.ExcessiveVersionObjects[za0018]) } } - 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 +34572,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 za0019 := range z.QueuedForExpiry { + o, err = z.QueuedForExpiry[za0019].MarshalMsg(o) if err != nil { - err = msgp.WrapError(err, "QueuedForExpiry", za0017) + err = msgp.WrapError(err, "QueuedForExpiry", za0019) return } } @@ -34233,7 +34598,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 +34720,57 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { z.LifeTimeILM[za0006] = za0007 } zb0001Mask |= 0x4 - case "last_minute": + case "bucket_ilm_stats": 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]*BucketILMStats, zb0006) + } else if len(z.BucketLifeTimeILM) > 0 { + clear(z.BucketLifeTimeILM) + } for zb0006 > 0 { + var za0009 *BucketILMStats zb0006-- + var za0008 string + za0008, bts, err = msgp.ReadStringBytes(bts) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM") + return + } + if msgp.IsNil(bts) { + bts, err = msgp.ReadNilBytes(bts) + if err != nil { + return + } + za0009 = nil + } else { + if za0009 == nil { + za0009 = new(BucketILMStats) + } + bts, err = za0009.UnmarshalMsg(bts) + if err != nil { + err = msgp.WrapError(err, "BucketLifeTimeILM", za0008) + return + } + } + z.BucketLifeTimeILM[za0008] = za0009 + } + zb0001Mask |= 0x8 + case "last_minute": + var zb0007 uint32 + zb0007, bts, err = msgp.ReadMapHeaderBytes(bts) + if err != nil { + err = msgp.WrapError(err, "LastMinute") + return + } + var zb0007Mask uint8 /* 2 bits */ + _ = zb0007Mask + for zb0007 > 0 { + zb0007-- field, bts, err = msgp.ReadMapKeyZC(bts) if err != nil { err = msgp.WrapError(err, "LastMinute") @@ -34373,63 +34778,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 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, zb0007) + z.LastMinute.Actions = make(map[string]TimedAction, zb0008) } 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 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 = za0009.UnmarshalMsg(bts) + bts, err = za0011.UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "LastMinute", "Actions", za0008) + err = msgp.WrapError(err, "LastMinute", "Actions", za0010) return } - z.LastMinute.Actions[za0008] = za0009 + z.LastMinute.Actions[za0010] = za0011 } - zb0006Mask |= 0x1 + zb0007Mask |= 0x1 case "ilm": - var zb0008 uint32 - zb0008, 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, zb0008) + z.LastMinute.ILM = make(map[string]TimedAction, zb0009) } 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 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 = za0011.UnmarshalMsg(bts) + bts, err = za0013.UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "LastMinute", "ILM", za0010) + err = msgp.WrapError(err, "LastMinute", "ILM", za0012) return } - z.LastMinute.ILM[za0010] = za0011 + z.LastMinute.ILM[za0012] = za0013 } - zb0006Mask |= 0x2 + zb0007Mask |= 0x2 default: bts, err = msgp.Skip(bts) if err != nil { @@ -34439,117 +34844,117 @@ func (z *ScannerMetrics) UnmarshalMsg(bts []byte) (o []byte, err error) { } } // Clear omitted fields. - if zb0006Mask != 0x3 { - if (zb0006Mask & 0x1) == 0 { + if zb0007Mask != 0x3 { + if (zb0007Mask & 0x1) == 0 { z.LastMinute.Actions = nil } - if (zb0006Mask & 0x2) == 0 { + if (zb0007Mask & 0x2) == 0 { z.LastMinute.ILM = nil } } case "last_day": - var zb0009 uint32 - zb0009, 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, zb0009) + z.LastDay = make(map[string]SegmentedActions, zb0010) } 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 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])(&za0013).UnmarshalMsg(bts) + bts, err = (*Segmented[TimedAction, *TimedAction])(&za0015).UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "LastDay", za0012) + err = msgp.WrapError(err, "LastDay", za0014) return } - z.LastDay[za0012] = za0013 + z.LastDay[za0014] = za0015 } - zb0001Mask |= 0x8 + zb0001Mask |= 0x10 case "active": - var zb0010 uint32 - zb0010, 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(zb0010) { - z.ActivePaths = (z.ActivePaths)[:zb0010] + if cap(z.ActivePaths) >= int(zb0011) { + z.ActivePaths = (z.ActivePaths)[:zb0011] } else { - z.ActivePaths = make([]string, zb0010) + z.ActivePaths = make([]string, zb0011) } - for za0014 := range z.ActivePaths { - z.ActivePaths[za0014], 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", za0014) + err = msgp.WrapError(err, "ActivePaths", za0016) return } } - zb0001Mask |= 0x10 + zb0001Mask |= 0x20 case "excessive": - var zb0011 uint32 - zb0011, 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(zb0011) { - z.ExcessivePrefixes = (z.ExcessivePrefixes)[:zb0011] + if cap(z.ExcessivePrefixes) >= int(zb0012) { + z.ExcessivePrefixes = (z.ExcessivePrefixes)[:zb0012] } else { - z.ExcessivePrefixes = make([]string, zb0011) + z.ExcessivePrefixes = make([]string, zb0012) } - for za0015 := range z.ExcessivePrefixes { - z.ExcessivePrefixes[za0015], 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", za0015) + err = msgp.WrapError(err, "ExcessivePrefixes", za0017) return } } - zb0001Mask |= 0x20 + zb0001Mask |= 0x40 case "excessive_versions": - var zb0012 uint32 - zb0012, 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(zb0012) { - z.ExcessiveVersionObjects = (z.ExcessiveVersionObjects)[:zb0012] + if cap(z.ExcessiveVersionObjects) >= int(zb0013) { + z.ExcessiveVersionObjects = (z.ExcessiveVersionObjects)[:zb0013] } else { - z.ExcessiveVersionObjects = make([]string, zb0012) + z.ExcessiveVersionObjects = make([]string, zb0013) } - for za0016 := range z.ExcessiveVersionObjects { - z.ExcessiveVersionObjects[za0016], 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", za0016) + err = msgp.WrapError(err, "ExcessiveVersionObjects", za0018) 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 +34962,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 zb0014 uint32 + zb0014, 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(zb0014) { + z.QueuedForExpiry = (z.QueuedForExpiry)[:zb0014] } else { - z.QueuedForExpiry = make([]ExpiryObject, zb0013) + z.QueuedForExpiry = make([]ExpiryObject, zb0014) } - for za0017 := range z.QueuedForExpiry { - bts, err = z.QueuedForExpiry[za0017].UnmarshalMsg(bts) + for za0019 := range z.QueuedForExpiry { + bts, err = z.QueuedForExpiry[za0019].UnmarshalMsg(bts) if err != nil { - err = msgp.WrapError(err, "QueuedForExpiry", za0017) + err = msgp.WrapError(err, "QueuedForExpiry", za0019) return } } - zb0001Mask |= 0x200 + zb0001Mask |= 0x400 default: bts, err = msgp.Skip(bts) if err != nil { @@ -34585,7 +34990,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 +35001,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 +35055,54 @@ func (z *ScannerMetrics) Msgsize() (s int) { s += msgp.StringPrefixSize + len(za0006) + msgp.Uint64Size } } + s += 17 + msgp.MapHeaderSize + if z.BucketLifeTimeILM != nil { + for za0008, za0009 := range z.BucketLifeTimeILM { + _ = za0009 + 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 za0008, za0009 := range z.LastMinute.Actions { - _ = za0009 - s += msgp.StringPrefixSize + len(za0008) + za0009.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 za0010, za0011 := range z.LastMinute.ILM { - _ = za0011 - s += msgp.StringPrefixSize + len(za0010) + za0011.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 za0012, za0013 := range z.LastDay { - _ = za0013 - s += msgp.StringPrefixSize + len(za0012) + (*Segmented[TimedAction, *TimedAction])(&za0013).Msgsize() + for za0014, za0015 := range z.LastDay { + _ = za0015 + s += msgp.StringPrefixSize + len(za0014) + (*Segmented[TimedAction, *TimedAction])(&za0015).Msgsize() } } s += 7 + msgp.ArrayHeaderSize - for za0014 := range z.ActivePaths { - s += msgp.StringPrefixSize + len(z.ActivePaths[za0014]) + for za0016 := range z.ActivePaths { + s += msgp.StringPrefixSize + len(z.ActivePaths[za0016]) } s += 10 + msgp.ArrayHeaderSize - for za0015 := range z.ExcessivePrefixes { - s += msgp.StringPrefixSize + len(z.ExcessivePrefixes[za0015]) + for za0017 := range z.ExcessivePrefixes { + s += msgp.StringPrefixSize + len(z.ExcessivePrefixes[za0017]) } s += 19 + msgp.ArrayHeaderSize - for za0016 := range z.ExcessiveVersionObjects { - s += msgp.StringPrefixSize + len(z.ExcessiveVersionObjects[za0016]) + 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 za0017 := range z.QueuedForExpiry { - s += z.QueuedForExpiry[za0017].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 d2e1ecc6..c43263c8 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]*BucketILMStats{ + "bucket-a": {Bucket: "bucket-a", ActionCounters: map[string]uint64{"DeleteAction": 100, "TransitionAction": 50}}, + }, + }, + other: &ScannerMetrics{ + 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]*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) + } + }, + }, + { + name: "merge bucket lifetime ILM different buckets both appear", + base: &ScannerMetrics{ + BucketLifeTimeILM: map[string]*BucketILMStats{ + "bucket-a": {Bucket: "bucket-a", ActionCounters: map[string]uint64{"DeleteAction": 10}}, + }, + }, + other: &ScannerMetrics{ + 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 got := result.BucketLifeTimeILM["bucket-a"].ActionCounters["DeleteAction"]; got != 10 { + t.Errorf("bucket-a DeleteAction = %d, want 10", got) + } + 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]*BucketILMStats{ + "bucket-a": {Bucket: "bucket-a", ActionCounters: map[string]uint64{"DeleteAction": 5}}, + }, + }, + other: &ScannerMetrics{ + BucketLifeTimeILM: nil, + }, + verify: func(t *testing.T, result *ScannerMetrics) { + if got := result.BucketLifeTimeILM["bucket-a"].ActionCounters["DeleteAction"]; got != 5 { + t.Errorf("bucket-a DeleteAction = %d, want 5", got) + } + }, + }, + { + name: "merge bucket lifetime ILM nil base populated by other", + base: &ScannerMetrics{ + BucketLifeTimeILM: nil, + }, + other: &ScannerMetrics{ + BucketLifeTimeILM: map[string]*BucketILMStats{ + "bucket-c": {Bucket: "bucket-c", ActionCounters: map[string]uint64{"DeleteVersionAction": 7}}, + }, + }, + verify: func(t *testing.T, result *ScannerMetrics) { + if got := result.BucketLifeTimeILM["bucket-c"].ActionCounters["DeleteVersionAction"]; got != 7 { + t.Errorf("bucket-c DeleteVersionAction = %d, want 7", got) + } + }, + }, } for _, tt := range tests {