Skip to content

Commit

Permalink
Look for string/number in a subkey data
Browse files Browse the repository at this point in the history
  • Loading branch information
cmmarslender committed Sep 22, 2023
1 parent a0cf948 commit 77f2fc0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/metrics/fullnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 77f2fc0

Please sign in to comment.