Skip to content

Commit 5f503a3

Browse files
nipunn1313Convex, Inc.
authored andcommitted
Change counters to histograms (#39186)
We can still get the counter via the sum on the histogram. But then we can see how large each advance_log looks. GitOrigin-RevId: c54063266e0e3c395f073448e10bbab654ce4f49
1 parent d37753e commit 5f503a3

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

crates/database/src/metrics.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,18 +1106,18 @@ pub fn subscriptions_log_enforce_retention_timer() -> Timer<VMHistogram> {
11061106
Timer::new(&SUBSCRIPTION_LOG_ENFORCE_RETENTION_SECONDS)
11071107
}
11081108

1109-
register_convex_counter!(
1110-
SUBSCRIPTION_LOG_ITERATE_TOTAL,
1111-
"Total number of entries in the write log when advancing subscriptions",
1109+
register_convex_histogram!(
1110+
SUBSCRIPTION_LOG_PROCESSED_COMMITS,
1111+
"Total number of commits in the write log processed during one advance_log",
11121112
);
1113-
pub fn log_subscriptions_log_length(log_len: usize) {
1114-
log_counter(&SUBSCRIPTION_LOG_ITERATE_TOTAL, log_len as u64);
1113+
pub fn log_subscriptions_log_processed_commits(log_len: usize) {
1114+
log_distribution(&SUBSCRIPTION_LOG_PROCESSED_COMMITS, log_len as f64);
11151115
}
11161116

1117-
register_convex_counter!(
1118-
SUBSCRIPTION_LOG_WRITES,
1119-
"Number of writes in the write log when advancing subscriptions",
1117+
register_convex_histogram!(
1118+
SUBSCRIPTION_LOG_PROCESSED_WRITES,
1119+
"Total number of writes in the write log processed during one advance_log",
11201120
);
1121-
pub fn log_subscriptions_log_writes(num_writes: usize) {
1122-
log_counter(&SUBSCRIPTION_LOG_WRITES, num_writes as u64);
1121+
pub fn log_subscriptions_log_processed_writes(num_writes: usize) {
1122+
log_distribution(&SUBSCRIPTION_LOG_PROCESSED_WRITES, num_writes as f64);
11231123
}

crates/database/src/subscription.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ impl SubscriptionManager {
369369
);
370370
}
371371
})?;
372-
metrics::log_subscriptions_log_length(log_len);
373-
metrics::log_subscriptions_log_writes(num_writes);
372+
metrics::log_subscriptions_log_processed_commits(log_len);
373+
metrics::log_subscriptions_log_processed_writes(num_writes);
374374
if _timer.elapsed()
375375
> Duration::from_secs(*SUBSCRIPTION_ADVANCE_LOG_TRACING_THRESHOLD)
376376
{

0 commit comments

Comments
 (0)