Skip to content

监控指标读取已弃用的 BucketQuota.Quota 字段导致 Quota 指标无值 #106

Closed

Description

@mumu-lab

问题描述

在监控/指标采集代码中,Bucket Quota 指标仍然在读取 BucketQuota 中已废弃的 Quota 字段,而不是当前生效的 Size 字段,导致采集到的配额指标为空或为 0。影响metrics-v2.go和metrics-v3.go的quota指标值

代码背景

依赖github.com/minio/madmin-go/v3的BucketQuota 结构体中明确标注 Quota 已于 2023 年 8 月弃用:

type BucketQuota struct {
    Quota    uint64    `json:"quota"`    // Deprecated Aug 2023
    Size     uint64    `json:"size"`     // Indicates maximum size allowed per bucket
    Rate     uint64    `json:"rate"`     // Indicates bandwidth rate allocated per bucket
    Requests uint64    `json:"requests"` // Indicates number of requests allocated per bucket
    Type     QuotaType `json:"quotatype,omitempty"`
}

Activity

  1. moved this from Backlog to In progress in Siloon Sep 5, 2026
  2. Vonng commented on Sep 6, 2026

    @Vonng
    Member

    Independent review, 2026-09-06: #132 at 0db4bf3b00185fcc053a6ae30a2bbbe69ae8317c addresses the root cause with a small shared selector: hard-quota enforcement, v2/v3 metrics and Veeam now use Size first and legacy Quota as fallback; site-replication comparison uses the same effective hard-quota value. API names, labels and storage representation remain unchanged.

    The quota and site-replication comparison tests pass in an isolated checkout containing current main e7d0e62f1 plus #132 (also integrated with the other reviewed PRs). No blocking functional finding in this change. Keep #106 open until #132 is merged; this verification does not mean the fix is present in main or a released image.

  3. moved this from In progress to Done in Siloon Sep 7, 2026
  4. Vonng commented on Sep 7, 2026

    @Vonng
    Member

    Resolved by #132 (thanks @mrjavadseydi) — merged to main as ad873c735.

    The bucket-quota metrics in metrics-v2.go (getBucketUsageMetrics) and metrics-v3-cluster-usage.go read the deprecated madmin.BucketQuota.Quota field, so a quota set via the current API (Size>0, Quota==0 — the shape the Console and mc write) emitted no quota metric at all. A new getBucketQuotaSize helper (prefer Size, fall back to the deprecated Quota, require HardQuota type) is now used at both metric sites, so the effective enforced quota is reported. The same helper replaces the equivalent inline logic in enforceQuotaHard and the veeam SOS API (pure refactor), and isBktQuotaCfgReplicated now compares effective sizes — a bonus fix for two latent site-replication mis-verdicts (false drift on equivalent Size/Quota representations; false match on typeless differing sizes).

    Verified: rebased cleanly onto current main and independently adversarially reviewed — build, vet, gofmt, rebrand-guard, and TestGetBucketQuotaSize/TestIsBktQuotaCfgReplicated all green. The HardQuota-type gate drops no legitimate quota, since HardQuota is the only type madmin's QuotaType.IsValid accepts.

  5. added
    bug
    on Sep 15, 2026
  6. self-assigned this
    on Sep 15, 2026
  7. added theissue type on Sep 15, 2026
  8. added this to the 20260916 milestone on Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions