Cleanup metrics (#4230)

This commit is contained in:
Jack May
2019-05-10 08:33:58 -07:00
committed by GitHub
parent 9881820444
commit f567877d1d
33 changed files with 547 additions and 560 deletions

View File

@ -1,7 +1,7 @@
//! The `bank_forks` module implments BankForks a DAG of checkpointed Banks
use hashbrown::{HashMap, HashSet};
use solana_metrics::counter::Counter;
use solana_metrics::inc_new_counter_info;
use solana_runtime::bank::Bank;
use solana_sdk::timing;
use std::ops::Index;

View File

@ -15,7 +15,7 @@ use crate::service::Service;
use crate::sigverify_stage::VerifiedPackets;
use bincode::deserialize;
use itertools::Itertools;
use solana_metrics::counter::Counter;
use solana_metrics::inc_new_counter_info;
use solana_runtime::accounts_db::ErrorCounters;
use solana_runtime::bank::Bank;
use solana_runtime::locked_accounts_results::LockedAccountsResults;

View File

@ -16,7 +16,7 @@ use hashbrown::HashMap;
#[cfg(not(feature = "kvstore"))]
use rocksdb;
use solana_metrics::counter::Counter;
use solana_metrics::{datapoint, inc_new_counter_info};
use solana_sdk::genesis_block::GenesisBlock;
use solana_sdk::hash::Hash;
@ -1006,16 +1006,16 @@ fn should_insert_blob(
// for the slot
let last_index = slot.last_index;
if blob_index >= last_index {
solana_metrics::submit(
solana_metrics::influxdb::Point::new("blocktree_error")
.add_field(
"error",
solana_metrics::influxdb::Value::String(format!(
"Received last blob with index {} >= slot.last_index {}",
blob_index, last_index
)),
)
.to_owned(),
datapoint!(
"blocktree_error",
(
"error",
format!(
"Received last blob with index {} >= slot.last_index {}",
blob_index, last_index
),
String
)
);
return false;
}
@ -1023,16 +1023,16 @@ fn should_insert_blob(
// Check that we do not receive a blob with "last_index" true, but index
// less than our current received
if blob.is_last_in_slot() && blob_index < slot.received {
solana_metrics::submit(
solana_metrics::influxdb::Point::new("blocktree_error")
.add_field(
"error",
solana_metrics::influxdb::Value::String(format!(
"Received last blob with index {} < slot.received {}",
blob_index, slot.received
)),
)
.to_owned(),
datapoint!(
"blocktree_error",
(
"error",
format!(
"Received last blob with index {} < slot.received {}",
blob_index, slot.received
),
String
)
);
return false;
}

View File

@ -1,4 +1,5 @@
use crate::erasure::{NUM_CODING, NUM_DATA};
use solana_metrics::datapoint;
use std::borrow::Borrow;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Eq, PartialEq)]
@ -37,17 +38,17 @@ impl SlotMeta {
// Should never happen
if self.consumed > self.last_index + 1 {
solana_metrics::submit(
solana_metrics::influxdb::Point::new("blocktree_error")
.add_field(
"error",
solana_metrics::influxdb::Value::String(format!(
"Observed a slot meta with consumed: {} > meta.last_index + 1: {}",
self.consumed,
self.last_index + 1
)),
)
.to_owned(),
datapoint!(
"blocktree_error",
(
"error",
format!(
"Observed a slot meta with consumed: {} > meta.last_index + 1: {}",
self.consumed,
self.last_index + 1
),
String
)
);
}

View File

@ -3,7 +3,7 @@ use crate::blocktree::Blocktree;
use crate::entry::{Entry, EntrySlice};
use crate::leader_schedule_cache::LeaderScheduleCache;
use rayon::prelude::*;
use solana_metrics::counter::Counter;
use solana_metrics::{datapoint, inc_new_counter_info};
use solana_runtime::bank::Bank;
use solana_runtime::locked_accounts_results::LockedAccountsResults;
use solana_sdk::genesis_block::GenesisBlock;
@ -43,14 +43,10 @@ fn par_execute_entries(
}
if !Bank::can_commit(&r) {
warn!("Unexpected validator error: {:?}", e);
solana_metrics::submit(
solana_metrics::influxdb::Point::new("validator_process_entry_error")
.add_field(
"error",
solana_metrics::influxdb::Value::String(format!("{:?}", e)),
)
.to_owned(),
)
datapoint!(
"validator_process_entry_error",
("error", format!("{:?}", e), String)
);
}
}
}
@ -86,16 +82,16 @@ pub fn process_entries(bank: &Bank, entries: &[Entry]) -> Result<()> {
if mt_group.is_empty() {
// An entry has account lock conflicts with itself, which should not happen
// if generated by properly functioning leaders
solana_metrics::submit(
solana_metrics::influxdb::Point::new("validator_process_entry_error")
.add_field(
"error",
solana_metrics::influxdb::Value::String(format!(
"Lock accounts error, entry conflicts with itself, txs: {:?}",
entry.transactions
)),
)
.to_owned(),
datapoint!(
"validator_process_entry_error",
(
"error",
format!(
"Lock accounts error, entry conflicts with itself, txs: {:?}",
entry.transactions
),
String
)
);
first_lock_err?;

View File

@ -10,8 +10,7 @@ use crate::result::{Error, Result};
use crate::service::Service;
use crate::staking_utils;
use rayon::prelude::*;
use solana_metrics::counter::Counter;
use solana_metrics::{influxdb, submit};
use solana_metrics::{datapoint, inc_new_counter_info};
use solana_sdk::hash::Hash;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::timing::duration_as_ms;
@ -141,14 +140,7 @@ impl Broadcast {
num_entries, to_blobs_elapsed, broadcast_elapsed
);
submit(
influxdb::Point::new("broadcast-service")
.add_field(
"transmit-index",
influxdb::Value::Integer(blob_index as i64),
)
.to_owned(),
);
datapoint!("broadcast-service", ("transmit-index", blob_index, i64));
Ok(())
}

View File

@ -29,8 +29,7 @@ use core::cmp;
use hashbrown::HashMap;
use rand::{thread_rng, Rng};
use rayon::prelude::*;
use solana_metrics::counter::Counter;
use solana_metrics::{influxdb, submit};
use solana_metrics::{datapoint, inc_new_counter_info};
use solana_netutil::{
bind_in_range, bind_to, find_available_port_in_range, multi_bind_in_range, PortRange,
};
@ -818,35 +817,23 @@ impl ClusterInfo {
let out = {
match repair_request {
RepairType::Blob(slot, blob_index) => {
submit(
influxdb::Point::new("cluster_info-repair")
.add_field("repair-slot", influxdb::Value::Integer(*slot as i64))
.add_field("repair-ix", influxdb::Value::Integer(*blob_index as i64))
.to_owned(),
datapoint!(
"cluster_info-repair",
("repair-slot", *slot, i64),
("repair-ix", *blob_index, i64)
);
self.window_index_request_bytes(*slot, *blob_index)?
}
RepairType::HighestBlob(slot, blob_index) => {
submit(
influxdb::Point::new("cluster_info-repair_highest")
.add_field(
"repair-highest-slot",
influxdb::Value::Integer(*slot as i64),
)
.add_field(
"repair-highest-ix",
influxdb::Value::Integer(*blob_index as i64),
)
.to_owned(),
datapoint!(
"cluster_info-repair_highest",
("repair-highest-slot", *slot, i64),
("repair-highest-ix", *blob_index, i64)
);
self.window_highest_index_request_bytes(*slot, *blob_index)?
}
RepairType::Orphan(slot) => {
submit(
influxdb::Point::new("cluster_info-repair_orphan")
.add_field("repair-orphan", influxdb::Value::Integer(*slot as i64))
.to_owned(),
);
datapoint!("cluster_info-repair_orphan", ("repair-orphan", *slot, i64));
self.orphan_bytes(*slot)?
}
}

View File

@ -4,7 +4,7 @@ use crate::result::Result;
use crate::service::Service;
use crate::sigverify_stage::VerifiedPackets;
use crate::{packet, sigverify};
use solana_metrics::counter::Counter;
use solana_metrics::inc_new_counter_info;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::Sender;
use std::sync::{Arc, Mutex, RwLock};

View File

@ -4,7 +4,7 @@ use crate::poh_recorder::PohRecorder;
use crate::result::{Error, Result};
use crate::service::Service;
use crate::streamer::{self, PacketReceiver, PacketSender};
use solana_metrics::counter::Counter;
use solana_metrics::inc_new_counter_info;
use solana_sdk::timing::DEFAULT_TICKS_PER_SLOT;
use std::net::UdpSocket;
use std::sync::atomic::AtomicBool;

View File

@ -20,7 +20,7 @@ use crate::service::Service;
use crate::storage_stage::StorageState;
use crate::tpu::Tpu;
use crate::tvu::{Sockets, Tvu};
use solana_metrics::counter::Counter;
use solana_metrics::inc_new_counter_info;
use solana_sdk::genesis_block::GenesisBlock;
use solana_sdk::hash::Hash;
use solana_sdk::pubkey::Pubkey;

View File

@ -1,7 +1,7 @@
use crate::bank_forks::BankForks;
use crate::staking_utils;
use hashbrown::{HashMap, HashSet};
use solana_metrics::influxdb;
use solana_metrics::datapoint;
use solana_runtime::bank::Bank;
use solana_sdk::account::Account;
use solana_sdk::pubkey::Pubkey;
@ -125,19 +125,14 @@ impl Locktower {
vote_state.nth_recent_vote(0).map(|v| v.slot).unwrap_or(0) as i64
);
debug!("observed root {}", vote_state.root_slot.unwrap_or(0) as i64);
solana_metrics::submit(
influxdb::Point::new("counter-locktower-observed")
.add_field(
"slot",
influxdb::Value::Integer(
vote_state.nth_recent_vote(0).map(|v| v.slot).unwrap_or(0) as i64,
),
)
.add_field(
"root",
influxdb::Value::Integer(vote_state.root_slot.unwrap_or(0) as i64),
)
.to_owned(),
datapoint!(
"locktower-observed",
(
"slot",
vote_state.nth_recent_vote(0).map(|v| v.slot).unwrap_or(0),
i64
),
("root", vote_state.root_slot.unwrap_or(0), i64)
);
}
let start_root = vote_state.root_slot;
@ -216,21 +211,11 @@ impl Locktower {
self.epoch_stakes.epoch
);
self.epoch_stakes = EpochStakes::new_from_bank(bank, &self.epoch_stakes.delegate_id);
solana_metrics::submit(
influxdb::Point::new("counter-locktower-epoch")
.add_field(
"epoch",
influxdb::Value::Integer(self.epoch_stakes.epoch as i64),
)
.add_field(
"self_staked",
influxdb::Value::Integer(self.epoch_stakes.self_staked as i64),
)
.add_field(
"total_staked",
influxdb::Value::Integer(self.epoch_stakes.total_staked as i64),
)
.to_owned(),
datapoint!(
"locktower-epoch",
("epoch", self.epoch_stakes.epoch, i64),
("self_staked", self.epoch_stakes.self_staked, i64),
("total_staked", self.epoch_stakes.total_staked, i64)
);
}
}
@ -238,14 +223,10 @@ impl Locktower {
pub fn record_vote(&mut self, slot: u64) -> Option<u64> {
let root_slot = self.lockouts.root_slot;
self.lockouts.process_vote(&Vote { slot });
solana_metrics::submit(
influxdb::Point::new("counter-locktower-vote")
.add_field("latest", influxdb::Value::Integer(slot as i64))
.add_field(
"root",
influxdb::Value::Integer(self.lockouts.root_slot.unwrap_or(0) as i64),
)
.to_owned(),
datapoint!(
"locktower-vote",
("latest", slot, i64),
("root", self.lockouts.root_slot.unwrap_or(0), i64)
);
if root_slot != self.lockouts.root_slot {
Some(self.lockouts.root_slot.unwrap())

View File

@ -4,7 +4,7 @@ use crate::result::{Error, Result};
use bincode;
use byteorder::{ByteOrder, LittleEndian};
use serde::Serialize;
use solana_metrics::counter::Counter;
use solana_metrics::inc_new_counter_info;
use solana_sdk::hash::Hash;
pub use solana_sdk::packet::PACKET_DATA_SIZE;
use solana_sdk::pubkey::Pubkey;

View File

@ -6,7 +6,7 @@ use crate::blocktree::{Blocktree, CompletedSlotsReceiver, SlotMeta};
use crate::cluster_info::ClusterInfo;
use crate::result::Result;
use crate::service::Service;
use solana_metrics::{influxdb, submit};
use solana_metrics::datapoint;
use solana_sdk::pubkey::Pubkey;
use std::collections::HashSet;
use std::net::UdpSocket;
@ -153,22 +153,14 @@ impl RepairService {
for ((to, req), repair_request) in reqs {
if let Ok(local_addr) = repair_socket.local_addr() {
submit(
influxdb::Point::new("repair_service")
.add_field(
"repair_request",
influxdb::Value::String(format!("{:?}", repair_request)),
)
.to_owned()
.add_field("to", influxdb::Value::String(to.to_string()))
.to_owned()
.add_field("from", influxdb::Value::String(local_addr.to_string()))
.to_owned()
.add_field("id", influxdb::Value::String(id.to_string()))
.to_owned(),
datapoint!(
"repair_service",
("repair_request", format!("{:?}", repair_request), String),
("to", to.to_string(), String),
("from", local_addr.to_string(), String),
("id", id.to_string(), String)
);
}
repair_socket.send_to(&req, to).unwrap_or_else(|e| {
info!("{} repair req send_to({}) error {:?}", id, to, e);
0

View File

@ -14,8 +14,7 @@ use crate::result::{Error, Result};
use crate::rpc_subscriptions::RpcSubscriptions;
use crate::service::Service;
use hashbrown::HashMap;
use solana_metrics::counter::Counter;
use solana_metrics::influxdb;
use solana_metrics::{datapoint, inc_new_counter_info};
use solana_runtime::bank::Bank;
use solana_sdk::hash::Hash;
use solana_sdk::pubkey::Pubkey;
@ -245,17 +244,10 @@ impl ReplayStage {
cluster_info.write().unwrap().set_leader(&next_leader);
if next_leader == *my_id && reached_leader_tick {
debug!("{} starting tpu for slot {}", my_id, poh_slot);
solana_metrics::submit(
influxdb::Point::new("counter-replay_stage-new_leader")
.add_field(
"count",
influxdb::Value::Integer(poh_slot as i64),
)
.add_field(
"grace",
influxdb::Value::Integer(grace_ticks as i64),
)
.to_owned(),);
datapoint!(
"replay_stage-new_leader",
("count", poh_slot, i64),
("grace", grace_ticks, i64));
let tpu_bank = Bank::new_from_parent(&parent, my_id, poh_slot);
bank_forks.write().unwrap().insert(tpu_bank);
if let Some(tpu_bank) = bank_forks.read().unwrap().get(poh_slot).cloned() {
@ -475,11 +467,7 @@ impl ReplayStage {
.unwrap_or(true)
{
info!("validator fork confirmed {} {}", *slot, duration);
solana_metrics::submit(
influxdb::Point::new(&"validator-confirmation")
.add_field("duration_ms", influxdb::Value::Integer(duration as i64))
.to_owned(),
);
datapoint!("validator-confirmation", ("duration_ms", duration, i64));
false
} else {
debug!(

View File

@ -10,8 +10,7 @@ use crate::service::Service;
use crate::staking_utils;
use crate::streamer::BlobReceiver;
use crate::window_service::WindowService;
use solana_metrics::counter::Counter;
use solana_metrics::{influxdb, submit};
use solana_metrics::{datapoint, inc_new_counter_info};
use solana_sdk::hash::Hash;
use std::net::UdpSocket;
use std::sync::atomic::AtomicBool;
@ -34,11 +33,8 @@ fn retransmit(
blobs.append(&mut nq);
}
submit(
influxdb::Point::new("retransmit-stage")
.add_field("count", influxdb::Value::Integer(blobs.len() as i64))
.to_owned(),
);
datapoint!("retransmit-stage", ("count", blobs.len(), i64));
let r_bank = bank_forks.read().unwrap().working_bank();
let bank_epoch = r_bank.get_stakers_epoch(r_bank.slot());
let (neighbors, children) = compute_retransmit_peers(

View File

@ -6,7 +6,7 @@
use crate::packet::{Packet, Packets};
use crate::result::Result;
use solana_metrics::counter::Counter;
use solana_metrics::inc_new_counter_info;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::short_vec::decode_len;
use solana_sdk::signature::Signature;

View File

@ -10,8 +10,7 @@ use crate::result::{Error, Result};
use crate::service::Service;
use crate::sigverify;
use crate::streamer::{self, PacketReceiver};
use solana_metrics::counter::Counter;
use solana_metrics::{influxdb, submit};
use solana_metrics::{datapoint, inc_new_counter_info};
use solana_sdk::timing;
use std::sync::mpsc::{Receiver, RecvTimeoutError, Sender};
use std::sync::{Arc, Mutex};
@ -96,15 +95,11 @@ impl SigVerifyStage {
(len as f32 / total_time_s)
);
submit(
influxdb::Point::new("sigverify_stage-total_verify_time")
.add_field("batch_len", influxdb::Value::Integer(batch_len as i64))
.add_field("len", influxdb::Value::Integer(len as i64))
.add_field(
"total_time_ms",
influxdb::Value::Integer(total_time_ms as i64),
)
.to_owned(),
datapoint!(
"sigverify_stage-total_verify_time",
("batch_len", batch_len, i64),
("len", len, i64),
("total_time_ms", total_time_ms, i64)
);
Ok(())

View File

@ -11,7 +11,7 @@ use crate::repair_service::{RepairService, RepairStrategy};
use crate::result::{Error, Result};
use crate::service::Service;
use crate::streamer::{BlobReceiver, BlobSender};
use solana_metrics::counter::Counter;
use solana_metrics::inc_new_counter_info;
use solana_runtime::bank::Bank;
use solana_sdk::hash::Hash;
use solana_sdk::pubkey::Pubkey;