Skip to content

Commit

Permalink
Fix cloud shotover metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai committed Feb 1, 2024
1 parent 82a245e commit 9155b62
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ rand_distr = "0.4.1"
clap = { version = "4.0.4", features = ["cargo", "derive"] }
async-trait = "0.1.30"
typetag = "0.2.5"
aws-throwaway = { version = "0.6.0", default-features = false }
aws-throwaway = { version = "0.6.0", default-features = false, git = "https://github.com/rukai/aws-throwaway", branch = "expose_ports_to_internet" }
tokio-bin-process = "0.4.0"
ordered-float = { version = "4.0.0", features = ["serde"] }
hyper = { version = "0.14.14", features = ["server"] }
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
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::error!("Failed to request from metrics endpoint {url}, probably not up yet, error was {err:?}"),
Err(err) => tracing::error!("Timed out request from metrics endpoint {url}, probably not up yet, error was {err:?}")
}
}
}
Expand Down

0 comments on commit 9155b62

Please sign in to comment.