@@ -122,8 +122,8 @@ func NewPowerCollector(monitor PowerDataProvider, nodeName string, logger *slog.
122
122
"CPU usage ratio of a node (value between 0.0 and 1.0)" ,
123
123
nil , prometheus.Labels {nodeNameLabel : nodeName }),
124
124
125
- processCPUJoulesDescriptor : joulesDesc ("process" , "cpu" , nodeName , []string {"pid" , "comm" , "exe" , "type" , cntrID , vmID , zone }),
126
- processCPUWattsDescriptor : wattsDesc ("process" , "cpu" , nodeName , []string {"pid" , "comm" , "exe" , "type" , cntrID , vmID , zone }),
125
+ processCPUJoulesDescriptor : joulesDesc ("process" , "cpu" , nodeName , []string {"pid" , "comm" , "exe" , "type" , "state" , cntrID , vmID , zone }),
126
+ processCPUWattsDescriptor : wattsDesc ("process" , "cpu" , nodeName , []string {"pid" , "comm" , "exe" , "type" , "state" , cntrID , vmID , zone }),
127
127
processCPUTimeDescriptor : timeDesc ("process" , "cpu" , nodeName , []string {"pid" , "comm" , "exe" , "type" , cntrID , vmID }),
128
128
129
129
containerCPUJoulesDescriptor : joulesDesc ("container" , "cpu" , nodeName , []string {cntrID , "container_name" , "runtime" , zone , podID }),
@@ -206,7 +206,9 @@ func (c *PowerCollector) Collect(ch chan<- prometheus.Metric) {
206
206
}
207
207
208
208
c .collectNodeMetrics (ch , snapshot .Node )
209
- c .collectProcessMetrics (ch , snapshot .Processes )
209
+ c .collectProcessMetrics (ch , "running" , snapshot .Processes )
210
+ c .collectProcessMetrics (ch , "terminated" , snapshot .TerminatedProcesses )
211
+
210
212
c .collectContainerMetrics (ch , snapshot .Containers )
211
213
c .collectVMMetrics (ch , snapshot .VirtualMachines )
212
214
c .collectPodMetrics (ch , snapshot .Pods )
@@ -272,9 +274,9 @@ func (c *PowerCollector) collectNodeMetrics(ch chan<- prometheus.Metric, node *m
272
274
}
273
275
274
276
// collectProcessMetrics collects process-level power metrics
275
- func (c * PowerCollector ) collectProcessMetrics (ch chan <- prometheus.Metric , processes monitor.Processes ) {
277
+ func (c * PowerCollector ) collectProcessMetrics (ch chan <- prometheus.Metric , state string , processes monitor.Processes ) {
276
278
if len (processes ) == 0 {
277
- c .logger .Debug ("No processes to export metrics for" )
279
+ c .logger .Debug ("No processes to export metrics" , "state" , state )
278
280
return
279
281
}
280
282
@@ -296,7 +298,7 @@ func (c *PowerCollector) collectProcessMetrics(ch chan<- prometheus.Metric, proc
296
298
c .processCPUJoulesDescriptor ,
297
299
prometheus .CounterValue ,
298
300
usage .EnergyTotal .Joules (),
299
- pidStr , proc .Comm , proc .Exe , string (proc .Type ),
301
+ pidStr , proc .Comm , proc .Exe , string (proc .Type ), state ,
300
302
proc .ContainerID , proc .VirtualMachineID ,
301
303
zoneName ,
302
304
)
@@ -305,7 +307,7 @@ func (c *PowerCollector) collectProcessMetrics(ch chan<- prometheus.Metric, proc
305
307
c .processCPUWattsDescriptor ,
306
308
prometheus .GaugeValue ,
307
309
usage .Power .Watts (),
308
- pidStr , proc .Comm , proc .Exe , string (proc .Type ),
310
+ pidStr , proc .Comm , proc .Exe , string (proc .Type ), state ,
309
311
proc .ContainerID , proc .VirtualMachineID ,
310
312
zoneName ,
311
313
)
0 commit comments