@@ -2,9 +2,9 @@ package metrics
2
2
3
3
import (
4
4
"context"
5
+ "strconv"
5
6
"sync"
6
7
"time"
7
- "strconv"
8
8
9
9
"github.com/go-logr/logr"
10
10
"github.com/prometheus/client_golang/prometheus"
@@ -22,7 +22,7 @@ type RayClusterMetricsObserver interface {
22
22
}
23
23
24
24
// RayClusterMetricCleanupItem represents an item in the RayCluster metric cleanup queue
25
- type RayClusterMetricCleanupItem struct {
25
+ type RayClusterMetricCleanupItem struct {
26
26
Name string
27
27
Namespace string
28
28
DeleteAt time.Time
@@ -75,7 +75,7 @@ func NewRayClusterMetricsManager(ctx context.Context, client client.Client) *Ray
75
75
cleanupQueue : make ([]RayClusterMetricCleanupItem , 0 ),
76
76
metricTTL : 5 * time .Minute , // Keep metrics for 5 minutes
77
77
}
78
-
78
+
79
79
// Start the cleanup goroutine
80
80
go manager .startRayClusterCleanupLoop (ctx )
81
81
return manager
@@ -151,7 +151,7 @@ func (r *RayClusterMetricsManager) cleanupExpiredRayClusterMetrics() {
151
151
for _ , item := range r .cleanupQueue {
152
152
if now .After (item .DeleteAt ) {
153
153
// Remove expired metric
154
- r .rayClusterProvisionedDurationSeconds .DeleteLabelValues ( item .Name , item .Namespace )
154
+ r .rayClusterProvisionedDurationSeconds .DeletePartialMatch (prometheus. Labels { "name" : item .Name , "namespace" : item .Namespace } )
155
155
r .log .Info ("Cleaned up expired RayCluster metric" , "name" , item .Name , "namespace" , item .Namespace )
156
156
} else {
157
157
// Keep non-expired items
0 commit comments