add path label to rapl collector (#2146)

Signed-off-by: binjip978 <binjip978@gmail.com>
pull/2088/head
Sergei Semenchuk 2021-09-27 23:57:03 +03:00 committed by GitHub
parent 60e9670f14
commit 2b490d645e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -2747,10 +2747,10 @@ node_qdisc_requeues_total{device="eth0",kind="pfifo_fast"} 2
node_qdisc_requeues_total{device="wlan0",kind="fq"} 1 node_qdisc_requeues_total{device="wlan0",kind="fq"} 1
# HELP node_rapl_core_joules_total Current RAPL core value in joules # HELP node_rapl_core_joules_total Current RAPL core value in joules
# TYPE node_rapl_core_joules_total counter # TYPE node_rapl_core_joules_total counter
node_rapl_core_joules_total{index="0"} 118821.284256 node_rapl_core_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0:0"} 118821.284256
# HELP node_rapl_package_joules_total Current RAPL package value in joules # HELP node_rapl_package_joules_total Current RAPL package value in joules
# TYPE node_rapl_package_joules_total counter # TYPE node_rapl_package_joules_total counter
node_rapl_package_joules_total{index="0"} 240422.366267 node_rapl_package_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0"} 240422.366267
# HELP node_schedstat_running_seconds_total Number of seconds CPU spent running a process. # HELP node_schedstat_running_seconds_total Number of seconds CPU spent running a process.
# TYPE node_schedstat_running_seconds_total counter # TYPE node_schedstat_running_seconds_total counter
node_schedstat_running_seconds_total{cpu="0"} 2.045936778163039e+06 node_schedstat_running_seconds_total{cpu="0"} 2.045936778163039e+06

View File

@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//go:build !norapl
// +build !norapl // +build !norapl
package collector package collector
@ -81,7 +82,7 @@ func (c *raplCollector) Update(ch chan<- prometheus.Metric) error {
descriptor := prometheus.NewDesc( descriptor := prometheus.NewDesc(
prometheus.BuildFQName(namespace, "rapl", rz.Name+"_joules_total"), prometheus.BuildFQName(namespace, "rapl", rz.Name+"_joules_total"),
"Current RAPL "+rz.Name+" value in joules", "Current RAPL "+rz.Name+" value in joules",
[]string{"index"}, nil, []string{"index", "path"}, nil,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@ -89,6 +90,7 @@ func (c *raplCollector) Update(ch chan<- prometheus.Metric) error {
prometheus.CounterValue, prometheus.CounterValue,
float64(newMicrojoules)/1000000.0, float64(newMicrojoules)/1000000.0,
index, index,
rz.Path,
) )
} }
return nil return nil