Remove hostname() from calls to metrics as it's expensive operation (#1557)

This commit is contained in:
Pankaj Garg 2018-10-20 06:38:20 -07:00 committed by GitHub
parent f8516b677a
commit df9ccce5b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 22 deletions

View File

@ -22,7 +22,6 @@ use std::thread::{self, Builder, JoinHandle};
use std::time::Duration;
use std::time::Instant;
use streamer::{responder, BlobSender};
use sys_info::hostname;
use vote_stage::send_validator_vote;
#[derive(Debug, PartialEq, Eq, Clone)]
@ -75,10 +74,7 @@ impl ReplicateStage {
metrics::submit(
influxdb::Point::new("replicate-stage")
.add_field(
"host",
influxdb::Value::String(hostname().unwrap_or_else(|_| "?".to_string())),
).add_field("count", influxdb::Value::Integer(entries.len() as i64))
.add_field("count", influxdb::Value::Integer(entries.len() as i64))
.to_owned(),
);

View File

@ -17,7 +17,6 @@ use std::sync::{Arc, RwLock};
use std::thread::{self, Builder, JoinHandle};
use std::time::Duration;
use streamer::BlobReceiver;
use sys_info::hostname;
use window::SharedWindow;
use window_service::window_service;
@ -34,10 +33,7 @@ fn retransmit(
metrics::submit(
influxdb::Point::new("retransmit-stage")
.add_field(
"host",
influxdb::Value::String(hostname().unwrap_or_else(|_| "?".to_string())),
).add_field("count", influxdb::Value::Integer(dq.len() as i64))
.add_field("count", influxdb::Value::Integer(dq.len() as i64))
.to_owned(),
);

View File

@ -18,7 +18,6 @@ use std::sync::{Arc, RwLock};
use std::thread::{Builder, JoinHandle};
use std::time::{Duration, Instant};
use streamer::{BlobReceiver, BlobSender};
use sys_info::hostname;
use timing::duration_as_ms;
use window::{blob_idx_in_window, SharedWindow, WindowUtil};
@ -122,9 +121,6 @@ fn retransmit_all_leader_blocks(
metrics::submit(
influxdb::Point::new("retransmit-queue")
.add_field(
"host",
influxdb::Value::String(hostname().unwrap_or_else(|_| "?".to_string())),
).add_field(
"count",
influxdb::Value::Integer(retransmit_queue.len() as i64),
).to_owned(),
@ -177,10 +173,7 @@ fn recv_window(
metrics::submit(
influxdb::Point::new("recv-window")
.add_field(
"host",
influxdb::Value::String(hostname().unwrap_or_else(|_| "?".to_string())),
).add_field("count", influxdb::Value::Integer(dq.len() as i64))
.add_field("count", influxdb::Value::Integer(dq.len() as i64))
.to_owned(),
);
@ -314,10 +307,7 @@ pub fn window_service(
metrics::submit(
influxdb::Point::new("window-stage")
.add_field(
"host",
influxdb::Value::String(hostname().unwrap_or_else(|_| "?".to_string())),
).add_field("consumed", influxdb::Value::Integer(consumed as i64))
.add_field("consumed", influxdb::Value::Integer(consumed as i64))
.to_owned(),
);