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

fix: follow up metrics fixes #648

Merged
merged 7 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions core/lib/dal/sqlx-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,26 @@
},
"query": "UPDATE transactions SET in_mempool = FALSE WHERE in_mempool = TRUE"
},
"1f84a62da9b5e00dff0353de76b28f22220a5a859a9955afc2ad59135bd25e6c": {
"describe": {
"columns": [
{
"name": "l1_batch_number",
"ordinal": 0,
"type_info": "Int8"
}
],
"nullable": [
false
],
"parameters": {
"Left": [
"Int2"
]
}
},
"query": "\n SELECT l1_batch_number\n FROM prover_jobs_fri \n WHERE status <> 'skipped'\n AND status <> 'successful'\n AND aggregation_round = $1\n ORDER BY l1_batch_number ASC \n LIMIT 1\n "
},
"1faf6552c221c75b7232b55210c0c37be76a57ec9dc94584b6ccb562e8b182f2": {
"describe": {
"columns": [
Expand Down Expand Up @@ -8376,26 +8396,6 @@
},
"query": "SELECT MAX(operation_number) as \"max?\" FROM storage_logs WHERE miniblock_number = $1"
},
"a7c7e8f036404d24dc6bfa184a84b92d8f73ca034970481af34b6163e66dc59a": {
"describe": {
"columns": [
{
"name": "l1_batch_number",
"ordinal": 0,
"type_info": "Int8"
}
],
"nullable": [
false
],
"parameters": {
"Left": [
"Int2"
]
}
},
"query": "\n SELECT l1_batch_number \n FROM prover_jobs_fri \n WHERE status <> 'skipped'\n AND status <> 'successful'\n AND aggregation_round = $1 \n ORDER BY l1_batch_number ASC \n LIMIT 1\n "
},
"a8b32073a67ad77caab11e73a5cac5aa5b5382648ff95d6787a309eb3f64d434": {
"describe": {
"columns": [],
Expand Down
4 changes: 2 additions & 2 deletions core/lib/dal/src/fri_prover_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,11 @@ impl FriProverDal<'_, '_> {
) -> Option<L1BatchNumber> {
sqlx::query!(
r#"
SELECT l1_batch_number
SELECT l1_batch_number
FROM prover_jobs_fri
WHERE status <> 'skipped'
AND status <> 'successful'
AND aggregation_round = $1
AND aggregation_round = $1
ORDER BY l1_batch_number ASC
LIMIT 1
"#,
Expand Down
4 changes: 2 additions & 2 deletions core/lib/zksync_core/src/api_server/web3/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl From<&TypedFilter> for FilterType {
#[metrics(prefix = "api_web3_filter")]
pub(super) struct FilterMetrics {
/// Number of currently active filters grouped by the filter type
pub metrics_count: Family<FilterType, Gauge>,
pub filter_count: Family<FilterType, Gauge>,
/// Time in seconds between consecutive requests to the filter grouped by the filter type
#[metrics(buckets = Buckets::LATENCIES, unit = Unit::Seconds)]
pub request_frequency: Family<FilterType, Histogram<Duration>>,
Expand All @@ -226,7 +226,7 @@ pub(super) struct FilterMetrics {
pub filter_lifetime: Family<FilterType, Histogram<Duration>>,
/// Number of requests to the filter grouped by the filter type
#[metrics(buckets = Buckets::exponential(1.0..=1048576.0, 2.0))]
pub filter_count: Family<FilterType, Histogram<usize>>,
pub request_count: Family<FilterType, Histogram<usize>>,
}

#[vise::register]
Expand Down
4 changes: 2 additions & 2 deletions core/lib/zksync_core/src/api_server/web3/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ struct InstalledFilter {

impl InstalledFilter {
pub fn new(filter: TypedFilter) -> Self {
let guard = FILTER_METRICS.metrics_count[&FilterType::from(&filter)].inc_guard(1);
let guard = FILTER_METRICS.filter_count[&FilterType::from(&filter)].inc_guard(1);
Self {
filter,
_guard: guard,
Expand All @@ -585,7 +585,7 @@ impl Drop for InstalledFilter {
fn drop(&mut self) {
let filter_type = FilterType::from(&self.filter);

FILTER_METRICS.filter_count[&filter_type].observe(self.request_count);
FILTER_METRICS.request_count[&filter_type].observe(self.request_count);
FILTER_METRICS.filter_lifetime[&filter_type].observe(self.created_at.elapsed());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl PeriodicJob for FriProverStatsReporter {
)
}

for aggregation_round in 0..2 {
for aggregation_round in 0..3 {
if let Some(l1_batch_number) = conn
.fri_prover_jobs_dal()
.min_unproved_l1_batch_number_for_aggregation_round(aggregation_round.into())
Expand Down