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] - beacon: add public metrics for current and next epoch #4813

Closed
Closed
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions beacon/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/spacemeshos/go-spacemesh/common/types/result"
"github.com/spacemeshos/go-spacemesh/datastore"
"github.com/spacemeshos/go-spacemesh/log"
"github.com/spacemeshos/go-spacemesh/metrics/public"
"github.com/spacemeshos/go-spacemesh/p2p/pubsub"
"github.com/spacemeshos/go-spacemesh/signing"
"github.com/spacemeshos/go-spacemesh/sql"
Expand Down Expand Up @@ -506,6 +507,13 @@ func (pd *ProtocolDriver) setBeacon(targetEpoch types.EpochID, beacon types.Beac
}
pd.beacons[targetEpoch] = beacon
pd.onResult(targetEpoch, beacon)
curr := pd.clock.CurrentLayer().GetEpoch()
switch targetEpoch {
case curr:
public.CurrentBeacon.WithLabelValues(beacon.String())
case curr + 1:
public.NextBeacon.WithLabelValues(beacon.String())
}
return nil
}

Expand Down
10 changes: 10 additions & 0 deletions metrics/public/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
Namespace: "smh",
Name: "version",
}, []string{"version"})
CurrentBeacon = promauto.With(Registry).NewGaugeVec(prometheus.GaugeOpts{
Namespace: "smh",
Subset: "beacon",
Name: "current,

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / lint

newline in string

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected newline in composite literal; possibly missing comma or } (compile)

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / quicktests

string literal not terminated

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / unittests (macos-latest)

newline in string

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / unittests (macos-latest)

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / unittests (macos-latest)

newline in string

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / unittests (macos-latest)

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / unittests-slower (self-hosted, linux, arm64)

newline in string

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / unittests-slower (self-hosted, linux, arm64)

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / unittests-slower (self-hosted, linux, arm64)

newline in string

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / unittests-slower (self-hosted, linux, arm64)

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / unittests-slower (windows-latest)

newline in string

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / unittests-slower (windows-latest)

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / unittests-slower (windows-latest)

newline in string

Check failure on line 32 in metrics/public/public.go

View workflow job for this annotation

GitHub Actions / unittests-slower (windows-latest)

syntax error: unexpected newline in composite literal; possibly missing comma or }
}, []string{"beacon"})
NextBeacon = promauto.With(Registry).NewGaugeVec(prometheus.GaugeOpts{
Namespace: "smh",
Subset: "beacon",
Name: "next",
}, []string{"beacon"})

SmeshingOptsProvingNonces = promauto.With(Registry).NewGaugeVec(prometheus.GaugeOpts{
Namespace: "smh",
Expand Down