Skip to content

Commit 8616851

Browse files
author
Thomas Luijken
committed
Use allowed status_codes for probe_success
1 parent eb249e5 commit 8616851

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

.github/workflows/BUILD_AND_DEPLOY.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ jobs:
3333
password: ${{ secrets.BASEFLOW_ACR_PASSWORD }}
3434
push: ${{ github.event_name != 'pull_request' }}
3535
vulnerability_scan: ${{ github.event_name != 'pull_request' }}
36-
version: 1.7
36+
version: 1.8
3737
context: ./oxybox

oxybox/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ async fn main() {
102102
);
103103
}
104104

105-
let metrics = create_probe_metrics(&result);
105+
let metrics = create_probe_metrics(&result, is_accepted);
106106
if let Err(e) = send_to_mimir(
107107
&mimir_target,
108108
Some(&organisation_id),

oxybox/src/mimir/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const PROBE_HTTP_VERSION_METRIC: &str = "probe_http_version";
2222
// const PROBE_TOTAL_DURATION_METRIC: &str = "probe_total_duration_seconds";
2323
const PROBE_HTTP_SSL_EARLIEST_EXPIERY_METRIC: &str = "probe_ssl_earliest_cert_expiry";
2424

25-
const BLACKBOX_JOB: &str = "blackbox";
26-
const HTTP_MODULE: &str = "oxybox_http";
25+
const BLACKBOX_JOB: &str = "oxybox";
26+
const HTTP_MODULE: &str = "http_probe";
2727

2828
fn create_time_series(
2929
metric_name: &str,
@@ -45,13 +45,13 @@ fn create_time_series(
4545
client::create_time_series(metric_name, &labels, value, None)
4646
}
4747

48-
pub fn create_probe_metrics(probe_result: &crate::ProbeResult) -> Vec<prompb::TimeSeries> {
48+
pub fn create_probe_metrics(probe_result: &crate::ProbeResult, probe_success: bool) -> Vec<prompb::TimeSeries> {
4949
let mut metrics = Vec::new();
50-
let probe_successful = if probe_result.http_status.unwrap_or_default() == 200 {
51-
1.0
52-
} else {
53-
0.0
50+
let probe_successful = match probe_success {
51+
true => 1.0,
52+
false => 0.0,
5453
};
54+
5555
metrics.push(create_time_series(
5656
PROBE_SUCCESS_METRIC,
5757
&probe_result.url,

0 commit comments

Comments
 (0)