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

stabilize worker_total_busy_duration #6899

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8f1fcb4
stabilize worker total busy duration, bring WorkerMetrics, MetricsBat…
Owen-CH-Leung Oct 11, 2024
9b47cf9
Fix rustfmt ci job
Owen-CH-Leung Oct 11, 2024
e2f4f33
Fix various failing CI jobs by adding cfg(target_has_atomic = "64") t…
Owen-CH-Leung Oct 11, 2024
b6974ba
Use cfg_64bit_metrics instead
Owen-CH-Leung Oct 11, 2024
86f019f
Fix formatting and remove brackets
Owen-CH-Leung Oct 11, 2024
64f626d
Creat Mock Histogram, HistogramBatch and HistogramBuilder. Revert cha…
Owen-CH-Leung Oct 16, 2024
489003c
Hide queue_depth and thread_id behind unstable flag
Owen-CH-Leung Oct 16, 2024
8a134a2
Mark most fields of WorkerMetrics as unstable, except for busy_durati…
Owen-CH-Leung Oct 19, 2024
4bc00cf
Merge branch 'master' into stabilize_worker_total_busy_duration
Owen-CH-Leung Oct 19, 2024
7eb6b97
Remove allow dead_code, merge master & fix spellcheck
Owen-CH-Leung Oct 19, 2024
7239af5
Merge branch 'master' into stabilize_worker_total_busy_duration
Owen-CH-Leung Oct 21, 2024
57f6b9b
Add back worker_total_busy_duration test
Owen-CH-Leung Oct 21, 2024
c8b2c7d
Remove mock metricBatch, split MetricBatch implementation into stable…
Owen-CH-Leung Oct 22, 2024
d7333cf
Merge branch 'master' into stabilize_worker_total_busy_duration
Owen-CH-Leung Nov 23, 2024
14543de
Gate code based on cfg_unstable_metrics and cfg_not_unstable_metrics
Owen-CH-Leung Nov 23, 2024
245d75c
Merge branch 'master' into stabilize_worker_total_busy_duration
Owen-CH-Leung Dec 17, 2024
e0d0b84
Merge branch 'master' into stabilize_worker_total_busy_duration
Owen-CH-Leung Jan 11, 2025
b821f92
add new macro cfg_metrics_variant, refactor stable/unstable code
Owen-CH-Leung Jan 11, 2025
64f029a
refactor field ordering, add more stable/unstable code using cfg_metr…
Owen-CH-Leung Jan 13, 2025
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
Prev Previous commit
Next Next commit
Add back worker_total_busy_duration test
  • Loading branch information
Owen-CH-Leung committed Oct 21, 2024
commit 57f6b9b1d99772c9ffeb7226cef152b56fe643ee
43 changes: 43 additions & 0 deletions tokio/tests/rt_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,49 @@ fn global_queue_depth_multi_thread() {
panic!("exhausted every try to block the runtime");
}

#[test]
fn worker_total_busy_duration() {
const N: usize = 5;

let zero = Duration::from_millis(0);

let rt = current_thread();
let metrics = rt.metrics();

rt.block_on(async {
for _ in 0..N {
tokio::spawn(async {
tokio::task::yield_now().await;
})
.await
.unwrap();
}
});

drop(rt);

assert!(zero < metrics.worker_total_busy_duration(0));

let rt = threaded();
let metrics = rt.metrics();

rt.block_on(async {
for _ in 0..N {
tokio::spawn(async {
tokio::task::yield_now().await;
})
.await
.unwrap();
}
});

drop(rt);

for i in 0..metrics.num_workers() {
assert!(zero < metrics.worker_total_busy_duration(i));
}
}

fn try_block_threaded(rt: &Runtime) -> Result<Vec<mpsc::Sender<()>>, mpsc::RecvTimeoutError> {
let (tx, rx) = mpsc::channel();

Expand Down
Loading