@@ -60,21 +60,21 @@ func newMetrics(m *Manager) *metrics {
60
60
Help : "time it took for workspace pods to reach the running phase" ,
61
61
// same as components/ws-manager-bridge/src/prometheus-metrics-exporter.ts#L15
62
62
Buckets : prometheus .ExponentialBuckets (2 , 2 , 10 ),
63
- }, []string {"type" }),
63
+ }, []string {"type" , "class" }),
64
64
initializeTimeHistVec : prometheus .NewHistogramVec (prometheus.HistogramOpts {
65
65
Namespace : metricsNamespace ,
66
66
Subsystem : metricsWorkspaceSubsystem ,
67
67
Name : "workspace_initialize_seconds" ,
68
68
Help : "time it took to initialize workspace" ,
69
69
Buckets : prometheus .ExponentialBuckets (2 , 2 , 10 ),
70
- }, []string {"type" }),
70
+ }, []string {"type" , "class" }),
71
71
finalizeTimeHistVec : prometheus .NewHistogramVec (prometheus.HistogramOpts {
72
72
Namespace : metricsNamespace ,
73
73
Subsystem : metricsWorkspaceSubsystem ,
74
74
Name : "workspace_finalize_seconds" ,
75
75
Help : "time it took to finalize workspace" ,
76
76
Buckets : prometheus .ExponentialBuckets (2 , 2 , 10 ),
77
- }, []string {"type" }),
77
+ }, []string {"type" , "class" }),
78
78
volumeSnapshotTimeHistVec : prometheus .NewHistogramVec (prometheus.HistogramOpts {
79
79
Namespace : metricsNamespace ,
80
80
Subsystem : metricsWorkspaceSubsystem ,
@@ -87,13 +87,13 @@ func newMetrics(m *Manager) *metrics {
87
87
Subsystem : metricsWorkspaceSubsystem ,
88
88
Name : "workspace_starts_total" ,
89
89
Help : "total number of workspaces started" ,
90
- }, []string {"type" }),
90
+ }, []string {"type" , "class" }),
91
91
totalStopsCounterVec : prometheus .NewCounterVec (prometheus.CounterOpts {
92
92
Namespace : metricsNamespace ,
93
93
Subsystem : metricsWorkspaceSubsystem ,
94
94
Name : "workspace_stops_total" ,
95
95
Help : "total number of workspaces stopped" ,
96
- }, []string {"reason" , "type" }),
96
+ }, []string {"reason" , "type" , "class" }),
97
97
totalOpenPortGauge : prometheus .NewGaugeFunc (prometheus.GaugeOpts {
98
98
Namespace : metricsNamespace ,
99
99
Subsystem : metricsWorkspaceSubsystem ,
@@ -163,9 +163,9 @@ func (m *metrics) Register(reg prometheus.Registerer) error {
163
163
return nil
164
164
}
165
165
166
- func (m * metrics ) OnWorkspaceStarted (tpe api.WorkspaceType ) {
166
+ func (m * metrics ) OnWorkspaceStarted (tpe api.WorkspaceType , class string ) {
167
167
nme := api .WorkspaceType_name [int32 (tpe )]
168
- counter , err := m .totalStartsCounterVec .GetMetricWithLabelValues (nme )
168
+ counter , err := m .totalStartsCounterVec .GetMetricWithLabelValues (nme , class )
169
169
if err != nil {
170
170
log .WithError (err ).WithField ("type" , tpe ).Warn ("cannot get counter for workspace start metric" )
171
171
return
@@ -198,7 +198,7 @@ func (m *metrics) OnChange(status *api.WorkspaceStatus) {
198
198
}
199
199
200
200
t := status .Metadata .StartedAt .AsTime ()
201
- hist , err := m .startupTimeHistVec .GetMetricWithLabelValues (tpe )
201
+ hist , err := m .startupTimeHistVec .GetMetricWithLabelValues (tpe , status . Spec . Class )
202
202
if err != nil {
203
203
log .WithError (err ).WithField ("type" , tpe ).Warn ("cannot get startup time histogram metric" )
204
204
return
@@ -217,7 +217,7 @@ func (m *metrics) OnChange(status *api.WorkspaceStatus) {
217
217
reason = "regular-stop"
218
218
}
219
219
220
- counter , err := m .totalStopsCounterVec .GetMetricWithLabelValues (reason , tpe )
220
+ counter , err := m .totalStopsCounterVec .GetMetricWithLabelValues (reason , tpe , status . Spec . Class )
221
221
if err != nil {
222
222
log .WithError (err ).WithField ("reason" , reason ).Warn ("cannot get counter for workspace stops metric" )
223
223
return
0 commit comments