Remove influxDB support for profile

It's apparently unused. Influent is unmaintained. Let's remove it
This commit is contained in:
Bastien Orivel 2020-05-04 22:26:12 +02:00
parent 90e07d06c7
commit 97eaea4e68
4 changed files with 2 additions and 74 deletions

16
Cargo.lock generated
View file

@ -2631,21 +2631,6 @@ dependencies = [
"adler32",
]
[[package]]
name = "influent"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87fdeaaa9b5aacb83901de1bb66b32ec574a327758657404c1edf06f5a6ac0f0"
dependencies = [
"base64 0.10.1",
"futures",
"http",
"hyper",
"tokio",
"tokio-executor",
"url",
]
[[package]]
name = "io-surface"
version = "0.12.1"
@ -4133,7 +4118,6 @@ name = "profile"
version = "0.0.1"
dependencies = [
"heartbeats-simple",
"influent",
"ipc-channel",
"libc",
"log",

View file

@ -37,8 +37,6 @@ pub struct Opts {
/// (`i.e. -p 5`).
/// - a file path to write profiling info to a TSV file upon Servo's termination.
/// (`i.e. -p out.tsv`).
/// - an InfluxDB hostname to store profiling info upon Servo's termination.
/// (`i.e. -p http://localhost:8086`)
pub time_profiling: Option<OutputOptions>,
/// When the profiler is enabled, this is an optional path to dump a self-contained HTML file
@ -452,7 +450,6 @@ fn print_debug_usage(app: &str) -> ! {
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum OutputOptions {
/// Database connection config (hostname, name, user, pass)
DB(ServoUrl, Option<String>, Option<String>, Option<String>),
FileName(String),
Stdout(f64),
}
@ -743,12 +740,7 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
Some(argument) => match argument.parse::<f64>() {
Ok(interval) => Some(OutputOptions::Stdout(interval)),
Err(_) => match ServoUrl::parse(&argument) {
Ok(url) => Some(OutputOptions::DB(
url,
opt_match.opt_str("profiler-db-name"),
opt_match.opt_str("profiler-db-user"),
opt_match.opt_str("profiler-db-pass"),
)),
Ok(_) => panic!("influxDB isn't supported anymore"),
Err(_) => Some(OutputOptions::FileName(argument)),
},
},

View file

@ -12,7 +12,6 @@ path = "lib.rs"
[dependencies]
profile_traits = {path = "../profile_traits"}
influent = "0.5"
ipc-channel = "0.14"
heartbeats-simple = "0.4"
log = "0.4"

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;
@ -197,9 +193,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();
@ -475,47 +469,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 */ },
};
}