counters for vote not found

This commit is contained in:
Anatoly Yakovenko 2018-07-15 13:08:13 -07:00 committed by Greg Fitzgerald
parent 5d28729b2a
commit 4631af5011
2 changed files with 15 additions and 0 deletions

View File

@ -6,6 +6,7 @@
extern crate libc;
use chrono::prelude::*;
use counter::{self, Counter};
use entry::Entry;
use hash::Hash;
use itertools::Itertools;
@ -202,6 +203,19 @@ impl Bank {
{
let option = bals.get_mut(&tx.from);
if option.is_none() {
if let Instruction::NewVote(_) = &tx.instruction {
static mut COUNTER_VOTE_ACCOUNT_NOT_FOUND: Counter = create_counter!(
"bank-appy_debits-vote_account_not_found",
counter::DEFAULT_LOG_RATE
);
inc_counter!(COUNTER_VOTE_ACCOUNT_NOT_FOUND, 1);
} else {
static mut COUNTER_ACCOUNT_NOT_FOUND: Counter = create_counter!(
"bank-appy_debits-generic_account_not_found",
counter::DEFAULT_LOG_RATE
);
inc_counter!(COUNTER_ACCOUNT_NOT_FOUND, 1);
}
return Err(BankError::AccountNotFound(tx.from));
}
let bal = option.unwrap();

View File

@ -4,6 +4,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use timing;
const INFLUX_RATE: usize = 100;
pub const DEFAULT_LOG_RATE: usize = 10;
pub struct Counter {
pub name: &'static str,