-
Notifications
You must be signed in to change notification settings - Fork 198
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
made epoch start metrics persistent and/or fetch from epoch bootstrapper #1872
Conversation
@@ -863,6 +863,7 @@ func startNode(ctx *cli.Context, log logger.Logger, version string) error { | |||
Rounder: rounder, | |||
AddressPubkeyConverter: addressPubkeyConverter, | |||
LatestStorageDataProvider: latestStorageDataProvider, | |||
StatusHandler: coreComponents.StatusHandler, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check if this is the correct instance. We have an issue regarding coreComponents.StatusHandler. It is instantiated twice (one mock, and then the "real" one). ⚔️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is ok. on main.go, line 738 we see a :
coreComponents.StatusHandler = statusHandlersInfo.StatusHandler
and the bootstrapper args are written on line 839
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the nil
implementation of status handler is used when returning the Core Components but the value is filled after status handlers are created
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -88,6 +89,9 @@ func checkArguments(args ArgsEpochStartBootstrap) error { | |||
if args.GeneralConfig.EpochStartConfig.MinNumConnectedPeersToStart < minNumConnectedPeers { | |||
return fmt.Errorf("%s: %w", baseErrorMessage, epochStart.ErrNotEnoughNumConnectedPeers) | |||
} | |||
if check.IfNil(args.StatusHandler) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will hide errors, since we injected the status handler on the constructor. Suggestion to return error here and fix all integration tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also added nil checks when using the status handler inside bootstrapper, as it is only an additional component.
epochStart/bootstrap/process.go
Outdated
@@ -878,6 +881,11 @@ func (e *epochStartBootstrap) createRequestHandler() error { | |||
return err | |||
} | |||
|
|||
func (e *epochStartBootstrap) setEpochStartMetrics() { | |||
e.statusHandler.SetUInt64Value(core.MetricNonceAtEpochStart, e.epochStartMeta.Nonce) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we also rewrite the metrics for erd_nonces_passed_in_current_epoch
and erd_rounds_passed_in_current_epoch
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, those are calculated when calling the API endpoint. So it is ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
The base branch was changed.
epochStart/bootstrap/process.go
Outdated
@@ -891,8 +892,10 @@ func (e *epochStartBootstrap) createRequestHandler() error { | |||
} | |||
|
|||
func (e *epochStartBootstrap) setEpochStartMetrics() { | |||
e.statusHandler.SetUInt64Value(core.MetricNonceAtEpochStart, e.epochStartMeta.Nonce) | |||
e.statusHandler.SetUInt64Value(core.MetricRoundAtEpochStart, e.epochStartMeta.Round) | |||
if !check.IfNil(e.statusHandler) && e.epochStartMeta != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need the check !check.IfNil(e.statusHandler) ?
d938d58
cafcba8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System tests passed.
Made metrics related to nonce and round at epoch start persistent