Skip to content

Commit

Permalink
fix mess in metrics (#4740)
Browse files Browse the repository at this point in the history
  • Loading branch information
dshulyak committed Jul 22, 2023
1 parent 9453284 commit 0bd65e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func init() {
type Config struct {
BaseConfig `mapstructure:"main"`
Genesis *GenesisConfig `mapstructure:"genesis"`
PublicMetrics PublicMetrics `mapstructure:"public-metrics"`
Tortoise tortoise.Config `mapstructure:"tortoise"`
P2P p2p.Config `mapstructure:"p2p"`
API grpcserver.Config `mapstructure:"api"`
Expand Down Expand Up @@ -85,8 +86,6 @@ type BaseConfig struct {
CollectMetrics bool `mapstructure:"metrics"`
MetricsPort int `mapstructure:"metrics-port"`

PublicMetrics PublicMetrics `mapstructure:"public-metrics"`

ProfilerName string `mapstructure:"profiler-name"`
ProfilerURL string `mapstructure:"profiler-url"`

Expand Down
4 changes: 3 additions & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import (
vm "github.com/spacemeshos/go-spacemesh/genvm"
"github.com/spacemeshos/go-spacemesh/hare"
"github.com/spacemeshos/go-spacemesh/hare/eligibility"
"github.com/spacemeshos/go-spacemesh/hash"
"github.com/spacemeshos/go-spacemesh/layerpatrol"
"github.com/spacemeshos/go-spacemesh/log"
"github.com/spacemeshos/go-spacemesh/malfeasance"
Expand Down Expand Up @@ -1386,13 +1387,14 @@ func (app *App) Start(ctx context.Context) error {
}

if app.Config.PublicMetrics.MetricsURL != "" {
id := hash.Sum([]byte(app.host.ID()))
metrics.StartPushingMetrics(
app.Config.PublicMetrics.MetricsURL,
app.Config.PublicMetrics.MetricsPushUser,
app.Config.PublicMetrics.MetricsPushPass,
app.Config.PublicMetrics.MetricsPushHeader,
app.Config.PublicMetrics.MetricsPushPeriod,
app.host.ID().String()[:5], app.Config.Genesis.GenesisID().ShortString())
types.Hash32(id).ShortString(), app.Config.Genesis.GenesisID().ShortString())
}

if err := app.startServices(ctx); err != nil {
Expand Down

0 comments on commit 0bd65e1

Please sign in to comment.