Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Accountsdb plugin metrics #20606

Merged
merged 8 commits into from
Oct 13, 2021

Conversation

lijunwangs
Copy link
Contributor

Summary of Changes

Added metrics for accountsdb plugin
Handle and log postgres db errors
Print account pubkeys nicely in logging

Fixes #

@lijunwangs lijunwangs force-pushed the accountsdb_plugin_metrics branch from 3513c38 to 4c73c4e Compare October 12, 2021 00:32
@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #20606 (7176c1c) into master (94ca506) will decrease coverage by 0.0%.
The diff coverage is 0.0%.

@@            Coverage Diff            @@
##           master   #20606     +/-   ##
=========================================
- Coverage    82.0%    82.0%   -0.1%     
=========================================
  Files         494      494             
  Lines      137615   137633     +18     
=========================================
- Hits       112884   112866     -18     
- Misses      24731    24767     +36     

t-nelson
t-nelson previously approved these changes Oct 12, 2021
Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

lgtm. Just a couple tinfoil hat nits from me

match plugin.update_account(ReplicaAccountInfoVersions::V0_0_1(&account), slot) {
Err(err) => {
error!(
"Failed to update account {:?} at slot {:?}, error: {:?}",
account.pubkey, slot, err
bs58::encode(account.pubkey).into_string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

You could alternatively use the Display formatter instead of Debug.

@@ -88,21 +90,31 @@ impl AccountsUpdateNotifierImpl {
return;
}
for plugin in plugin_manager.plugins.iter_mut() {
let mut measure = Measure::start("accountsdb-plugin-update-account");
match plugin.update_account(ReplicaAccountInfoVersions::V0_0_1(&account), slot) {
Err(err) => {
error!(
"Failed to update account {:?} at slot {:?}, error: {:?}",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we probably want the plugin name here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

account.pubkey, slot, err
bs58::encode(account.pubkey).into_string(),
slot,
err
)
}
Ok(_) => {
trace!(
"Successfully updated account {:?} at slot {:?}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto, plugin name and Display formatter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

)
}
Ok(_) => {
trace!(
"Successfully updated account {:?} at slot {:?}",
account.pubkey,
bs58::encode(account.pubkey).into_string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep in mind that base58 is quite slow, so this could potentially harm performance. Probably fine at trace! though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I think it is incurred only during the trace condition

@@ -190,7 +192,7 @@ impl PostgresClient for SimplePostgresClient {
) -> Result<(), AccountsDbPluginError> {
debug!(
Copy link
Contributor

Choose a reason for hiding this comment

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

trace! ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@mergify mergify bot dismissed t-nelson’s stale review October 12, 2021 22:05

Pull request has been modified.

@t-nelson
Copy link
Contributor

Thanks for addressing! One last thing. When using the Display formatter, the explicit base58 encoding can be omitted. Pubkey's implementation of ToString handles it for you

@lijunwangs
Copy link
Contributor Author

Thanks for addressing! One last thing. When using the Display formatter, the explicit base58 encoding can be omitted. Pubkey's implementation of ToString handles it for you

Thanks for the info! The code is using the interface ReplicaAccountInfo which did not use the Pubkey -- just raw [u8] hence the encoding.

@lijunwangs lijunwangs merged commit 08e40bf into solana-labs:master Oct 13, 2021
lijunwangs added a commit to lijunwangs/solana that referenced this pull request Oct 13, 2021
Added metrics for accountsdb plugin
Handle and log postgres db errors
Print account pubkeys nicely in logging
lijunwangs added a commit that referenced this pull request Oct 13, 2021
Added metrics for accountsdb plugin
Handle and log postgres db errors
Print account pubkeys nicely in logging
dankelleher pushed a commit to identity-com/solana that referenced this pull request Nov 24, 2021
Added metrics for accountsdb plugin
Handle and log postgres db errors
Print account pubkeys nicely in logging
frits-metalogix added a commit to identity-com/solana that referenced this pull request Nov 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants