Skip to content

Commit

Permalink
Add cluster ILM metrics in metrics-v3
Browse files Browse the repository at this point in the history
Signed-off-by: Bala.FA <[email protected]>
  • Loading branch information
balamurugana committed May 23, 2024
1 parent 7981509 commit b5affab
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 3 deletions.
3 changes: 0 additions & 3 deletions cmd/metrics-v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
53 changes: 53 additions & 0 deletions cmd/metrics-v3-cluster-ilm.go
Original file line number Diff line number Diff line change
@@ -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"
transitionMissedImmediateTasks = "transition_missed_immediate_tasks"
transitionPendingTasks = "transition_pending_tasks"
versionsScanned = "versions_scanned"
)

var (
ilmExpiryPendingTasksMD = NewCounterMD(expiryPendingTasks, "Number of pending ILM expiry tasks in the queue")
ilmTransitionActiveTasksMD = NewCounterMD(transitionActiveTasks, "Number of active ILM transition tasks")
ilmTransitionMissedImmediateTasksMD = NewCounterMD(transitionMissedImmediateTasks, "Number of missed immediate ILM transition tasks")
ilmTransitionPendingTasksMD = NewCounterMD(transitionPendingTasks, "Number of pending ILM transition tasks in the queue")
ilmVersionsScannedMD = NewCounterMD(versionsScanned, "Total number of object versions scanned since server start")
)

// loadClusterILMMetrics - `MetricsLoaderFn` for cluster ILM metrics.
func loadClusterILMMetrics(_ 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(transitionMissedImmediateTasks, float64(globalTransitionState.MissedImmediateTasks()))
m.Set(transitionPendingTasks, float64(globalTransitionState.PendingTasks()))
}
m.Set(versionsScanned, float64(globalScannerMetrics.lifetime(scannerMetricILM)))

return nil
}
13 changes: 13 additions & 0 deletions cmd/metrics-v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const (
clusterErasureSetCollectorPath collectorPath = "/cluster/erasure-set"
clusterNotificationCollectorPath collectorPath = "/cluster/notification"
clusterIAMCollectorPath collectorPath = "/cluster/iam"
clusterILMCollectorPath collectorPath = "/cluster/ilm"

auditCollectorPath collectorPath = "/audit"
loggerWebhookCollectorPath collectorPath = "/logger/webhook"
Expand Down Expand Up @@ -360,6 +361,17 @@ func newMetricGroups(r *prometheus.Registry) *metricsV3Collection {
loadAuditMetrics,
)

clusterILMMG := NewMetricsGroup(clusterILMCollectorPath,
[]MetricDescriptor{
ilmExpiryPendingTasksMD,
ilmTransitionActiveTasksMD,
ilmTransitionMissedImmediateTasksMD,
ilmTransitionPendingTasksMD,
ilmVersionsScannedMD,
},
loadClusterILMMetrics,
)

allMetricGroups := []*MetricsGroup{
apiRequestsMG,
bucketAPIMG,
Expand All @@ -378,6 +390,7 @@ func newMetricGroups(r *prometheus.Registry) *metricsV3Collection {
clusterNotificationMG,
clusterIAMMG,
clusterReplicationMG,
clusterILMMG,

auditMG,
loggerWebhookMG,
Expand Down
10 changes: 10 additions & 0 deletions docs/metrics/v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,3 +343,13 @@ The standard metrics group for GoCollector is not shown below.
| `minio_replication_max_queued_bytes` | `gauge` | Maximum number of bytes queued for replication since server start | `server` |
| `minio_replication_max_queued_count` | `gauge` | Maximum number of objects queued for replication since server start | `server` |
| `minio_replication_max_data_transfer_rate` | `gauge` | Maximum replication data transfer rate in bytes/sec seen since server start | `server` |

### `/cluster/ilm`

| Name | Type | Help | Labels |
|-------------------------------------------------------|-----------|------------------------------------------------------------|--------|
| `minio_cluster_ilm_expiry_pending_tasks` | `counter` | Number of pending ILM expiry tasks in the queue | |
| `minio_cluster_ilm_transition_active_tasks` | `counter` | Number of active ILM transition tasks | |
| `minio_cluster_ilm_transition_missed_immediate_tasks` | `counter` | Number of missed immediate ILM transition tasks | |
| `minio_cluster_ilm_transition_pending_tasks` | `counter` | Number of pending ILM transition tasks in the queue | |
| `minio_cluster_ilm_versions_scanned` | `counter` | Total number of object versions checked for ilm actions since server start | |

0 comments on commit b5affab

Please sign in to comment.