mirror of https://github.com/minio/minio.git
Add cluster config metrics in metrics-v3 (#19507)
endpoint: /minio/metrics/v3/cluster/config metrics: - write_quorum - rrs_parity - standard_parity
This commit is contained in:
parent
2a03a34bde
commit
5659cddc84
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) 2015-2024 MinIO, Inc.
|
||||
//
|
||||
// This file is part of MinIO Object Storage stack
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package cmd
|
||||
|
||||
import "context"
|
||||
|
||||
const (
|
||||
configRRSParity = "rrs_parity"
|
||||
configStandardParity = "standard_parity"
|
||||
)
|
||||
|
||||
var (
|
||||
configRRSParityMD = NewGaugeMD(configRRSParity,
|
||||
"Reduced redundancy storage class parity")
|
||||
configStandardParityMD = NewGaugeMD(configStandardParity,
|
||||
"Standard storage class parity")
|
||||
)
|
||||
|
||||
// loadClusterConfigMetrics - `MetricsLoaderFn` for cluster config
|
||||
// such as standard and RRS parity.
|
||||
func loadClusterConfigMetrics(ctx context.Context, m MetricValues, c *metricsCache) error {
|
||||
clusterDriveMetrics, err := c.clusterDriveMetrics.Get()
|
||||
if err != nil {
|
||||
metricsLogIf(ctx, err)
|
||||
} else {
|
||||
m.Set(configStandardParity, float64(clusterDriveMetrics.storageInfo.Backend.StandardSCParity))
|
||||
m.Set(configRRSParity, float64(clusterDriveMetrics.storageInfo.Backend.RRSCParity))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -52,6 +52,7 @@ const (
|
|||
clusterUsageBucketsCollectorPath collectorPath = "/cluster/usage/buckets"
|
||||
clusterErasureSetCollectorPath collectorPath = "/cluster/erasure-set"
|
||||
clusterIAMCollectorPath collectorPath = "/cluster/iam"
|
||||
clusterConfigCollectorPath collectorPath = "/cluster/config"
|
||||
|
||||
auditCollectorPath collectorPath = "/audit"
|
||||
loggerWebhookCollectorPath collectorPath = "/logger/webhook"
|
||||
|
@ -342,6 +343,14 @@ func newMetricGroups(r *prometheus.Registry) *metricsV3Collection {
|
|||
loadClusterReplicationMetrics,
|
||||
)
|
||||
|
||||
clusterConfigMG := NewMetricsGroup(clusterConfigCollectorPath,
|
||||
[]MetricDescriptor{
|
||||
configRRSParityMD,
|
||||
configStandardParityMD,
|
||||
},
|
||||
loadClusterConfigMetrics,
|
||||
)
|
||||
|
||||
loggerWebhookMG := NewMetricsGroup(loggerWebhookCollectorPath,
|
||||
[]MetricDescriptor{
|
||||
webhookFailedMessagesMD,
|
||||
|
@ -378,6 +387,7 @@ func newMetricGroups(r *prometheus.Registry) *metricsV3Collection {
|
|||
clusterNotificationMG,
|
||||
clusterIAMMG,
|
||||
clusterReplicationMG,
|
||||
clusterConfigMG,
|
||||
|
||||
auditMG,
|
||||
loggerWebhookMG,
|
||||
|
|
|
@ -261,6 +261,13 @@ The standard metrics group for GoCollector is not shown below.
|
|||
| `minio_cluster_health_capacity_usable_total_bytes` | `gauge` | Total cluster usable storage capacity in bytes | |
|
||||
| `minio_cluster_health_capacity_usable_free_bytes` | `gauge` | Total cluster usable storage free in bytes | |
|
||||
|
||||
### `/cluster/config`
|
||||
|
||||
| Name | Type | Help | Labels |
|
||||
|----------------------------------------|---------|------------------------------------------------|--------|
|
||||
| `minio_cluster_config_rrs_parity` | `gauge` | Reduced redundancy storage class parity | |
|
||||
| `minio_cluster_config_standard_parity` | `gauge` | Standard storage class parity | |
|
||||
|
||||
### `/cluster/usage/objects`
|
||||
|
||||
| Name | Type | Help | Labels |
|
||||
|
|
|
@ -92,7 +92,7 @@ func (t *Cache[T]) InitOnce(ttl time.Duration, opts Opts, update func(ctx contex
|
|||
// GetWithCtx will return a cached value or fetch a new one.
|
||||
// passes a caller context, if caller context cancels nothing
|
||||
// is cached.
|
||||
// Tf the Update function returns an error the value is forwarded as is and not cached.
|
||||
// If the Update function returns an error the value is forwarded as is and not cached.
|
||||
func (t *Cache[T]) GetWithCtx(ctx context.Context) (T, error) {
|
||||
v := t.val.Load()
|
||||
ttl := t.ttl
|
||||
|
|
Loading…
Reference in New Issue