improve logging
This commit is contained in:
parent
7dc5c2c5fb
commit
53c3a629c5
23
exporter.go
23
exporter.go
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -345,7 +344,7 @@ func (e *Exporter) collectOracleMetrics(wg *sync.WaitGroup, ch chan<- prometheus
|
|||
|
||||
currentOraclePrice, err := heliumapi.GetCurrentOraclePrice()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -360,7 +359,7 @@ func (e *Exporter) collectStatsMetrics(wg *sync.WaitGroup, ch chan<- prometheus.
|
|||
|
||||
blockchainStats, err := heliumapi.GetBlockchainStats()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -402,7 +401,7 @@ func (e *Exporter) collectAccountMetrics(wg *sync.WaitGroup, ch chan<- prometheu
|
|||
|
||||
accountForAddress, err := heliumapi.GetAccountForAddress(account.Address)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -418,7 +417,7 @@ func (e *Exporter) collectAccountActivityMetrics(wg *sync.WaitGroup, ch chan<- p
|
|||
|
||||
accountActivityForAddress, err := heliumapi.GetActivityCountsForAccount(account.Address)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -436,7 +435,7 @@ func (e *Exporter) collectAccountRewardsTotalMetrics(wg *sync.WaitGroup, ch chan
|
|||
|
||||
accountRewardTotalsForAddress, err := heliumapi.GetRewardTotalsForAccount(account.Address, &e.StartTime, nil)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -458,7 +457,7 @@ func (e *Exporter) collectAccountTransactionsMetrics(wg *sync.WaitGroup, ch chan
|
|||
now := time.Now()
|
||||
activities, err := heliumapi.GetActivityForAccount(account.Address, []string{}, &account.Tx.LastUpdate, &now)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -538,7 +537,7 @@ func (e *Exporter) collectHotspotMetrics(wg *sync.WaitGroup, ch chan<- prometheu
|
|||
|
||||
hotspotsForAddress, err := heliumapi.GetHotspotsForAccount(account.Address)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -581,7 +580,7 @@ func (e *Exporter) collectHotspotActivityMetrics(wg *sync.WaitGroup, ch chan<- p
|
|||
|
||||
hotspotActivityForAddress, err := heliumapi.GetHotspotActivityCounts(hotspotData.Address)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -599,7 +598,7 @@ func (e *Exporter) collectHotspotRewardsMetrics(wg *sync.WaitGroup, ch chan<- pr
|
|||
|
||||
hotspotRewardTotalsForAddress, err := heliumapi.GetRewardsTotalForHotspot(hotspotData.Address, &e.StartTime, nil)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -641,9 +640,9 @@ func main() {
|
|||
})
|
||||
|
||||
http.Handle(*fMetricsPath, promhttp.HandlerFor(r, promhttp.HandlerOpts{}))
|
||||
fmt.Printf("listening on %v\n", serverAddr)
|
||||
log.Printf("listening on %v\n", serverAddr)
|
||||
if err = http.ListenAndServe(serverAddr, nil); err != nil {
|
||||
fmt.Println(err)
|
||||
log.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package activity
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
)
|
||||
|
||||
type ActivityResp struct {
|
||||
|
@ -88,7 +89,7 @@ func NewActivities(resp ActivityResp) (*Activities, error) {
|
|||
}
|
||||
activities.UnstakeValidatorV1 = append(activities.UnstakeValidatorV1, unstakeValidatorV1)
|
||||
default:
|
||||
fmt.Printf("ignoring unimplemented activy type: %v", activityType.Type)
|
||||
log.Printf("ignoring unimplemented activy type: %v", activityType.Type)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue