Skip to content

Commit 8feb140

Browse files
author
Thomas Luijken
committed
Print track trace with vague failed requests
1 parent 9fde941 commit 8feb140

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

oxybox/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "oxybox"
3-
version = "1.0.2"
3+
version = "1.0.3"
44
authors = ["Thomas Luijken"]
55
categories = ["command-line-utilities"]
66
description = "A drop in replacement for blackbox exporter for Prometheus, with support for TLS and HTTP/3."

oxybox/src/http_probe/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
11
pub mod probe;
22
pub mod result;
3+
4+
use std::fmt::Write;
5+
6+
fn report(mut err: &(dyn std::error::Error + 'static)) -> String {
7+
let mut s = format!("{}", err);
8+
while let Some(src) = err.source() {
9+
let _ = write!(s, "\n\nCaused by: {}", src);
10+
err = src;
11+
}
12+
s
13+
}

oxybox/src/http_probe/probe.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use tokio_native_tls::TlsConnector as TokioTlsConnector;
1010
use x509_parser::parse_x509_certificate;
1111

1212
use crate::config::probe_config::{OrganisationConfig, TargetConfig};
13+
use crate::http_probe::report;
1314
use crate::mimir::client::send_to_mimir;
1415
use crate::mimir::create_probe_metrics;
1516

@@ -201,7 +202,8 @@ async fn probe_url(
201202
)
202203
}
203204
Err(e) => {
204-
log::error!("HTTP request failed for URL {url}: {e}");
205+
let error = report(&e);
206+
log::error!("HTTP request failed for URL {url}: {error}");
205207
return Err(format!("HTTP request failed for URL {url}: {e}"));
206208
}
207209
};

0 commit comments

Comments
 (0)