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

feat: Implement eth68 announcement metrics, track entries by TxType #6786

Merged
merged 8 commits into from
Feb 28, 2024

Conversation

AbnerZheng
Copy link
Contributor

Close #6524
Add Histogram to track entries number by TxType when validating announcement.

Copy link
Member

@emhane emhane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work! this is very useful. perhaps you want to implement a nice panel and add to dashboard we ship in docker when done? I can make an issue for it.

impl AnnouncedTxSizeMetrics {
/// Update metrics during announcement validation, by examining each announcement entry based on
/// TxType
pub(crate) fn update_on_valid_announcement(&self, announcement: &ValidAnnouncementData) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of &ValidAnnouncementData as param, can we pass a new type TxTypesCounter?

struct TxTypesCounter {
    legacy: usize,
    eip2930: usize,
    eip1559: usize,
    eip4844: usize,
}

and then have a new function that updates TxTypesCounter called from here

if let Some(strict_min_encoded_tx_length) = self.strict_min_encoded_tx_length(tx_type) {
if size < strict_min_encoded_tx_length {
debug!(target: "net::eth-wire",
ty=ty,
size=size,
hash=%hash,
strict_min_encoded_tx_length=strict_min_encoded_tx_length,
network=%Self,
"invalid tx size in eth68 announcement"
);
return ValidationOutcome::Ignore
}
}

?

a new instance of TxTypesCounter is then made for each eth68 announcement

crates/net/network/src/metrics.rs Outdated Show resolved Hide resolved
crates/net/network/src/metrics.rs Outdated Show resolved Hide resolved
crates/net/network/src/metrics.rs Outdated Show resolved Hide resolved
AbnerZheng and others added 3 commits February 27, 2024 14:52
Co-authored-by: Emilia Hane <emiliaha95@gmail.com>
Co-authored-by: Emilia Hane <emiliaha95@gmail.com>
@@ -208,7 +219,7 @@ impl FilterAnnouncement for EthAnnouncementFilter {
fn filter_valid_entries_68(
&self,
msg: NewPooledTransactionHashes68,
) -> (FilterOutcome, ValidAnnouncementData)
) -> (FilterOutcome, ValidAnnouncementData, TxTypesCounter)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emhane Where would you like to put an instance of TxTypesCounter? I am a little confused about TxTypesCounter, let me know if this is not you want.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np. only the file with metrics and the validation file should have to change. create a new instance of TxTypesCounter here

pass it as parameter to should_fetch

fn should_fetch(&self, ty: u8, hash: &TxHash, size: usize, ty_counter: &mut TxTypesCounter) -> ValidationOutcome;

update it here

update metrics before this line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your detailed instructions. Based on your guidance, it seems I should incorporate AnnouncedTxTypesMetrics as a field within EthAnnouncementFilter, rather than placing it within TransactionFetcher. PTAL again.

@emhane
Copy link
Member

emhane commented Feb 28, 2024

perfect, thanks!

@emhane emhane added this pull request to the merge queue Feb 28, 2024
Merged via the queue into paradigmxyz:main with commit 329082d Feb 28, 2024
29 checks passed
ty: u8,
hash: &TxHash,
size: usize,
tx_types_counter: &mut TxTypesCounter,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, should the caller be responsible for updating this?

the update can be derived from the return value?

@mattsse mattsse added the A-networking Related to networking in general label Feb 28, 2024
fgimenez pushed a commit to fgimenez/reth that referenced this pull request Feb 29, 2024
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-networking Related to networking in general
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eth68 announcement metrics, track entries by TxType
3 participants