Auto merge of #26421 - Eijebong:remove-influent, r=jdm

Remove influxDB support for profile

It's apparently unused. Influent is unmaintained. Let's remove it
This commit is contained in:
bors-servo 2020-05-25 23:08:32 -04:00 committed by GitHub
commit a3446579ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 74 deletions

View file

@ -6,9 +6,6 @@
use crate::heartbeats;
use crate::trace_dump::TraceDump;
use influent::client::{Client, Credentials};
use influent::create_client;
use influent::measurement::{Measurement, Value};
use ipc_channel::ipc::{self, IpcReceiver};
use profile_traits::energy::{energy_interval_ms, read_energy_uj};
use profile_traits::time::{
@ -25,7 +22,6 @@ use std::path::Path;
use std::time::Duration;
use std::{f64, thread, u32, u64};
use time_crate::precise_time_ns;
use tokio::prelude::Future;
pub trait Formattable {
fn format(&self, output: &Option<OutputOptions>) -> String;
@ -198,9 +194,7 @@ impl Profiler {
.expect("Thread spawning failed");
// decide if we need to spawn the timer thread
match option {
&OutputOptions::FileName(_) | &OutputOptions::DB(_, _, _, _) => {
/* no timer thread needed */
},
&OutputOptions::FileName(_) => { /* no timer thread needed */ },
&OutputOptions::Stdout(period) => {
// Spawn a timer thread
let chan = chan.clone();
@ -476,47 +470,6 @@ impl Profiler {
}
writeln!(&mut lock, "").unwrap();
},
Some(OutputOptions::DB(ref hostname, ref dbname, ref user, ref password)) => {
// Unfortunately, influent does not like hostnames ending with "/"
let mut hostname = hostname.to_string();
if hostname.ends_with("/") {
hostname.pop();
}
let empty = String::from("");
let username = user.as_ref().unwrap_or(&empty);
let password = password.as_ref().unwrap_or(&empty);
let database = dbname.as_ref().unwrap_or(&empty);
let credentials = Credentials {
username: username,
password: password,
database: database,
};
let hosts = vec![hostname.as_str()];
let client = create_client(credentials, hosts);
for (&(ref category, ref meta), ref mut data) in &mut self.buckets {
data.sort_by(|a, b| a.partial_cmp(b).expect("No NaN values in profiles"));
let data_len = data.len();
if data_len > 0 {
let (mean, median, min, max) = Self::get_statistics(data);
let category = category.format(&self.output);
let mut measurement = Measurement::new(&category);
measurement.add_field("mean", Value::Float(mean));
measurement.add_field("median", Value::Float(median));
measurement.add_field("min", Value::Float(min));
measurement.add_field("max", Value::Float(max));
if let Some(ref meta) = *meta {
measurement.add_tag("host", meta.url.as_str());
};
tokio::run(client.write_one(measurement, None).map_err(|e| {
warn!("Could not write measurement to profiler db: {:?}", e)
}));
}
}
},
None => { /* Do nothing if no output option has been set */ },
};
}