diff --git a/Makefile b/Makefile index 5b33d98..85ffdb4 100644 --- a/Makefile +++ b/Makefile @@ -96,7 +96,7 @@ dist: $(TARGET_DIR) $(SRC) # docker: build the docker image .PHONY: docker -docker: $(BIN) +docker: $(DOCKERBUILD) -t $(PROGRAM) . $(foreach tag,$(DOCKER_TAGS),$(DOCKERTAG) $(PROGRAM) $(tag);) diff --git a/exporter.go b/exporter.go index 012ab55..767c216 100644 --- a/exporter.go +++ b/exporter.go @@ -67,7 +67,9 @@ func NewAccount(address string) Account { } const ( - namespace = "helium" + namespace = "helium" + blockchain_oracle_factor = 100000000 + blockchain_hnt_factor = 100000000 ) var ( @@ -348,7 +350,7 @@ func (e *Exporter) collectOracleMetrics(wg *sync.WaitGroup, ch chan<- prometheus } ch <- prometheus.MustNewConstMetric( - oraclePrice.Desc, oraclePrice.Type, float64(currentOraclePrice.Price)/100000000, + oraclePrice.Desc, oraclePrice.Type, float64(currentOraclePrice.Price)/blockchain_oracle_factor, ) } @@ -405,7 +407,7 @@ func (e *Exporter) collectAccountMetrics(wg *sync.WaitGroup, ch chan<- prometheu } ch <- prometheus.MustNewConstMetric( - accountBalanceHnt.Desc, accountBalanceHnt.Type, float64(accountForAddress.Balance), + accountBalanceHnt.Desc, accountBalanceHnt.Type, float64(accountForAddress.Balance)/blockchain_hnt_factor, account.Address, ) } @@ -439,7 +441,7 @@ func (e *Exporter) collectAccountRewardsTotalMetrics(wg *sync.WaitGroup, ch chan } ch <- prometheus.MustNewConstMetric( - accountRewardsHnt.Desc, accountRewardsHnt.Type, accountRewardTotalsForAddress.Sum, + accountRewardsHnt.Desc, accountRewardsHnt.Type, accountRewardTotalsForAddress.Sum/blockchain_hnt_factor, account.Address, ) } @@ -521,11 +523,11 @@ func (e *Exporter) collectAccountTransactionsMetrics(wg *sync.WaitGroup, ch chan account.Tx.LastUpdate = now ch <- prometheus.MustNewConstMetric( - accountDepositsHnt.Desc, accountDepositsHnt.Type, float64(account.Tx.DepositTotal), + accountDepositsHnt.Desc, accountDepositsHnt.Type, float64(account.Tx.DepositTotal)/blockchain_hnt_factor, account.Address, ) ch <- prometheus.MustNewConstMetric( - accountWithdrawalsHnt.Desc, accountWithdrawalsHnt.Type, float64(account.Tx.WithdrawalTotal), + accountWithdrawalsHnt.Desc, accountWithdrawalsHnt.Type, float64(account.Tx.WithdrawalTotal)/blockchain_hnt_factor, account.Address, ) } @@ -602,7 +604,7 @@ func (e *Exporter) collectHotspotRewardsMetrics(wg *sync.WaitGroup, ch chan<- pr } ch <- prometheus.MustNewConstMetric( - hotspotRewardsHnt.Desc, hotspotRewardsHnt.Type, hotspotRewardTotalsForAddress.Sum, + hotspotRewardsHnt.Desc, hotspotRewardsHnt.Type, hotspotRewardTotalsForAddress.Sum/blockchain_hnt_factor, account.Address, hotspotData.Address, hotspotData.Name, ) }