-
Notifications
You must be signed in to change notification settings - Fork 4
feat: unconditionally send off a final report on LocalReporter drop #125
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
Changes from all commits
d4b6593
4d59b7d
d6a2538
aa68241
6000da8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| //! 3. [multi::MultiReporter], which allows combining multiple reporters. | ||
|
|
||
| use std::fmt; | ||
| use std::path::Path; | ||
|
|
||
| use async_trait::async_trait; | ||
|
|
||
|
|
@@ -38,4 +39,22 @@ pub trait Reporter: fmt::Debug { | |
| jfr: Vec<u8>, | ||
| metadata: &ReportMetadata, | ||
| ) -> Result<(), Box<dyn std::error::Error + Send>>; | ||
|
|
||
| /// Synchronously report profiling data. Called during drop when the | ||
| /// async runtime is shutting down and async reporting is not possible. | ||
| /// | ||
| /// The default implementation does nothing. Reporters that can perform | ||
| /// synchronous I/O (like [`local::LocalReporter`]) should override this. | ||
| #[doc(hidden)] | ||
| fn report_blocking( | ||
| &self, | ||
| _jfr_path: &Path, | ||
| _metadata: &ReportMetadata, | ||
| ) -> Result<(), Box<dyn std::error::Error + Send>> { | ||
| tracing::info!( | ||
| "reporter does not support synchronous reporting, last sample will be lost. \ | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note that this message is only reached if a sample is actually lost
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this say |
||
| Call `RunningProfiler::stop().await` before shutdown to ensure all samples are uploaded." | ||
| ); | ||
| Ok(()) | ||
| } | ||
| } | ||
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.
what is this test testing? It does not seem to actually test that dropping the local reporter does something.