-
-
Notifications
You must be signed in to change notification settings - Fork 144
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(console): add task scheduled times histogram #409
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bfaa90e
feat(console): add scheduled time per task
hds f50f258
feat(console): add scheduled times histogram
hds c6177e9
Merge remote-tracking branch 'origin' into woken-histogram
hds 22070bb
Revert unintended change in long_schedule example
hds 632958d
Fix doubled up console-api entries
hds e4652e7
Added a comment on the percentiles widget width to clarify
hds 13d4e90
Merge branch 'main' into woken-histogram
hawkw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use std::time::Duration; | ||
|
||
use console_subscriber::ConsoleLayer; | ||
use tokio::task::{self, yield_now}; | ||
use tracing::info; | ||
|
||
#[tokio::main(flavor = "multi_thread", worker_threads = 2)] | ||
async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
ConsoleLayer::builder() | ||
.with_default_env() | ||
.publish_interval(Duration::from_millis(100)) | ||
.init(); | ||
|
||
let long_sleeps = task::Builder::new() | ||
.name("long-sleeps") | ||
.spawn(long_sleeps(5000)) | ||
.unwrap(); | ||
|
||
let sleep_forever = task::Builder::new() | ||
.name("sleep-forever") | ||
.spawn(sleep_forever(5000)) | ||
.unwrap(); | ||
|
||
match (long_sleeps.await, sleep_forever.await) { | ||
(Ok(_), Ok(_)) => info!("Success"), | ||
(_, _) => info!("Error awaiting tasks."), | ||
} | ||
|
||
tokio::time::sleep(Duration::from_millis(200)).await; | ||
|
||
Ok(()) | ||
} | ||
|
||
async fn long_sleeps(inc: u64) { | ||
let millis = inc; | ||
loop { | ||
std::thread::sleep(Duration::from_millis(millis)); | ||
|
||
yield_now().await; | ||
} | ||
} | ||
|
||
async fn sleep_forever(inc: u64) { | ||
let millis = inc; | ||
loop { | ||
std::thread::sleep(Duration::from_millis(millis)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Where is the Durations widget currently constructed with a width of 0? Is that used for the resource details view, where we only have one durations widget?
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.
Actually (and I had to go and check this to be sure), the resource details view doesn't have a Durations widget currently (although it will be much easier to add after the refactoring). The
width=0
value here is set as a sensible default if a fixed width isn't set.The fixed width was introduced in this PR so that the percentiles and sparklines widgets are the same width for both the Durations widgets irrespective of the title length (so that it looks nicer).
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.
It seems like we could change the constructor to require that a non-zero width is always provided, and remove this behavior, if we intend to always construct the widget with a fixed width? This might be a bit simpler. Not a blocker though...