mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
cmd/swarm-smoke: inline metrics
This commit is contained in:
parent
de8a8afa22
commit
972e699479
2 changed files with 4 additions and 8 deletions
|
|
@ -16,6 +16,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
|
"github.com/ethereum/go-ethereum/metrics"
|
||||||
"github.com/ethereum/go-ethereum/swarm/storage/feed"
|
"github.com/ethereum/go-ethereum/swarm/storage/feed"
|
||||||
colorable "github.com/mattn/go-colorable"
|
colorable "github.com/mattn/go-colorable"
|
||||||
"github.com/pborman/uuid"
|
"github.com/pborman/uuid"
|
||||||
|
|
@ -27,7 +28,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func cliFeedUploadAndSync(c *cli.Context) error {
|
func cliFeedUploadAndSync(c *cli.Context) error {
|
||||||
feedUploadAndSyncCount.Inc(1)
|
metrics.GetOrRegisterCounter("feed-and-sync", nil).Inc(1)
|
||||||
log.Root().SetHandler(log.CallerFileHandler(log.LvlFilterHandler(log.Lvl(verbosity), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true)))))
|
log.Root().SetHandler(log.CallerFileHandler(log.LvlFilterHandler(log.Lvl(verbosity), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true)))))
|
||||||
|
|
||||||
errc := make(chan error)
|
errc := make(chan error)
|
||||||
|
|
@ -38,11 +39,11 @@ func cliFeedUploadAndSync(c *cli.Context) error {
|
||||||
select {
|
select {
|
||||||
case err := <-errc:
|
case err := <-errc:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
feedUploadAndSyncFailCount.Inc(1)
|
metrics.GetOrRegisterCounter("feed-and-sync.fail", nil).Inc(1)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
case <-time.After(time.Duration(timeout) * time.Second):
|
case <-time.After(time.Duration(timeout) * time.Second):
|
||||||
feedUploadAndSyncTimeout.Inc(1)
|
metrics.GetOrRegisterCounter("feed-and-sync.timeout", nil).Inc(1)
|
||||||
return fmt.Errorf("timeout after %v sec", timeout)
|
return fmt.Errorf("timeout after %v sec", timeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,6 @@ var (
|
||||||
verbosity int
|
verbosity int
|
||||||
timeout int
|
timeout int
|
||||||
)
|
)
|
||||||
var (
|
|
||||||
feedUploadAndSyncCount = gethmetrics.NewRegisteredCounter("feed-and-sync", nil)
|
|
||||||
feedUploadAndSyncFailCount = gethmetrics.NewRegisteredCounter("feed-and-sync.fail", nil)
|
|
||||||
feedUploadAndSyncTimeout = gethmetrics.NewRegisteredCounter("feed-and-sync.timeout", nil)
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue