Skip to content

feat(scanner): add ExcessiveVersionObjects to ScannerMetrics - #592

Merged
harshavardhana merged 3 commits into
minio:mainfrom
shtripat:scanner-metrics
May 11, 2026
Merged

harshavardhana merged 3 commits into
minio:mainfrom
shtripat:scanner-metrics

Conversation

@shtripat

@shtripat shtripat commented May 7, 2026

Copy link
Copy Markdown
Contributor

Description

ScannerMetrics already exposes ExcessivePrefixes (folders with too
many sub-entries) via the realtime metrics API, which collects per-node
reports and merges them cluster-wide. This PR does the same for the
version-excess side: add ExcessiveVersionObjects []string so objects
exceeding the version count or cumulative size threshold are visible in
mc admin top scanner and Prometheus scrapes across all nodes.

A DiscardedExcessEntries uint64 counter tracks entries dropped when
the merged list is capped at 100 entries, letting operators know the
list is incomplete without polluting the payload.

Changes

  • ScannerMetrics: two new fields
    • ExcessiveVersionObjects []string (json:"excessive_versions")
    • DiscardedExcessEntries uint64 (json:"discarded_excess_entries")
  • ScannerMetrics.Merge(): replaces the unbounded
    ExcessivePrefixes dedup map with a setof.String-based helper
    that caps both excess slices at 100 entries and accumulates
    DiscardedExcessEntries
  • metrics_gen.go: regenerated

Testing

New test cases in TestScannerMetricsMerge:

  • ExcessiveVersionObjects dedup and sort
  • 100-entry cap with correct DiscardedExcessEntries count (110
    unique → 100 kept, 10 discarded)
  • Accumulated DiscardedExcessEntries across successive merges

Add ExcessiveVersionObjects []string to ScannerMetrics so that objects
exceeding the version count or cumulative size threshold are surfaced
via the realtime metrics API alongside the existing ExcessivePrefixes
field. Each node populates both lists from its local scanner state;
the realtime metrics API collects per-node reports and merges them
cluster-wide via ScannerMetrics.Merge().

Update Merge() to handle both excess slices with setof.String for
deduplication and a 100-entry cap per merge. Entries dropped beyond
the cap are counted in the new DiscardedExcessEntries field, which
accumulates across cross-node merges.
Comment thread metrics.go
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>

@klauspost klauspost left a comment

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.

lgtm

Comment thread metrics.go Outdated
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
@harshavardhana
harshavardhana merged commit a3cba4f into minio:main May 11, 2026
5 checks passed
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.

4 participants