Add ILM metrics in metrics-v3 (#19539)

Signed-off-by: Bala.FA <bala@minio.io>
This commit is contained in:
Bala FA 2024-06-06 15:06:25 +05:30 committed by GitHub
parent 850a84b08a
commit 7edc352d23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 84 additions and 3 deletions

View File

@ -273,13 +273,10 @@ const (
vmemory = "virtual_memory_bytes"
cpu = "cpu_total_seconds"
expiryPendingTasks MetricName = "expiry_pending_tasks"
expiryMissedTasks MetricName = "expiry_missed_tasks"
expiryMissedFreeVersions MetricName = "expiry_missed_freeversions"
expiryMissedTierJournalTasks MetricName = "expiry_missed_tierjournal_tasks"
expiryNumWorkers MetricName = "expiry_num_workers"
transitionPendingTasks MetricName = "transition_pending_tasks"
transitionActiveTasks MetricName = "transition_active_tasks"
transitionMissedTasks MetricName = "transition_missed_immediate_tasks"
transitionedBytes MetricName = "transitioned_bytes"

53
cmd/metrics-v3-ilm.go Normal file
View File

@ -0,0 +1,53 @@
// Copyright (c) 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 (
expiryPendingTasks = "expiry_pending_tasks"
transitionActiveTasks = "transition_active_tasks"
transitionPendingTasks = "transition_pending_tasks"
transitionMissedImmediateTasks = "transition_missed_immediate_tasks"
versionsScanned = "versions_scanned"
)
var (
ilmExpiryPendingTasksMD = NewGaugeMD(expiryPendingTasks, "Number of pending ILM expiry tasks in the queue")
ilmTransitionActiveTasksMD = NewGaugeMD(transitionActiveTasks, "Number of active ILM transition tasks")
ilmTransitionPendingTasksMD = NewGaugeMD(transitionPendingTasks, "Number of pending ILM transition tasks in the queue")
ilmTransitionMissedImmediateTasksMD = NewCounterMD(transitionMissedImmediateTasks, "Number of missed immediate ILM transition tasks")
ilmVersionsScannedMD = NewCounterMD(versionsScanned, "Total number of object versions checked for ILM actions since server start")
)
// loadILMMetrics - `MetricsLoaderFn` for ILM metrics.
func loadILMMetrics(_ context.Context, m MetricValues, _ *metricsCache) error {
if globalExpiryState != nil {
m.Set(expiryPendingTasks, float64(globalExpiryState.PendingTasks()))
}
if globalTransitionState != nil {
m.Set(transitionActiveTasks, float64(globalTransitionState.ActiveTasks()))
m.Set(transitionPendingTasks, float64(globalTransitionState.PendingTasks()))
m.Set(transitionMissedImmediateTasks, float64(globalTransitionState.MissedImmediateTasks()))
}
m.Set(versionsScanned, float64(globalScannerMetrics.lifetime(scannerMetricILM)))
return nil
}

View File

@ -54,6 +54,7 @@ const (
clusterIAMCollectorPath collectorPath = "/cluster/iam"
clusterConfigCollectorPath collectorPath = "/cluster/config"
ilmCollectorPath collectorPath = "/ilm"
auditCollectorPath collectorPath = "/audit"
loggerWebhookCollectorPath collectorPath = "/logger/webhook"
replicationCollectorPath collectorPath = "/replication"
@ -382,6 +383,17 @@ func newMetricGroups(r *prometheus.Registry) *metricsV3Collection {
loadAuditMetrics,
)
ilmMG := NewMetricsGroup(ilmCollectorPath,
[]MetricDescriptor{
ilmExpiryPendingTasksMD,
ilmTransitionActiveTasksMD,
ilmTransitionPendingTasksMD,
ilmTransitionMissedImmediateTasksMD,
ilmVersionsScannedMD,
},
loadILMMetrics,
)
allMetricGroups := []*MetricsGroup{
apiRequestsMG,
bucketAPIMG,
@ -402,6 +414,7 @@ func newMetricGroups(r *prometheus.Registry) *metricsV3Collection {
clusterReplicationMG,
clusterConfigMG,
ilmMG,
scannerMG,
auditMG,
loggerWebhookMG,

View File

@ -42,6 +42,14 @@ These are metrics about the minio audit functionality
|----------|----------------------------------------|
| `/audit` | Metrics related to audit functionality |
### ILM metrics
These are metrics about the minio ILM functionality
| Path | Description |
|--------|--------------------------------------|
| `/ilm` | Metrics related to ILM functionality |
### Logger webhook metrics
These are metrics about the minio logger webhooks
@ -377,3 +385,13 @@ The standard metrics group for GoCollector is not shown below.
| `minio_scanner_last_activity_seconds` | `gauge` | Time elapsed (in seconds) since last scan activity | `server` |
| `minio_scanner_objects_scanned` | `counter` | Total number of unique objects scanned since server start | `server` |
| `minio_scanner_versions_scanned` | `counter` | Total number of object versions scanned since server start | `server` |
### `/ilm`
| Name | Type | Help | Labels |
|-------------------------------------------------------|-----------|----------------------------------------------------------------------------|----------|
| `minio_cluster_ilm_expiry_pending_tasks` | `gauge` | Number of pending ILM expiry tasks in the queue | `server` |
| `minio_cluster_ilm_transition_active_tasks` | `gauge` | Number of active ILM transition tasks | `server` |
| `minio_cluster_ilm_transition_pending_tasks` | `gauge` | Number of pending ILM transition tasks in the queue | `server` |
| `minio_cluster_ilm_transition_missed_immediate_tasks` | `counter` | Number of missed immediate ILM transition tasks | `server` |
| `minio_cluster_ilm_versions_scanned` | `counter` | Total number of object versions checked for ILM actions since server start | `server` |