mirror of
https://github.com/minio/minio.git
synced 2025-02-04 10:26:01 -05:00
Limit in getBucketUsageMetrics
This commit is contained in:
parent
986165794b
commit
2a50d857c8
@ -1836,8 +1836,8 @@ func getGoMetrics() *MetricsGroupV2 {
|
|||||||
// getHistogramMetrics fetches histogram metrics and returns it in a []Metric
|
// getHistogramMetrics fetches histogram metrics and returns it in a []Metric
|
||||||
// Note: Typically used in MetricGroup.RegisterRead
|
// Note: Typically used in MetricGroup.RegisterRead
|
||||||
//
|
//
|
||||||
// The last parameter is added for compatibility - if true it lowercases the
|
// The toLowerAPILabels parameter is added for compatibility,
|
||||||
// `api` label values.
|
// if set, it lowercases the `api` label values.
|
||||||
func getHistogramMetrics(hist *prometheus.HistogramVec, desc MetricDescription, toLowerAPILabels, limitBuckets bool) []MetricV2 {
|
func getHistogramMetrics(hist *prometheus.HistogramVec, desc MetricDescription, toLowerAPILabels, limitBuckets bool) []MetricV2 {
|
||||||
ch := make(chan prometheus.Metric)
|
ch := make(chan prometheus.Metric)
|
||||||
go func() {
|
go func() {
|
||||||
@ -3281,7 +3281,12 @@ func getBucketUsageMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|||||||
if !globalSiteReplicationSys.isEnabled() {
|
if !globalSiteReplicationSys.isEnabled() {
|
||||||
bucketReplStats = globalReplicationStats.Load().getAllLatest(dataUsageInfo.BucketsUsage)
|
bucketReplStats = globalReplicationStats.Load().getAllLatest(dataUsageInfo.BucketsUsage)
|
||||||
}
|
}
|
||||||
for bucket, usage := range dataUsageInfo.BucketsUsage {
|
buckets := mapKeysSorted(dataUsageInfo.BucketsUsage)
|
||||||
|
if len(buckets) > v2MetricsMaxBuckets {
|
||||||
|
buckets = buckets[:v2MetricsMaxBuckets]
|
||||||
|
}
|
||||||
|
for _, bucket := range buckets {
|
||||||
|
usage := dataUsageInfo.BucketsUsage[bucket]
|
||||||
quota, _ := globalBucketQuotaSys.Get(ctx, bucket)
|
quota, _ := globalBucketQuotaSys.Get(ctx, bucket)
|
||||||
|
|
||||||
metrics = append(metrics, MetricV2{
|
metrics = append(metrics, MetricV2{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user