-
Notifications
You must be signed in to change notification settings - Fork 147
Refactor metrics to handle multiple subnetworks #936
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
Merged
Changes from all commits
Commits
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,52 @@ | ||
use std::net::SocketAddr; | ||
|
||
use ethereum_types::H256; | ||
|
||
use ethportal_api::types::bootnodes::Bootnodes; | ||
use ethportal_api::types::cli::TrinConfig; | ||
use ethportal_api::types::distance::Distance; | ||
|
||
/// Capacity of the cache for observed `NodeAddress` values. | ||
/// Provides capacity for 32 full k-buckets. This capacity will be shared among all active portal | ||
/// subnetworks. | ||
const NODE_ADDR_CACHE_CAPACITY: usize = discv5::kbucket::MAX_NODES_PER_BUCKET * 32; | ||
|
||
#[derive(Clone)] | ||
pub struct PortalnetConfig { | ||
pub external_addr: Option<SocketAddr>, | ||
pub private_key: H256, | ||
pub listen_port: u16, | ||
pub bootnodes: Bootnodes, | ||
pub data_radius: Distance, | ||
pub internal_ip: bool, | ||
pub no_stun: bool, | ||
pub node_addr_cache_capacity: usize, | ||
} | ||
|
||
impl Default for PortalnetConfig { | ||
fn default() -> Self { | ||
Self { | ||
external_addr: None, | ||
private_key: H256::random(), | ||
listen_port: 4242, | ||
bootnodes: Bootnodes::default(), | ||
data_radius: Distance::MAX, | ||
internal_ip: false, | ||
no_stun: false, | ||
node_addr_cache_capacity: NODE_ADDR_CACHE_CAPACITY, | ||
} | ||
} | ||
} | ||
|
||
impl PortalnetConfig { | ||
pub fn new(trin_config: &TrinConfig, private_key: H256) -> Self { | ||
Self { | ||
external_addr: trin_config.external_addr, | ||
private_key, | ||
listen_port: trin_config.discovery_port, | ||
no_stun: trin_config.no_stun, | ||
bootnodes: trin_config.bootnodes.clone(), | ||
..Default::default() | ||
} | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#![warn(clippy::unwrap_used)] | ||
|
||
pub mod config; | ||
pub mod discovery; | ||
pub mod events; | ||
pub mod find; | ||
|
This file contains hidden or 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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pub mod labels; | ||
pub mod overlay; | ||
pub mod portalnet; | ||
pub mod storage; |
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.
To issue?
Uh oh!
There was an error while loading. Please reload this page.
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.
Well... Imo, this is a very low priority issue. Given the increased activity of our stale issue bot, I don't think it will be addressed anytime soon and will simply be marked as stale before anybody fixes this.
I updated the docs (in
book/src/users/monitoring.md
) so there shouldn't be any surprises for users wanting to update their dashboard. I'm leaning towards leaving thistodo
here & not opening an issue. Simply as a reference for any future devs who might be working on improving our grafana workflow, whenever that time may come around.What do you think?
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.
Eh, I guess I'm still not fully sold on the stale bot. The idea that we are hesitant to create issues that aren't going to be quickly resolved feels like an anti-pattern to me. I don't really see why TODOs peppered throughout the code is any better than a backlog of issues that have been around for a while (I'd argue it is worse, in fact. Partially because it's hard to have a conversation in a code TODO). But I guess the solution I'm leaning toward would handle the TODOs in code: #932 so I'm fine leaving it for now