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: collect withdrawal volumes metrics #200

Conversation

montekki
Copy link
Contributor

  • wip
  • add method to query withdrawals
  • adds metering of withdrawals values

finalizer/src/lib.rs Outdated Show resolved Hide resolved
@montekki montekki marked this pull request as ready for review September 27, 2023 16:51
Deniallugo
Deniallugo previously approved these changes Sep 28, 2023
"
SELECT * FROM
withdrawals
WHERE id in (SELECT * FROM unnest( $1 :: bigint[] ))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's supposed to be select id from unnest( $1 :: bigint[]))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines 17 to 25
lazy_static! {
static ref TOKEN_DECIMALS: Arc<RwLock<HashMap<Address, u32>>> = {
let mut map = HashMap::new();
map.insert(ETH_TOKEN_ADDRESS, 18_u32);

Arc::new(RwLock::new(map))
};
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Based on the number of tokens, seems it's better to create a struct WithdrawalsMeter with cache, pool and name inside and initialize it once in finalizer and once in watcher

Copy link
Contributor Author

Choose a reason for hiding this comment

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

separeted

@Deniallugo Deniallugo dismissed their stale review September 28, 2023 10:06

Accidential approve

withdrawals-meterer/src/lib.rs Outdated Show resolved Hide resolved
withdrawals-meterer/src/lib.rs Outdated Show resolved Hide resolved
///
/// * `pool`: DB connection pool
/// * `metric_name`: Name of the metric to meter to
pub fn new(pool: PgPool, metric_name: &'static str) -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to have a component name and generate the metric name based on it, otherwise it's hard to add more metrics

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

@montekki montekki merged commit 757e0fa into main Sep 28, 2023
5 checks passed
@montekki montekki deleted the fvs-pla-558-collect-same-withdrawal-amounts-metrics-as-old-finalizer branch September 28, 2023 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants