Skip to content

Commit

Permalink
Fix exporter for different NUMA nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
PlagueCZ committed Oct 15, 2024
1 parent 6d6d43c commit 84cdfeb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
17 changes: 11 additions & 6 deletions cli/dpservice-exporter/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ func queryTelemetry(conn net.Conn, log *logrus.Logger, command string, response
}

func Update(conn net.Conn, hostname string, log *logrus.Logger) {
var dpserviceHeapInfo DpServiceHeapInfo
queryTelemetry(conn, log, "/eal/heap_info,0", &dpserviceHeapInfo)
for key, value := range dpserviceHeapInfo.Value {
// Only export metrics of type float64 (/eal/heap_info contains also some string values)
if v, ok := value.(float64); ok {
HeapInfo.With(prometheus.Labels{"node_name": hostname, "info": key}).Set(v)
var ealHeapList EalHeapList
queryTelemetry(conn, log, "/eal/heap_list", &ealHeapList)

for _, id := range ealHeapList.Value {
var ealHeapInfo EalHeapInfo
queryTelemetry(conn, log, fmt.Sprintf("/eal/heap_info,%d", id), &ealHeapInfo)
for key, value := range ealHeapInfo.Value {
// Only export metrics of type float64 (/eal/heap_info contains also some string values)
if v, ok := value.(float64); ok {
HeapInfo.With(prometheus.Labels{"node_name": hostname, "info": key}).Set(v)
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion cli/dpservice-exporter/metrics/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ type DpServiceGraphCallCount struct {
GraphCallCnt GraphCallCount `json:"/dp_service/graph/call_count"`
}

type DpServiceHeapInfo struct {
type EalHeapList struct {
Value []int `json:"/eal/heap_list"`
}

type EalHeapInfo struct {
Value map[string]any `json:"/eal/heap_info"`
}

Expand Down

0 comments on commit 84cdfeb

Please sign in to comment.