From 77f2fc0712b30ddc074a89cb41e5fb6e94d8f45a Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Thu, 21 Sep 2023 21:08:13 -0500 Subject: [PATCH] Look for string/number in a subkey `data` --- internal/metrics/fullnode.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/metrics/fullnode.go b/internal/metrics/fullnode.go index 3f7ef06..24ccb11 100644 --- a/internal/metrics/fullnode.go +++ b/internal/metrics/fullnode.go @@ -346,14 +346,17 @@ func (s *FullNodeServiceMetrics) SignagePoint(resp *types.WebsocketResponse) { // Expects map[string]number - where number is able to be parsed into a float64 type // Assigns the key (string) as the "key" label on the metric, and passes the value straight through func (s *FullNodeServiceMetrics) Debug(resp *types.WebsocketResponse) { - debugMetrics := map[string]float64{} + type debugEvent struct { + Data map[string]float64 `json:"data"` + } + debugMetrics := debugEvent{} err := json.Unmarshal(resp.Data, &debugMetrics) if err != nil { log.Errorf("Error unmarshalling debugMetrics: %s\n", err.Error()) return } - for key, value := range debugMetrics { + for key, value := range debugMetrics.Data { s.debug.WithLabelValues(key).Set(value) } }