Skip to content

Commit

Permalink
Merge pull request #126 from nspcc-dev/118-label-symbol-gas
Browse files Browse the repository at this point in the history
Remove label field in metric
  • Loading branch information
roman-khimov authored Mar 4, 2024
2 parents e55f4fe + 858fcfa commit fe547b4
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 10 deletions.
2 changes: 0 additions & 2 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ logger:

nep17:
- contract: "gas"
label: "GAS"
# allows to return the total token supply currently available.
# totalSupply: true
balanceOf:
- 3c3f4b84773ef0141576e48c3ff60e5078235891
- contract: "NEO"
label: "neo"
balanceOf:
- NSPCCpw8YmgNDYWiBfXJHRfz38NDjv6WW3
- NSPCCa2T6nc2kYcgWC2k68boyGgc9YdKsj
Expand Down
1 change: 0 additions & 1 deletion pkg/model/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package model

// Nep17Balance describes universal balance task configuration.
type Nep17Balance struct {
Label string `yaml:"label"`
Contract string `yaml:"contract"`
TotalSupply bool `yaml:"totalSupply"`
BalanceOf []string `yaml:"balanceOf"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/monitor/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ var (
Help: "NEP-17 balance of contract and account",
},
[]string{
"label", "symbol", "contract", "account",
"symbol", "contract", "account",
},
)

Expand All @@ -186,7 +186,7 @@ var (
Help: "NEP-17 total supply of contract",
},
[]string{
"label", "symbol", "contract",
"symbol", "contract",
},
)
)
Expand Down
3 changes: 0 additions & 3 deletions pkg/monitor/nep17.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type (

// Item describes task for [Nep17tracker].
Item struct {
Label string
Symbol string
Hash util.Uint160
Accounts []util.Uint160
Expand All @@ -45,7 +44,6 @@ func ParseNep17Tasks(balanceFetcher Nep17BalanceFetcher, items []model.Nep17Bala
)

task := Item{
Label: it.Label,
Total: it.TotalSupply,
Accounts: make([]util.Uint160, 0, len(it.BalanceOf)),
}
Expand Down Expand Up @@ -73,7 +71,6 @@ func ParseNep17Tasks(balanceFetcher Nep17BalanceFetcher, items []model.Nep17Bala
zap.L().Error(
"parse nep17 account",
zap.Error(err),
zap.String("label", it.Label),
zap.String("contract", contract.StringLE()),
zap.String("balanceOf", balanceOf),
)
Expand Down
2 changes: 0 additions & 2 deletions pkg/monitor/nep17tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func (n *Nep17tracker) Process(metric *prometheus.GaugeVec, metricTotal *prometh
}

metric.WithLabelValues(
item.Label,
item.Symbol,
item.Hash.StringLE(),
address.Uint160ToString(acc),
Expand All @@ -57,7 +56,6 @@ func (n *Nep17tracker) Process(metric *prometheus.GaugeVec, metricTotal *prometh
}

metricTotal.WithLabelValues(
item.Label,
item.Symbol,
item.Hash.StringLE(),
).Set(balance)
Expand Down

0 comments on commit fe547b4

Please sign in to comment.