Skip to content

Commit

Permalink
SVM: Hoist transaction error metrics reporting to banking stage (anza…
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec authored Aug 16, 2024
1 parent 1ff046c commit 28cbac1
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 94 deletions.
94 changes: 93 additions & 1 deletion core/src/banking_stage/leader_slot_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,98 @@ impl LeaderSlotPacketCountMetrics {
}
}

fn report_transaction_error_metrics(errors: &TransactionErrorMetrics, id: &str, slot: Slot) {
datapoint_info!(
"banking_stage-leader_slot_transaction_errors",
"id" => id,
("slot", slot as i64, i64),
("total", errors.total as i64, i64),
("account_in_use", errors.account_in_use as i64, i64),
(
"too_many_account_locks",
errors.too_many_account_locks as i64,
i64
),
(
"account_loaded_twice",
errors.account_loaded_twice as i64,
i64
),
("account_not_found", errors.account_not_found as i64, i64),
("blockhash_not_found", errors.blockhash_not_found as i64, i64),
("blockhash_too_old", errors.blockhash_too_old as i64, i64),
("call_chain_too_deep", errors.call_chain_too_deep as i64, i64),
("already_processed", errors.already_processed as i64, i64),
("instruction_error", errors.instruction_error as i64, i64),
("insufficient_funds", errors.insufficient_funds as i64, i64),
(
"invalid_account_for_fee",
errors.invalid_account_for_fee as i64,
i64
),
(
"invalid_account_index",
errors.invalid_account_index as i64,
i64
),
(
"invalid_program_for_execution",
errors.invalid_program_for_execution as i64,
i64
),
(
"invalid_compute_budget",
errors.invalid_compute_budget as i64,
i64
),
(
"not_allowed_during_cluster_maintenance",
errors.not_allowed_during_cluster_maintenance as i64,
i64
),
(
"invalid_writable_account",
errors.invalid_writable_account as i64,
i64
),
(
"invalid_rent_paying_account",
errors.invalid_rent_paying_account as i64,
i64
),
(
"would_exceed_max_block_cost_limit",
errors.would_exceed_max_block_cost_limit as i64,
i64
),
(
"would_exceed_max_account_cost_limit",
errors.would_exceed_max_account_cost_limit as i64,
i64
),
(
"would_exceed_max_vote_cost_limit",
errors.would_exceed_max_vote_cost_limit as i64,
i64
),
(
"would_exceed_account_data_block_limit",
errors.would_exceed_account_data_block_limit as i64,
i64
),
(
"max_loaded_accounts_data_size_exceeded",
errors.max_loaded_accounts_data_size_exceeded as i64,
i64
),
(
"program_execution_temporarily_restricted",
errors.program_execution_temporarily_restricted as i64,
i64
),
);
}

#[derive(Debug)]
pub(crate) struct LeaderSlotMetrics {
// banking_stage creates one QosService instance per working threads, that is uniquely
Expand Down Expand Up @@ -447,7 +539,7 @@ impl LeaderSlotMetrics {
self.is_reported = true;

self.timing_metrics.report(&self.id, self.slot);
self.transaction_error_metrics.report(&self.id, self.slot);
report_transaction_error_metrics(&self.transaction_error_metrics, &self.id, self.slot);
self.packet_count_metrics.report(&self.id, self.slot);
self.vote_packet_count_metrics.report(&self.id, self.slot);
self.prioritization_fees_metric.report(&self.id, self.slot);
Expand Down
94 changes: 1 addition & 93 deletions svm/src/transaction_error_metrics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use solana_sdk::{clock::Slot, saturating_add_assign};
use solana_sdk::saturating_add_assign;

#[derive(Debug, Default)]
pub struct TransactionErrorMetrics {
Expand Down Expand Up @@ -89,96 +89,4 @@ impl TransactionErrorMetrics {
other.program_execution_temporarily_restricted
);
}

pub fn report(&self, id: &str, slot: Slot) {
datapoint_info!(
"banking_stage-leader_slot_transaction_errors",
"id" => id,
("slot", slot as i64, i64),
("total", self.total as i64, i64),
("account_in_use", self.account_in_use as i64, i64),
(
"too_many_account_locks",
self.too_many_account_locks as i64,
i64
),
(
"account_loaded_twice",
self.account_loaded_twice as i64,
i64
),
("account_not_found", self.account_not_found as i64, i64),
("blockhash_not_found", self.blockhash_not_found as i64, i64),
("blockhash_too_old", self.blockhash_too_old as i64, i64),
("call_chain_too_deep", self.call_chain_too_deep as i64, i64),
("already_processed", self.already_processed as i64, i64),
("instruction_error", self.instruction_error as i64, i64),
("insufficient_funds", self.insufficient_funds as i64, i64),
(
"invalid_account_for_fee",
self.invalid_account_for_fee as i64,
i64
),
(
"invalid_account_index",
self.invalid_account_index as i64,
i64
),
(
"invalid_program_for_execution",
self.invalid_program_for_execution as i64,
i64
),
(
"invalid_compute_budget",
self.invalid_compute_budget as i64,
i64
),
(
"not_allowed_during_cluster_maintenance",
self.not_allowed_during_cluster_maintenance as i64,
i64
),
(
"invalid_writable_account",
self.invalid_writable_account as i64,
i64
),
(
"invalid_rent_paying_account",
self.invalid_rent_paying_account as i64,
i64
),
(
"would_exceed_max_block_cost_limit",
self.would_exceed_max_block_cost_limit as i64,
i64
),
(
"would_exceed_max_account_cost_limit",
self.would_exceed_max_account_cost_limit as i64,
i64
),
(
"would_exceed_max_vote_cost_limit",
self.would_exceed_max_vote_cost_limit as i64,
i64
),
(
"would_exceed_account_data_block_limit",
self.would_exceed_account_data_block_limit as i64,
i64
),
(
"max_loaded_accounts_data_size_exceeded",
self.max_loaded_accounts_data_size_exceeded as i64,
i64
),
(
"program_execution_temporarily_restricted",
self.program_execution_temporarily_restricted as i64,
i64
),
);
}
}

0 comments on commit 28cbac1

Please sign in to comment.