Skip to content

Commit 6d3c8a5

Browse files
Added autogrow related metrics to orchestrator_core
1 parent 737acf4 commit 6d3c8a5

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

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
@@ -769,6 +769,32 @@ func (o *TridentOrchestrator) updateMetrics() {
769769
}
770770
}
771771
}
772+
773+
metrics.AutogrowPolicyGauge.Set(float64(len(o.autogrowPolicies)))
774+
775+
metrics.AutogrowVolumes.Reset()
776+
for _, volume := range o.volumes {
777+
if volume == nil {
778+
continue
779+
}
780+
if volume.EffectiveAGPolicy.PolicyName != "" {
781+
metrics.AutogrowVolumes.WithLabelValues(
782+
volume.EffectiveAGPolicy.PolicyName,
783+
volume.Config.StorageClass,
784+
).Inc()
785+
}
786+
}
787+
for _, volume := range o.subordinateVolumes {
788+
if volume == nil {
789+
continue
790+
}
791+
if volume.EffectiveAGPolicy.PolicyName != "" {
792+
metrics.AutogrowVolumes.WithLabelValues(
793+
volume.EffectiveAGPolicy.PolicyName,
794+
volume.Config.StorageClass,
795+
).Inc()
796+
}
797+
}
772798
}
773799

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

0 commit comments

Comments
 (0)