Skip to content

Commit 70c4146

Browse files
committed
add metric cleanup on group delete
1 parent ea6b67c commit 70c4146

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

pkg/accelerator-orchestrator/metrics/metrics.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ var (
4848
)
4949
)
5050

51+
// CleanupGroup removes gauge series labeled with the given group so stale
52+
// values don't persist in /metrics after the group is deleted. Cumulative
53+
// metrics (histograms, counters) are left intact so group ID reuse doesn't
54+
// appear as a counter reset.
55+
func CleanupGroup(groupID string) {
56+
QueueDepth.DeletePartialMatch(prometheus.Labels{"group_id": groupID})
57+
}
58+
5159
// Register registers all accelerator orchestrator Prometheus metrics with the default registry.
5260
func Register() {
5361
prometheus.MustRegister(

pkg/accelerator-orchestrator/store/group_store.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"context"
55
"errors"
66
"sync"
7+
8+
"github.com/llm-d-incubation/llm-d-rl-time-slicing/pkg/accelerator-orchestrator/metrics"
79
)
810

911
var (
@@ -106,6 +108,7 @@ func (s *GroupStore) Delete(ctx context.Context, id string) error {
106108
return err
107109
}
108110
delete(s.groups, id)
111+
metrics.CleanupGroup(id)
109112
}
110113
return nil
111114
}

0 commit comments

Comments
 (0)