Skip to content

Commit 2b490d6

Browse files
author
Sergei Semenchuk
authored
add path label to rapl collector (#2146)
Signed-off-by: binjip978 <[email protected]>
1 parent 60e9670 commit 2b490d6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

collector/fixtures/e2e-output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,10 +2747,10 @@ node_qdisc_requeues_total{device="eth0",kind="pfifo_fast"} 2
27472747
node_qdisc_requeues_total{device="wlan0",kind="fq"} 1
27482748
# HELP node_rapl_core_joules_total Current RAPL core value in joules
27492749
# TYPE node_rapl_core_joules_total counter
2750-
node_rapl_core_joules_total{index="0"} 118821.284256
2750+
node_rapl_core_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0:0"} 118821.284256
27512751
# HELP node_rapl_package_joules_total Current RAPL package value in joules
27522752
# TYPE node_rapl_package_joules_total counter
2753-
node_rapl_package_joules_total{index="0"} 240422.366267
2753+
node_rapl_package_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0"} 240422.366267
27542754
# HELP node_schedstat_running_seconds_total Number of seconds CPU spent running a process.
27552755
# TYPE node_schedstat_running_seconds_total counter
27562756
node_schedstat_running_seconds_total{cpu="0"} 2.045936778163039e+06

collector/rapl_linux.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14+
//go:build !norapl
1415
// +build !norapl
1516

1617
package collector
@@ -81,14 +82,15 @@ func (c *raplCollector) Update(ch chan<- prometheus.Metric) error {
8182
descriptor := prometheus.NewDesc(
8283
prometheus.BuildFQName(namespace, "rapl", rz.Name+"_joules_total"),
8384
"Current RAPL "+rz.Name+" value in joules",
84-
[]string{"index"}, nil,
85+
[]string{"index", "path"}, nil,
8586
)
8687

8788
ch <- prometheus.MustNewConstMetric(
8889
descriptor,
8990
prometheus.CounterValue,
9091
float64(newMicrojoules)/1000000.0,
9192
index,
93+
rz.Path,
9294
)
9395
}
9496
return nil

0 commit comments

Comments
 (0)