Rate limit transaction counters (#5447)

* Rate limit transaction counters

* @sakridge feedback

* Set default high metrics rate for multinode demo

* Fix tests

* Swap defaults and fix env var tests

* Only set metrics rate if not already set
This commit is contained in:
Justin Starry
2019-08-08 17:05:06 -04:00
committed by GitHub
parent 5b4f24eabd
commit 4f86c0b74a
9 changed files with 174 additions and 87 deletions

View File

@ -4,7 +4,7 @@ use crate::exchange_instruction::*;
use crate::exchange_state::*;
use crate::faucet;
use log::*;
use solana_metrics::inc_new_counter_info;
use solana_metrics::inc_new_high_rate_counter_info;
use solana_sdk::account::KeyedAccount;
use solana_sdk::instruction::InstructionError;
use solana_sdk::pubkey::Pubkey;
@ -296,7 +296,7 @@ impl ExchangeProcessor {
// Trade holds the tokens in escrow
account.tokens[from_token] -= info.tokens;
inc_new_counter_info!("exchange_processor-trades", 1, 1000, 1000);
inc_new_high_rate_counter_info!("exchange_processor-trades", 1);
Self::serialize(
&ExchangeState::Trade(OrderInfo {
@ -390,7 +390,7 @@ impl ExchangeProcessor {
Err(e)?
}
inc_new_counter_info!("exchange_processor-swaps", 1, 1000, 1000);
inc_new_high_rate_counter_info!("exchange_processor-swaps", 1);
if to_order.tokens == 0 {
// Turn into token account