Skip to content

feat: add BucketLifeTimeILM to ScannerMetrics#583

Open
krisis wants to merge 3 commits into
mainfrom
feat/bucket-ilm-metrics
Open

feat: add BucketLifeTimeILM to ScannerMetrics#583
krisis wants to merge 3 commits into
mainfrom
feat/bucket-ilm-metrics

Conversation

@krisis
Copy link
Copy Markdown
Member

@krisis krisis commented Apr 23, 2026

Description

SDK consumers can now read per-bucket ILM action counters from ScannerMetrics
in addition to the existing cluster-wide counters.

Motivation and Context

Prerequisite for miniohq/eos#4526. The eos side gates population on a bucket
parameter, so cluster-wide queries do not fan out the payload by bucket count.

How to test this PR?

go generate ./...
go test ./... -run "TestScannerMetricsMerge|TestEncodeDecodeBucketILMStats|TestMarshalUnmarshalBucketILMStats|TestEncodeDecodeScannerMetrics" -v

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@krisis krisis force-pushed the feat/bucket-ilm-metrics branch from 24dba53 to cb094f8 Compare April 27, 2026 20:37
Comment thread estream/types.go
package estream

//go:generate stringer -type=blockID -trimprefix=block
//go:generate go tool stringer -type=blockID -trimprefix=block
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. you can do that. Neat.

Comment thread metrics.go Outdated
Comment on lines +457 to +460
// 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"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so you are returning for a specific bucket. You need to add the bucket name in the params. Should be fairly trivial.

Make it a pointer struct with the bucket name and fields, so we can add more without having to add individual fields here.

Krishnan Parthasarathi added 2 commits May 13, 2026 11:53
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.
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.
@krisis krisis force-pushed the feat/bucket-ilm-metrics branch 2 times, most recently from bd82c68 to 79f35f5 Compare May 13, 2026 19:02
@krisis krisis marked this pull request as ready for review May 13, 2026 19:04
@krisis
Copy link
Copy Markdown
Member Author

krisis commented May 13, 2026

@klauspost thanks for your advance review. I've addressed your comments. PTAL.

@krisis krisis force-pushed the feat/bucket-ilm-metrics branch from 79f35f5 to e4a2d3a Compare May 14, 2026 04:33
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.
@krisis krisis force-pushed the feat/bucket-ilm-metrics branch from e4a2d3a to 00715e2 Compare May 14, 2026 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants