From aa7bfb871f3101077678d909d0862f8ba0169845 Mon Sep 17 00:00:00 2001 From: Evgenii Baidakov Date: Thu, 29 Feb 2024 14:51:13 +0400 Subject: [PATCH 1/2] monitor: Export account as address Closes #119. Signed-off-by: Evgenii Baidakov --- pkg/monitor/nep17tracker.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/monitor/nep17tracker.go b/pkg/monitor/nep17tracker.go index d7b3981..0c58122 100644 --- a/pkg/monitor/nep17tracker.go +++ b/pkg/monitor/nep17tracker.go @@ -1,6 +1,7 @@ package monitor import ( + "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/prometheus/client_golang/prometheus" "go.uber.org/zap" ) @@ -27,7 +28,7 @@ func (n *Nep17tracker) Process(metric *prometheus.GaugeVec, metricTotal *prometh for _, acc := range item.Accounts { balance, err := n.balanceFetcher.Fetch(item.Hash, acc) if err != nil { - zap.L().Error("nep17 balance", zap.Error(err), zap.String("contract", item.Hash.StringLE()), zap.String("account", acc.StringLE())) + zap.L().Error("nep17 balance", zap.Error(err), zap.String("contract", item.Hash.StringLE()), zap.String("account", address.Uint160ToString(acc))) continue } @@ -35,7 +36,7 @@ func (n *Nep17tracker) Process(metric *prometheus.GaugeVec, metricTotal *prometh item.Label, item.Symbol, item.Hash.StringLE(), - acc.StringLE(), + address.Uint160ToString(acc), ).Set(balance) } From 4cd9e0c7f94e3943743c1a9889aaf2a3f03a46f1 Mon Sep 17 00:00:00 2001 From: Evgenii Baidakov Date: Thu, 29 Feb 2024 14:51:36 +0400 Subject: [PATCH 2/2] monitor: Format logs Signed-off-by: Evgenii Baidakov --- pkg/monitor/nep17tracker.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/monitor/nep17tracker.go b/pkg/monitor/nep17tracker.go index 0c58122..a5ea155 100644 --- a/pkg/monitor/nep17tracker.go +++ b/pkg/monitor/nep17tracker.go @@ -28,7 +28,12 @@ func (n *Nep17tracker) Process(metric *prometheus.GaugeVec, metricTotal *prometh for _, acc := range item.Accounts { balance, err := n.balanceFetcher.Fetch(item.Hash, acc) if err != nil { - zap.L().Error("nep17 balance", zap.Error(err), zap.String("contract", item.Hash.StringLE()), zap.String("account", address.Uint160ToString(acc))) + zap.L().Error( + "nep17 balance", + zap.Error(err), + zap.String("contract", item.Hash.StringLE()), + zap.String("account", address.Uint160ToString(acc)), + ) continue } @@ -43,7 +48,11 @@ func (n *Nep17tracker) Process(metric *prometheus.GaugeVec, metricTotal *prometh if item.Total { balance, err := n.balanceFetcher.FetchTotalSupply(item.Hash) if err != nil { - zap.L().Error("nep17 total balance", zap.Error(err), zap.String("contract", item.Hash.StringLE())) + zap.L().Error( + "nep17 total balance", + zap.Error(err), + zap.String("contract", item.Hash.StringLE()), + ) continue }