-
Notifications
You must be signed in to change notification settings - Fork 40
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
feat: collect withdrawal volumes metrics #200
Conversation
montekki
commented
Sep 26, 2023
- wip
- add method to query withdrawals
- adds metering of withdrawals values
storage/src/lib.rs
Outdated
" | ||
SELECT * FROM | ||
withdrawals | ||
WHERE id in (SELECT * FROM unnest( $1 :: bigint[] )) |
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 it's supposed to be select id from unnest( $1 :: bigint[]))
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.
Fixed
withdrawals-meterer/src/lib.rs
Outdated
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)) | ||
}; | ||
} | ||
|
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.
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
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.
separeted
withdrawals-meterer/src/lib.rs
Outdated
/// | ||
/// * `pool`: DB connection pool | ||
/// * `metric_name`: Name of the metric to meter to | ||
pub fn new(pool: PgPool, metric_name: &'static str) -> Self { |
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 it's better to have a component name and generate the metric name based on it, otherwise it's hard to add more metrics
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.
Done