-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat: add task counter pairs #6114
Conversation
458813d
to
5fec88d
Compare
Gauge like metrics:
|
IMO using two counters rather than a gauge is definitely more correct for these metrics, so I'm 👍 on this change. |
Any status update on this? |
I'll try and fix up the flaky tests tomorrow. Any opinions on the API? Since it's likely that the pair will be accessed together and not separately, doing 2 locks is a bit unfortunate rather than just 1. Probably this should return a tuple pair instead of having 2 functions |
Returning a tuple makes sense to me. You could even define a struct with two fields to give better names than |
4ad7dd4
to
5355563
Compare
Hi, it looks like the conflicting PR has been merged now. Sorry that it took so long to get back to you after that. Are you still interested in working on this? |
Yes, I will rebase accordingly. Are there any other changes you think should be included? |
Hmm, overall it looks good, but I don't love the naming of |
5355563
to
176d74b
Compare
Since the sharded list makes use of atomics, I've moved from added/removed to added/count so that is_empty() only needs 1 atomic access.
I'm tempted to remove it then and we can stick with |
also renamed start_tasks to spawned_tasks as it is likely more intuitive. |
755e551
to
6497d0c
Compare
There's a CI failure:
|
Seems to affect only 32bit arm in the multithreaded case. My guess is that the I don't think it makes too much sense to use a stronger ordering. Maybe in cfg(test) we could go with SeqCst but I don't like that idea very much. I think I would rather remove the assertion for the multi-threaded test, or at least only include it in x86_64/aarch64 which does seem to always work. |
Opted to remove the flaky assert - it works always locally for me. I can't figure out a reliable construction to guarantee the test passes with only Relaxed ordering. I think this is good enough |
Any updates on this? |
0542b98
to
bb82406
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
Motivation
#4073 (comment)
We're hoping to add a prometheus exporter for the tokio metrics information, but a sample rate of 15 seconds will likely miss a lot of task spikes. I could implement some level of eager aggregation, but as the linked comment says, you can still miss some with a sample rate of 500ms.
Solution
In
CountedLinkedList
, replace thecount: usize
with a pair ofu64
s that can only be incremented. Oneu64
for added items and one for removed items.Open to bikeshedding on the terminology
Open questions