From 6a7eea557b3fbbbfb9251412850afc5a09d0cf71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarom=C3=ADr=20Smr=C4=8Dek?= <4plague@gmail.com> Date: Fri, 27 Sep 2024 14:53:27 +0200 Subject: [PATCH] Fix exporter for different NUMA nodes --- cli/dpservice-exporter/metrics/metrics.go | 17 +++++++++++------ cli/dpservice-exporter/metrics/types.go | 6 +++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/cli/dpservice-exporter/metrics/metrics.go b/cli/dpservice-exporter/metrics/metrics.go index b6bf5cba..02bd8ba6 100644 --- a/cli/dpservice-exporter/metrics/metrics.go +++ b/cli/dpservice-exporter/metrics/metrics.go @@ -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) + } } } diff --git a/cli/dpservice-exporter/metrics/types.go b/cli/dpservice-exporter/metrics/types.go index a4e2342a..4b833380 100644 --- a/cli/dpservice-exporter/metrics/types.go +++ b/cli/dpservice-exporter/metrics/types.go @@ -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"` }