Skip to content

Commit

Permalink
Fix cloud shotover metrics (#1449)
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai authored Feb 6, 2024
1 parent b47d89c commit 15e030c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
7 changes: 4 additions & 3 deletions Cargo.lock

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

13 changes: 10 additions & 3 deletions shotover-proxy/benches/windsock/cassandra/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,9 @@ impl Bench for CassandraBench {
let shotover_ip = shotover_instance
.as_ref()
.map(|x| x.instance.private_ip().to_string());
let shotover_connect_ip = shotover_instance
.as_ref()
.map(|x| x.instance.connect_ip().to_string());

let mut profiler_instances: HashMap<String, &Ec2Instance> =
[("bencher".to_owned(), &bench_instance.instance)].into();
Expand All @@ -581,9 +584,13 @@ impl Bench for CassandraBench {
profiler_instances.insert("cassandra".to_owned(), &cassandra_instances[0].instance);
}
}
let mut profiler =
CloudProfilerRunner::new(self.name(), profiling, profiler_instances, &shotover_ip)
.await;
let mut profiler = CloudProfilerRunner::new(
self.name(),
profiling,
profiler_instances,
&shotover_connect_ip,
)
.await;

let cassandra_nodes = vec![
AwsNodeInfo {
Expand Down
2 changes: 2 additions & 0 deletions shotover-proxy/benches/windsock/cloud/aws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ impl AwsInstances {
pub async fn new() -> Self {
AwsInstances {
aws: Aws::builder(CleanupResources::WithAppTag(AWS_THROWAWAY_TAG.to_owned()))
// shotover metrics port
.expose_ports_to_internet(vec![9001])
.build()
.await,
}
Expand Down
4 changes: 2 additions & 2 deletions shotover-proxy/benches/windsock/profilers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl CloudProfilerRunner {
bench_name: String,
profiling: Profiling,
instances: HashMap<String, &Ec2Instance>,
shotover_ip: &Option<String>,
shotover_connect_ip: &Option<String>,
) -> Self {
let run_sys_monitor = profiling
.profilers_to_use
Expand All @@ -124,7 +124,7 @@ impl CloudProfilerRunner {
let shotover_metrics = if run_shotover_metrics {
Some(ShotoverMetrics::new(
bench_name.clone(),
shotover_ip.as_ref().unwrap(),
shotover_connect_ip.as_ref().unwrap(),
))
} else {
None
Expand Down
7 changes: 4 additions & 3 deletions shotover-proxy/benches/windsock/profilers/shotover_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,15 @@ impl ShotoverMetrics {
tokio::select! {
_ = shutdown_rx.recv() => break,
_ = interval.tick() => {
match tokio::time::timeout(Duration::from_secs(3), reqwest::get(url)).await.unwrap() {
Ok(response) => {
match tokio::time::timeout(Duration::from_secs(3), reqwest::get(url)).await {
Ok(Ok(response)) => {
results.push(RawPrometheusExposition {
timestamp: OffsetDateTime::now_utc(),
content: response.text().await.unwrap(),
});
}
Err(err) => tracing::debug!("Failed to request from metrics endpoint, probably not up yet, error was {err:?}")
Ok(Err(err)) => tracing::debug!("Failed to request from metrics endpoint {url}, probably not up yet, error was {err:?}"),
Err(_) => panic!("Timed out request from metrics endpoint {url}")
}
}
}
Expand Down

0 comments on commit 15e030c

Please sign in to comment.