:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(flags): make tokio monitor delta tests deterministic (#109587)
Phil Haackc48de162250d
diff --git a/rust/cohort-stream-processor/src/observability/tokio_monitor.rs b/rust/cohort-stream-processor/src/observability/tokio_monitor.rsindex 0630570158fd..39ff79eda60e 100644--- a/rust/cohort-stream-processor/src/observability/tokio_monitor.rs+++ b/rust/cohort-stream-processor/src/observability/tokio_monitor.rs@@ -269,8 +269,11 @@ mod tests {// Covers the unstable delta path (poll/steal/overflow), which runs in production because// `tokio_unstable` is enabled workspace-wide: a wrong `saturating_sub` order or a missed// `prev_*` update would emit silently wrong deltas that the stable-path test cannot catch.+ // A current-thread runtime publishes worker metrics before it resumes this test.+ // A multi-thread worker publishes them only when it parks or runs maintenance.+ // Either can happen after the test reads them.#[cfg(tokio_unstable)]- #[tokio::test(flavor = "multi_thread", worker_threads = 2)]+ #[tokio::test]async fn poll_and_busy_deltas_advance_after_work() {let handle = tokio::runtime::Handle::current();let metrics = handle.metrics();diff --git a/rust/feature-flags/src/tokio_monitor.rs b/rust/feature-flags/src/tokio_monitor.rsindex d601815aa933..f2e6d5bc9b7e 100644--- a/rust/feature-flags/src/tokio_monitor.rs+++ b/rust/feature-flags/src/tokio_monitor.rs@@ -288,8 +288,11 @@ mod tests {task.await.ok();}+ // A current-thread runtime publishes worker metrics before it resumes this test.+ // A multi-thread worker publishes them only when it parks or runs maintenance.+ // Either can happen after the test reads them.#[cfg(tokio_unstable)]- #[tokio::test(flavor = "multi_thread", worker_threads = 2)]+ #[tokio::test]async fn poll_and_busy_deltas_advance_after_work() {let handle = tokio::runtime::Handle::current();let metrics = handle.metrics();@@ -301,7 +304,7 @@ mod tests {let polls_before: Vec<u64> = unstable_state.prev_polls.clone();let busy_before: Vec<Duration> = stable_state.prev_busy.clone();- // Spawn real tasks so worker threads register polls+ // Spawn real tasks so the worker registers pollslet mut handles = Vec::new();for _ in 0..50 {handles.push(tokio::spawn(async {