uses nanos precision for timestamp when submitting metrics to influxdb (#20623)
Current datapoint_info! is apparently overwriting itself when run inside a loop. For example in https://github.com/solana-labs/solana/blob/005d6863f/core/src/window_service.rs#L101-L107 only one of the slots will show up in influxdb. This is apparently because of metrics code using milliseconds as the timestamp, as mentioned here: https://github.com/solana-labs/solana/issues/19789#issuecomment-922482013
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use std::fmt;
|
||||
use std::{fmt, time::SystemTime};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DataPoint {
|
||||
pub name: &'static str,
|
||||
pub timestamp: u64,
|
||||
pub timestamp: SystemTime,
|
||||
pub fields: Vec<(&'static str, String)>,
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ impl DataPoint {
|
||||
pub fn new(name: &'static str) -> Self {
|
||||
DataPoint {
|
||||
name,
|
||||
timestamp: solana_sdk::timing::timestamp(),
|
||||
timestamp: SystemTime::now(),
|
||||
fields: vec![],
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user