@@ -95,7 +95,7 @@ func timeDesc(level, device string, labels []string) *prometheus.Desc {
9595// by fetching all data in a single snapshot during collection
9696func NewPowerCollector (monitor PowerDataProvider , logger * slog.Logger ) * PowerCollector {
9797 const (
98- // these labels should rename the same across all descriptors to ease querying
98+ // these labels should remain the same across all descriptors to ease querying
9999 zone = "zone"
100100 cntrID = "container_id"
101101 vmID = "vm_id"
@@ -124,8 +124,8 @@ func NewPowerCollector(monitor PowerDataProvider, logger *slog.Logger) *PowerCol
124124 processCPUWattsDescriptor : wattsDesc ("process" , "cpu" , []string {"pid" , "comm" , "exe" , "type" , cntrID , vmID , zone }),
125125 processCPUTimeDescriptor : timeDesc ("process" , "cpu" , []string {"pid" , "comm" , "exe" , "type" , cntrID , vmID }),
126126
127- containerCPUJoulesDescriptor : joulesDesc ("container" , "cpu" , []string {cntrID , "container_name" , "runtime" , zone }),
128- containerCPUWattsDescriptor : wattsDesc ("container" , "cpu" , []string {cntrID , "container_name" , "runtime" , zone }),
127+ containerCPUJoulesDescriptor : joulesDesc ("container" , "cpu" , []string {cntrID , "container_name" , "runtime" , zone , podID }),
128+ containerCPUWattsDescriptor : wattsDesc ("container" , "cpu" , []string {cntrID , "container_name" , "runtime" , zone , podID }),
129129
130130 vmCPUJoulesDescriptor : joulesDesc ("vm" , "cpu" , []string {vmID , "vm_name" , "hypervisor" , zone }),
131131 vmCPUWattsDescriptor : wattsDesc ("vm" , "cpu" , []string {vmID , "vm_name" , "hypervisor" , zone }),
@@ -329,13 +329,16 @@ func (c *PowerCollector) collectContainerMetrics(ch chan<- prometheus.Metric, co
329329 usage .EnergyTotal .Joules (),
330330 id , container .Name , string (container .Runtime ),
331331 zoneName ,
332+ container .PodID ,
332333 )
333334
334335 ch <- prometheus .MustNewConstMetric (
335336 c .containerCPUWattsDescriptor ,
336337 prometheus .GaugeValue ,
337338 usage .Power .Watts (),
338- id , container .Name , string (container .Runtime ), zoneName ,
339+ id , container .Name , string (container .Runtime ),
340+ zoneName ,
341+ container .PodID ,
339342 )
340343 }
341344 }
0 commit comments