Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - fix mess in metrics #4740

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@
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 @@ -1381,13 +1382,14 @@
}

if app.Config.PublicMetrics.MetricsURL != "" {
id := hash.Sum([]byte(app.host.ID()))

Check warning on line 1385 in node/node.go

View check run for this annotation

Codecov / codecov/patch

node/node.go#L1385

Added line #L1385 was not covered by tests
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())

Check warning on line 1392 in node/node.go

View check run for this annotation

Codecov / codecov/patch

node/node.go#L1392

Added line #L1392 was not covered by tests
}

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