Skip to content

Commit

Permalink
Update process CPU metric (prometheus-community#520)
Browse files Browse the repository at this point in the history
With PR prometheus-community#498, we only have one process CPU metric.
* Drop the label.
* Update the name to match Prometheus naming.

Signed-off-by: SuperQ <superq@gmail.com>
Signed-off-by: iishabakaev <iishabakaev@gmail.com>
  • Loading branch information
SuperQ authored and iishabakaev committed Jun 8, 2022
1 parent fbc11b1 commit c14ebd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ Further Information
| elasticsearch_os_load5 | gauge | 1 | Midterm load average
| elasticsearch_os_load15 | gauge | 1 | Longterm load average
| elasticsearch_process_cpu_percent | gauge | 1 | Percent CPU used by process
| elasticsearch_process_cpu_time_seconds_sum | counter | 3 | Process CPU time in seconds
| elasticsearch_process_cpu_seconds_total | counter | 1 | Process CPU time in seconds
| elasticsearch_process_mem_resident_size_bytes | gauge | 1 | Resident memory in use by process in bytes
| elasticsearch_process_mem_share_size_bytes | gauge | 1 | Shared memory in use by process in bytes
| elasticsearch_process_mem_virtual_size_bytes | gauge | 1 | Total virtual memory used in bytes
Expand Down
6 changes: 3 additions & 3 deletions collector/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -1437,15 +1437,15 @@ func NewNodes(logger log.Logger, client *http.Client, url *url.URL, all bool, no
{
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "process", "cpu_time_seconds_sum"),
prometheus.BuildFQName(namespace, "process", "cpu_seconds_total"),
"Process CPU time in seconds",
append(defaultNodeLabels, "type"), nil,
defaultNodeLabels, nil,
),
Value: func(node NodeStatsNodeResponse) float64 {
return float64(node.Process.CPU.Total) / 1000
},
Labels: func(cluster string, node NodeStatsNodeResponse) []string {
return append(defaultNodeLabelValues(cluster, node), "total")
return defaultNodeLabelValues(cluster, node)
},
},
{
Expand Down

0 comments on commit c14ebd3

Please sign in to comment.