Skip to content

Commit ffd3d41

Browse files
Autogrow metrics addition to orchestrator_core
1 parent 01b0fc9 commit ffd3d41

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

core/metrics/metrics.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,19 @@ var (
9494
},
9595
[]string{"operation", "success"},
9696
)
97+
AutogrowPolicyGauge = promauto.NewGauge(
98+
prometheus.GaugeOpts{
99+
Namespace: config.OrchestratorName,
100+
Name: "autogrow_policy_count",
101+
Help: "The total number of Autogrow policies",
102+
},
103+
)
104+
AutogrowVolumes = promauto.NewGaugeVec(
105+
prometheus.GaugeOpts{
106+
Namespace: config.OrchestratorName,
107+
Name: "autogrow_volume_count",
108+
Help: "The total number of volumes on which Autogrow is enabled",
109+
},
110+
[]string{"autogrow_policy", "storage_class"},
111+
)
97112
)

core/orchestrator_core.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,32 @@ func (o *TridentOrchestrator) updateMetrics() {
772772
}
773773
}
774774
}
775+
776+
metrics.AutogrowPolicyGauge.Set(float64(len(o.autogrowPolicies)))
777+
778+
metrics.AutogrowVolumes.Reset()
779+
for _, volume := range o.volumes {
780+
if volume == nil {
781+
continue
782+
}
783+
if volume.EffectiveAGPolicy.PolicyName != "" {
784+
metrics.AutogrowVolumes.WithLabelValues(
785+
volume.EffectiveAGPolicy.PolicyName,
786+
volume.Config.StorageClass,
787+
).Inc()
788+
}
789+
}
790+
for _, volume := range o.subordinateVolumes {
791+
if volume == nil {
792+
continue
793+
}
794+
if volume.EffectiveAGPolicy.PolicyName != "" {
795+
metrics.AutogrowVolumes.WithLabelValues(
796+
volume.EffectiveAGPolicy.PolicyName,
797+
volume.Config.StorageClass,
798+
).Inc()
799+
}
800+
}
775801
}
776802

777803
func (o *TridentOrchestrator) handleFailedTransaction(ctx context.Context, v *storage.VolumeTransaction) error {

0 commit comments

Comments
 (0)