Skip to content

Commit

Permalink
fix(telemetry): retry telemetry ut 3 times to mitigate failures on CI (
Browse files Browse the repository at this point in the history
…#19983)

Signed-off-by: MrCroxx <[email protected]>
  • Loading branch information
MrCroxx authored Jan 2, 2025
1 parent 5cb0d17 commit 104c4bf
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions src/compute/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ futures-async-stream = { workspace = true }
rand = { workspace = true }
risingwave_hummock_sdk = { workspace = true }
tempfile = "3"
tokio-retry = "0.3"

[lints]
workspace = true
10 changes: 8 additions & 2 deletions src/compute/src/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,13 @@ mod test {
let pb_report = report.to_pb_bytes();
let url =
(TELEMETRY_REPORT_URL.to_owned() + "/" + TELEMETRY_COMPUTE_REPORT_TYPE).to_owned();
let post_res = post_telemetry_report_pb(&url, pb_report).await;
assert!(post_res.is_ok());

// Retry 3 times to mitigate occasional failures on CI.
tokio_retry::Retry::spawn(
tokio_retry::strategy::ExponentialBackoff::from_millis(10).take(3),
|| post_telemetry_report_pb(&url, pb_report.clone()),
)
.await
.unwrap();
}
}
10 changes: 8 additions & 2 deletions src/meta/src/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,13 @@ mod test {

let pb_bytes = report.to_pb_bytes();
let url = (TELEMETRY_REPORT_URL.to_owned() + "/" + TELEMETRY_META_REPORT_TYPE).to_owned();
let result = post_telemetry_report_pb(&url, pb_bytes).await;
assert!(result.is_ok());

// Retry 3 times to mitigate occasional failures on CI.
tokio_retry::Retry::spawn(
tokio_retry::strategy::ExponentialBackoff::from_millis(10).take(3),
|| post_telemetry_report_pb(&url, pb_bytes.clone()),
)
.await
.unwrap();
}
}
3 changes: 3 additions & 0 deletions src/storage/compactor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ tokio = { version = "0.2", package = "madsim-tokio", features = [
tonic = { workspace = true }
tracing = "0.1"

[dev-dependencies]
tokio-retry = "0.3"

[target.'cfg(not(madsim))'.dependencies]
workspace-hack = { path = "../../workspace-hack" }

Expand Down
10 changes: 8 additions & 2 deletions src/storage/compactor/src/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ mod test {
let pb_report = report.to_pb_bytes();
let url =
(TELEMETRY_REPORT_URL.to_owned() + "/" + TELEMETRY_COMPACTOR_REPORT_TYPE).to_owned();
let post_res = post_telemetry_report_pb(&url, pb_report).await;
assert!(post_res.is_ok());

// Retry 3 times to mitigate occasional failures on CI.
tokio_retry::Retry::spawn(
tokio_retry::strategy::ExponentialBackoff::from_millis(10).take(3),
|| post_telemetry_report_pb(&url, pb_report.clone()),
)
.await
.unwrap();
}
}

0 comments on commit 104c4bf

Please sign in to comment.