Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide double-shutdown log occurring on hot reloads #6725

Merged
merged 5 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apollo-router/src/plugins/telemetry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1814,6 +1814,12 @@ fn handle_error_internal<T: Into<opentelemetry::global::Error>>(
::tracing::warn!(parent: None, "OpenTelemetry metric warning occurred: {}", msg);
return;
}

// TODO: We should be able to remove this after upgrading to 0.26.0, which addresses the double-shutdown
// called out in https://github.com/open-telemetry/opentelemetry-rust/issues/1661
if msg == "metrics provider already shut down" {
return;
}
}
::tracing::error!(parent: None, "OpenTelemetry metric error occurred: {}", err);
}
Expand Down
12 changes: 12 additions & 0 deletions apollo-router/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,18 @@ impl IntegrationTest {
}
}

#[allow(dead_code)]
pub async fn assert_log_not_contained(&self, msg: &str) {
for line in &self.logs {
if line.contains(msg) {
panic!(
"'{msg}' detected in logs. Log dump below:\n\n{logs}",
logs = self.logs.join("\n")
);
}
}
}

#[allow(dead_code)]
pub async fn assert_metrics_contains(&self, text: &str, duration: Option<Duration>) {
let now = Instant::now();
Expand Down
3 changes: 3 additions & 0 deletions apollo-router/tests/integration/telemetry/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ async fn test_metrics_reloading() {

router.touch_config().await;
router.assert_reloaded().await;
router
.assert_log_not_contained("OpenTelemetry metric error occurred: Metrics error: metrics provider already shut down")
.await;
}

let metrics = router
Expand Down
3 changes: 3 additions & 0 deletions apollo-router/tests/integration/telemetry/otlp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ async fn test_basic() -> Result<(), BoxError> {
.await?;
router.touch_config().await;
router.assert_reloaded().await;
router
.assert_log_not_contained("OpenTelemetry metric error occurred: Metrics error: metrics provider already shut down")
.await;
}
router.graceful_shutdown().await;
Ok(())
Expand Down