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 Apr 18, 2024
1 parent ca5fab8 commit 8772cb3
Show file tree
Hide file tree
Showing 4 changed files with 78 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
55 changes: 55 additions & 0 deletions cmd/metrics-v3-cluster-ilm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// 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, "")
)

// 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()))
}

// FIXME: add version scanned
// m.Set(versionsScanned, 0)

return nil
}
13 changes: 13 additions & 0 deletions cmd/metrics-v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const (
clusterUsageBucketsCollectorPath collectorPath = "/cluster/usage/buckets"
clusterErasureSetCollectorPath collectorPath = "/cluster/erasure-set"
clusterAuditCollectorPath collectorPath = "/cluster/audit"
clusterILMCollectorPath collectorPath = "/cluster/ilm"
)

const (
Expand Down Expand Up @@ -228,6 +229,17 @@ func newMetricGroups(r *prometheus.Registry) *metricsV3Collection {
loadClusterAuditMetrics,
)

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

allMetricGroups := []*MetricsGroup{
apiRequestsMG,
apiBucketMG,
Expand All @@ -241,6 +253,7 @@ func newMetricGroups(r *prometheus.Registry) *metricsV3Collection {
clusterUsageBucketsMG,
clusterErasureSetMG,
clusterAuditMG,
clusterILMMG,
}

// Bucket metrics are special, they always include the bucket label. These
Expand Down
10 changes: 10 additions & 0 deletions docs/metrics/v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,13 @@ The standard metrics groups for ProcessCollector and GoCollector are not shown b
| `minio_cluster_erasure_set_online_drives_count` | `gauge` | Count of online drives in the erasure set in a pool | `pool_id,set_id` |
| `minio_cluster_erasure_set_healing_drives_count` | `gauge` | Count of healing drives in the erasure set in a pool | `pool_id,set_id` |
| `minio_cluster_erasure_set_health` | `gauge` | Health of the erasure set in a pool (1=healthy, 0=unhealthy) | `pool_id,set_id` |

### `/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` | | |

0 comments on commit 8772cb3

Please sign in to comment.