Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove influxDB support for profile
It's apparently unused. Influent is unmaintained. Let's remove it
  • Loading branch information
Eijebong committed May 4, 2020
1 parent 90e07d0 commit 97eaea4
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 74 deletions.
16 changes: 0 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions components/config/opts.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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),
}
Expand Down Expand Up @@ -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)),
},
},
Expand Down
1 change: 0 additions & 1 deletion components/profile/Cargo.toml
Expand Up @@ -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"
Expand Down
49 changes: 1 addition & 48 deletions components/profile/time.rs
Expand Up @@ -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::{
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 */ },
};
}
Expand Down

0 comments on commit 97eaea4

Please sign in to comment.