Skip to content

fix: report effective bucket quotas in metrics - #132

Merged
Vonng merged 1 commit into
pgsty:mainfrom
mrjavadseydi:fix/issue-106-bucket-quota-metrics
Sep 7, 2026
Merged

Vonng merged 1 commit into
pgsty:mainfrom
mrjavadseydi:fix/issue-106-bucket-quota-metrics

Conversation

@mrjavadseydi

Copy link
Copy Markdown

Contribution Licensing (no CLA, inbound=outbound, DCO required)

This project does not use a CLA; contributions are accepted inbound=outbound.
By submitting this pull request I represent that I have the right to contribute
the changes, which are licensed under this repository's
GNU Affero General Public License v3.0 or later
and remain my copyright. Every commit carries a DCO Signed-off-by trailer
certifying the
Developer Certificate of Origin.

Description

Report bucket quota metrics from the quota value the server actually enforces.
The shared quota-size selector prefers BucketQuota.Size and retains
BucketQuota.Quota as a fallback for legacy configurations.

Site-replication status now compares effective hard-quota values while still
detecting raw size drift in unsupported or typeless configurations.

Motivation and Context

The v2 and v3 bucket usage collectors still read the deprecated Quota field.
Quotas stored in the current Size field therefore produced a missing or zero
quota metric even though the server enforced them.

Fixes #106.

How to test this PR?

go test ./cmd -run '^Test(GetBucketQuotaSize|IsBktQuotaCfgReplicated|GetHistogramMetrics_BucketCount|GetHistogramMetrics_Values)$' -count=1
go vet ./cmd
make verifiers
make build
./silo --version

Compatibility impact

There are no API, metric-name, label, route, storage-format, or configuration
schema changes. Current Size quotas are now reported correctly, legacy
Quota values remain supported, and non-hard quotas are not advertised as
enforced. Site-replication status now detects differing Size values while
treating equivalent current and legacy hard-quota representations as equal.

Rollback requires no data migration; it only restores the previous incorrect
metric and replication-status behavior. No compatibility identifiers change.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • All commits are signed off (git commit -s) per the DCO
  • Fixes a regression (5b114b43f7a657c6ab964cadd318505cba7f25c1 migrated quota enforcement to Size without updating metrics)
  • Unit tests added/updated
  • make verifiers passes
  • Relevant package tests and make build pass
  • Compatibility and rollback impact documented
  • Internal documentation updated (not required; no internal workflow changed)
  • Public documentation update opened in pgsty/silo.pgsty.com, if needed (not needed; the metric contract is unchanged)

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.

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

2 participants