-
Notifications
You must be signed in to change notification settings - Fork 877
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
Add ethstats support #1239
Add ethstats support #1239
Conversation
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public class AuthenticationData { |
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.
Should this and the other object be created using the Immutables framework? There are some special annotations for immutables: https://immutables.github.io/json.html#jackson
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.
You are right, it is a good opportunity to integrate Immutables into Besu. I just did it
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
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 add stop method.
@@ -122,6 +126,9 @@ public void start() { | |||
writeBesuNetworksToFile(); | |||
autoTransactionLogBloomCachingService.ifPresent(AutoTransactionLogBloomCachingService::start); | |||
writePidFile(); | |||
|
|||
ethStatsService.ifPresent(EthStatsService::start); |
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.
I think you missed the stop
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.
good catch, I just added it
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
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.
Looks good to me.
@@ -169,8 +177,7 @@ public void start() { | |||
// send a full report after the connection | |||
sendFullReport(); | |||
} else { | |||
LOG.error("Failed to login to ethstats server"); | |||
retryConnect(); | |||
LOG.error("Failed to login to ethstats server " + ack); |
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.
LOG.error("Failed to login to ethstats server " + ack); | |
LOG.error("Failed to login to ethstats server {}", ack); |
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.
Done
.id(enodeURL.getNodeId().toHexString()) | ||
.currentTime(String.valueOf(pingTimestamp)) | ||
.build(); | ||
sendMessage(webSocket, new EthStatsRequest(NODE_PING, pingReport)); |
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.
How would this look with the @Parameter
annotation on the key fields? That would open up the .of(...)
static method and these singe use cases could become (I'm guesssing on the auto-formattting)...
sendMessage(
webSocket,
new EthStatsRequest(
NODE_PING,
ImmutablePingReport.of(
enodeURL.getNodeId().toHexString(),
String.valueOf(pingTimestamp))));
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.
Done. I added this in everything except in two object because having the builder allow to use this feature https://immutables.github.io/immutable.html#wrappertupple-initializers-inlined-as-alternative-setters-with-deep- immutables-detection
@@ -1039,6 +1040,21 @@ void setBannedNodeIds(final List<String> values) { | |||
arity = "1") | |||
private final Long wsTimeoutSec = TimeoutOptions.defaultOptions().getTimeoutSeconds(); | |||
|
|||
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) | |||
@Option( | |||
names = {"--ethstats"}, |
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.
Let's start these out as --X
options and make them standard after one dot-dot release cycle without issues.
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.
Done
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
25780ac
to
aaecf78
Compare
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
aaecf78
to
028bff7
Compare
LGTM |
PR description
Added support for ethstat in Besu. To send stats you have to start Besu with
Support with or without SSL
Tested
Fixed Issue(s)