-
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
Merged
Merged
Add ethstats support #1239
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e9e4e63
add ethstats integration
matkt c569630
add missing files
matkt 3f534e3
Merge branch 'master' into add-ethstats-socket
matkt 27a8ac4
change log level
matkt 6c83286
clean code
matkt 0ad42ac
reset invalid referencetest modification
matkt e5b3bba
fix tests
matkt 4ddaa2f
fix tests
matkt d288ed6
fix tests
matkt 28724e5
fix tests
matkt 63b9289
add immutables library for ethstats
matkt 94aa749
fix review issues
matkt 35caaee
Merge branch 'master' into add-ethstats-socket
matkt f614c94
fix review issues
matkt 80cf14a
Merge remote-tracking branch 'origin/add-ethstats-socket' into add-et…
matkt d15e47c
Merge branch 'upstream/master' into add-ethstats-socket
matkt 028bff7
clean merge
matkt dcf5b10
Merge branch 'master' into add-ethstats-socket
matkt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,7 @@ | |
import java.util.stream.Collectors; | ||
|
||
import com.google.common.annotations.VisibleForTesting; | ||
import com.google.common.base.Strings; | ||
import com.google.common.base.Suppliers; | ||
import com.google.common.collect.ImmutableMap; | ||
import com.google.common.io.Resources; | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Let's start these out as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
paramLabel = "<nodename:secret@host:port>", | ||
description = "Reporting URL of a ethstats server", | ||
arity = "1") | ||
private String ethstatsUrl = ""; | ||
|
||
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) | ||
@Option( | ||
names = {"--ethstats-contact"}, | ||
description = "Contact address to send to ethstats server", | ||
arity = "1") | ||
private String ethstatsContact = ""; | ||
|
||
private EthNetworkConfig ethNetworkConfig; | ||
private JsonRpcConfiguration jsonRpcConfiguration; | ||
private GraphQLConfiguration graphQLConfiguration; | ||
|
@@ -1319,6 +1335,7 @@ private BesuCommand validateOptions() { | |
validateP2PInterface(p2pInterface); | ||
validateMiningParams(); | ||
validateNatParams(); | ||
validateNetStatsParams(); | ||
|
||
return this; | ||
} | ||
|
@@ -1367,6 +1384,15 @@ private void validateNatParams() { | |
} | ||
} | ||
|
||
private void validateNetStatsParams() { | ||
if (Strings.isNullOrEmpty(ethstatsUrl) && !ethstatsContact.isEmpty()) { | ||
throw new ParameterException( | ||
this.commandLine, | ||
"The `--ethstats-contact` requires that an url to a ethstats server is provided. Either remove --ethstats-contact" | ||
+ " or provide an url (via --ethstats=nodename:secret@host:port)"); | ||
} | ||
} | ||
|
||
private void issueOptionWarnings() { | ||
// Check that P2P options are able to work | ||
CommandLineUtils.checkOptionDependencies( | ||
|
@@ -2047,6 +2073,8 @@ private void synchronize( | |
.identityString(identityString) | ||
.besuPluginContext(besuPluginContext) | ||
.autoLogBloomCaching(autoLogBloomCachingEnabled) | ||
.ethstatsUrl(ethstatsUrl) | ||
.ethstatsContact(ethstatsContact) | ||
.build(); | ||
|
||
addShutdownHook(runner); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright ConsenSys AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
apply plugin: 'java-library' | ||
|
||
jar { | ||
archiveBaseName = 'besu-ethereum-ethstats' | ||
manifest { | ||
attributes( | ||
'Specification-Title': archiveBaseName, | ||
'Specification-Version': project.version, | ||
'Implementation-Title': archiveBaseName, | ||
'Implementation-Version': calculateVersion() | ||
) | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'com.fasterxml.jackson.core:jackson-databind' | ||
implementation 'com.google.guava:guava' | ||
implementation 'com.squareup.okhttp3:okhttp' | ||
implementation 'org.apache.logging.log4j:log4j-api' | ||
implementation 'io.vertx:vertx-core' | ||
implementation 'org.apache.tuweni:tuweni-bytes' | ||
|
||
implementation project(':consensus:clique') | ||
implementation project(':config') | ||
implementation project(':util') | ||
implementation project(':ethereum:api') | ||
implementation project(':ethereum:blockcreation') | ||
implementation project(':ethereum:core') | ||
implementation project(':ethereum:eth') | ||
implementation project(':ethereum:p2p') | ||
implementation project(':plugin-api') | ||
|
||
runtimeOnly 'org.apache.logging.log4j:log4j-core' | ||
|
||
// test dependencies. | ||
testImplementation project(path: ':ethereum:core', configuration: 'testArtifacts') | ||
testImplementation project(path: ':ethereum:core', configuration: 'testSupportArtifacts') | ||
testImplementation project(':testutil') | ||
testImplementation project(':metrics:core') | ||
|
||
testImplementation 'junit:junit' | ||
testImplementation 'org.assertj:assertj-core' | ||
testImplementation 'org.mockito:mockito-core' | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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