mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
add feed smoke metrics
This commit is contained in:
parent
238195adba
commit
5f932263de
2 changed files with 24 additions and 2 deletions
|
|
@ -26,11 +26,29 @@ const (
|
|||
feedRandomDataLength = 8
|
||||
)
|
||||
|
||||
// TODO: retrieve with manifest + extract repeating code
|
||||
func cliFeedUploadAndSync(c *cli.Context) error {
|
||||
|
||||
feedUploadAndSyncCount.Inc(1)
|
||||
log.Root().SetHandler(log.CallerFileHandler(log.LvlFilterHandler(log.Lvl(verbosity), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true)))))
|
||||
|
||||
errc := make(chan error)
|
||||
go func() {
|
||||
errc <- feedUploadAndSync(c)
|
||||
}()
|
||||
|
||||
select {
|
||||
case err := <-errc:
|
||||
if err != nil {
|
||||
feedUploadAndSyncFailCount.Inc(1)
|
||||
}
|
||||
return err
|
||||
case <-time.After(time.Duration(timeout) * time.Second):
|
||||
feedUploadAndSyncTimeout.Inc(1)
|
||||
return fmt.Errorf("timeout after %v sec", timeout)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: retrieve with manifest + extract repeating code
|
||||
func feedUploadAndSync(c *cli.Context) error {
|
||||
defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size (kb)", filesize) }(time.Now())
|
||||
|
||||
generateEndpoints(scheme, cluster, appName, from, to)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ var (
|
|||
timeout int
|
||||
)
|
||||
var (
|
||||
feedUploadAndSyncCount = gethmetrics.NewRegisteredCounter("swarm-smoke.feed-and-sync.count", nil)
|
||||
feedUploadAndSyncFailCount = gethmetrics.NewRegisteredCounter("swarm-smoke.feed-and-sync.fail.count", nil)
|
||||
feedUploadAndSyncRunTime = gethmetrics.NewRegisteredCounter("swarm-smoke.feed-and-sync.time", nil)
|
||||
feedUploadAndSyncTimeout = gethmetrics.NewRegisteredCounter("swarm-smoke.feed-and-sync.timeout", nil)
|
||||
smokeUploadAndSyncCount = gethmetrics.NewRegisteredCounter("swarm-smoke.upload-and-sync.count", nil)
|
||||
smokeUploadAndSyncFailCount = gethmetrics.NewRegisteredCounter("swarm-smoke.upload-and-sync.fail.count", nil)
|
||||
smokeUploadAndSyncRunTime = gethmetrics.NewRegisteredCounter("swarm-smoke.upload-and-sync.time", nil)
|
||||
|
|
|
|||
Loading…
Reference in a new issue