Surface validator pubkey in metrics (#5227)
This commit is contained in:
parent
21cef2fe21
commit
3a69459645
|
@ -125,20 +125,11 @@ macro_rules! datapoint_debug {
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref HOST_INFO: String = {
|
static ref HOST_ID: String = {
|
||||||
let v = env::var("SOLANA_METRICS_DISPLAY_HOSTNAME")
|
env::var("SOLANA_METRICS_HOST_ID").unwrap_or_else(|_| {
|
||||||
.map(|x| {
|
let hostname: String = hostname().unwrap_or_else(|_| "".to_string());
|
||||||
x.parse()
|
format!("host-{}", hash(hostname.as_bytes())).to_string()
|
||||||
.expect("Failed to parse SOLANA_METRICS_DISPLAY_HOSTNAME")
|
})
|
||||||
})
|
|
||||||
.unwrap_or(0);
|
|
||||||
|
|
||||||
let name: String = hostname().unwrap_or_else(|_| "".to_string());
|
|
||||||
if v == 0 {
|
|
||||||
hash(name.as_bytes()).to_string()
|
|
||||||
} else {
|
|
||||||
name
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +245,7 @@ impl MetricsAgent {
|
||||||
|
|
||||||
let extra = influxdb::Point::new("metrics")
|
let extra = influxdb::Point::new("metrics")
|
||||||
.add_timestamp(timing::timestamp() as i64)
|
.add_timestamp(timing::timestamp() as i64)
|
||||||
.add_field("host_id", influxdb::Value::String(HOST_INFO.to_string()))
|
.add_field("host_id", influxdb::Value::String(HOST_ID.to_string()))
|
||||||
.add_field(
|
.add_field(
|
||||||
"points_written",
|
"points_written",
|
||||||
influxdb::Value::Integer(points_written as i64),
|
influxdb::Value::Integer(points_written as i64),
|
||||||
|
@ -351,7 +342,7 @@ impl MetricsAgent {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn submit(&self, mut point: influxdb::Point, level: log::Level) {
|
pub fn submit(&self, mut point: influxdb::Point, level: log::Level) {
|
||||||
point.add_field("host_id", influxdb::Value::String(HOST_INFO.to_string()));
|
point.add_field("host_id", influxdb::Value::String(HOST_ID.to_string()));
|
||||||
if point.timestamp.is_none() {
|
if point.timestamp.is_none() {
|
||||||
point.timestamp = Some(timing::timestamp() as i64);
|
point.timestamp = Some(timing::timestamp() as i64);
|
||||||
}
|
}
|
||||||
|
@ -461,7 +452,7 @@ pub fn set_panic_hook(program: &'static str) {
|
||||||
None => "?".to_string(),
|
None => "?".to_string(),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.add_field("host_id", influxdb::Value::String(HOST_INFO.to_string()))
|
.add_field("host_id", influxdb::Value::String(HOST_ID.to_string()))
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
Level::Error,
|
Level::Error,
|
||||||
);
|
);
|
||||||
|
|
|
@ -361,6 +361,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
identity_pubkey=$($solana_keygen pubkey "$identity_keypair_path")
|
identity_pubkey=$($solana_keygen pubkey "$identity_keypair_path")
|
||||||
|
export SOLANA_METRICS_HOST_ID="$identity_pubkey"
|
||||||
|
|
||||||
if [[ $node_type != replicator ]]; then
|
if [[ $node_type != replicator ]]; then
|
||||||
accounts_config_dir="$state_dir"/accounts
|
accounts_config_dir="$state_dir"/accounts
|
||||||
|
|
|
@ -81,7 +81,6 @@ case $deployMethod in
|
||||||
local|tar)
|
local|tar)
|
||||||
PATH="$HOME"/.cargo/bin:"$PATH"
|
PATH="$HOME"/.cargo/bin:"$PATH"
|
||||||
export USE_INSTALL=1
|
export USE_INSTALL=1
|
||||||
export SOLANA_METRICS_DISPLAY_HOSTNAME=1
|
|
||||||
|
|
||||||
# Setup `/var/snap/solana/current` symlink so rsyncing the genesis
|
# Setup `/var/snap/solana/current` symlink so rsyncing the genesis
|
||||||
# ledger works (reference: `net/scripts/install-rsync.sh`)
|
# ledger works (reference: `net/scripts/install-rsync.sh`)
|
||||||
|
|
Loading…
Reference in New Issue