Skip to content
Closed
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
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/astria-sequencer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ cnidarium = { git = "https://github.com/penumbra-zone/penumbra.git", rev = "87ad
] }
ibc-proto = { version = "0.41.0", features = ["server"] }
matchit = "0.7.2"
quick_cache = "0.6.0"
tower = "0.4"
tower-abci = "0.12.0"
tower-actor = "0.1.0"
Expand Down
33 changes: 33 additions & 0 deletions crates/astria-sequencer/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ pub struct Metrics {
check_tx_duration_seconds_fetch_balances: Histogram,
check_tx_duration_seconds_fetch_tx_cost: Histogram,
check_tx_duration_seconds_insert_to_app_mempool: Histogram,
check_tx_cache_hit: Counter,
check_tx_cache_miss: Counter,
actions_per_transaction_in_mempool: Histogram,
transaction_in_mempool_size_bytes: Histogram,
transactions_in_mempool_total: Gauge,
Expand Down Expand Up @@ -138,6 +140,14 @@ impl Metrics {
.record(duration);
}

pub(crate) fn increment_check_tx_cache_hit(&self) {
self.check_tx_cache_hit.increment(1);
}

pub(crate) fn increment_check_tx_cache_miss(&self) {
self.check_tx_cache_miss.increment(1);
}

pub(crate) fn record_actions_per_transaction_in_mempool(&self, count: usize) {
self.actions_per_transaction_in_mempool.record(count);
}
Expand Down Expand Up @@ -295,6 +305,21 @@ impl telemetry::Metrics for Metrics {
let check_tx_duration_seconds_insert_to_app_mempool = check_tx_duration_factory
.register_with_labels(&[(CHECK_TX_STAGE, "insert to app mempool".to_string())])?;

let check_tx_cache_hit = builder
.new_counter_factory(
CHECK_TX_CACHE_HIT,
"The number of `check_tx` attempts which have been retrieved from the cached \
results",
)?
.register()?;

let check_tx_cache_miss = builder
.new_counter_factory(
CHECK_TX_CACHE_MISS,
"The number of `check_tx` rechecks which have not been found in the cached results",
)?
.register()?;

let actions_per_transaction_in_mempool = builder
.new_histogram_factory(
ACTIONS_PER_TRANSACTION_IN_MEMPOOL,
Expand Down Expand Up @@ -345,6 +370,8 @@ impl telemetry::Metrics for Metrics {
check_tx_duration_seconds_fetch_balances,
check_tx_duration_seconds_fetch_tx_cost,
check_tx_duration_seconds_insert_to_app_mempool,
check_tx_cache_hit,
check_tx_cache_miss,
actions_per_transaction_in_mempool,
transaction_in_mempool_size_bytes,
transactions_in_mempool_total,
Expand All @@ -371,6 +398,8 @@ metric_names!(const METRICS_NAMES:
CHECK_TX_DURATION_SECONDS_CONVERT_ADDRESS,
CHECK_TX_DURATION_SECONDS_FETCH_BALANCES,
CHECK_TX_DURATION_SECONDS_FETCH_TX_COST,
CHECK_TX_CACHE_HIT,
CHECK_TX_CACHE_MISS,
ACTIONS_PER_TRANSACTION_IN_MEMPOOL,
TRANSACTION_IN_MEMPOOL_SIZE_BYTES,
TRANSACTIONS_IN_MEMPOOL_TOTAL,
Expand All @@ -381,6 +410,8 @@ metric_names!(const METRICS_NAMES:
mod tests {
use super::{
ACTIONS_PER_TRANSACTION_IN_MEMPOOL,
CHECK_TX_CACHE_HIT,
CHECK_TX_CACHE_MISS,
CHECK_TX_DURATION_SECONDS,
CHECK_TX_REMOVED_ACCOUNT_BALANCE,
CHECK_TX_REMOVED_EXPIRED,
Expand Down Expand Up @@ -448,6 +479,8 @@ mod tests {
"check_tx_removed_account_balance",
);
assert_const(CHECK_TX_DURATION_SECONDS, "check_tx_duration_seconds");
assert_const(CHECK_TX_CACHE_HIT, "check_tx_cache_hit");
assert_const(CHECK_TX_CACHE_MISS, "check_tx_cache_miss");
assert_const(
ACTIONS_PER_TRANSACTION_IN_MEMPOOL,
"actions_per_transaction_in_mempool",
Expand Down
Loading