-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
[Merged by Bors] - bevy_app: add tracing event with tracy.frame_mark
#4320
Conversation
Is it a good idea to depend on both From their doc it seems they shouldn't be used both at the same time |
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.
Did you try using a tracing event with the frame marker but at the debug level or so? Does it just get filtered out before it gets sent to Tracy? I think that aspect was maybe why I didn't make a PR.
Perhaps if that is a negative side effect of using the tracing frame marker API, we could make a contribution to tracing-tracy to allow directly calling finish continuous frame for when an event or message or so is undesirable.
I tried but that didn't work in release mode as |
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.
LGTM once you resolve the correct position of the frame end :)
just to note an alternative to using another import, we could also suppress the info logging for tracy events: +++ b/crates/bevy_log/src/lib.rs
@@ -159,6 +159,11 @@ impl Plugin for LogPlugin {
let tracy_layer = tracing_tracy::TracyLayer::new();
let fmt_layer = tracing_subscriber::fmt::Layer::default();
+ #[cfg(feature = "tracing-tracy")]
+ let fmt_layer = fmt_layer.with_filter(
+ tracing_subscriber::filter::Targets::new().with_target("tracy", Level::ERROR),
+ );
+
let subscriber = subscriber.with(fmt_layer);
#[cfg(feature = "tracing-chrome")] |
@robtfm oh that’s a good find. I guess warnings would be ok |
@jakobhellermann what do you think of @robtfm ’s suggestion? |
I switched to @robtfm's suggestion to use the event but exclude it from the |
bors r+ |
Currently `tracy` interprets the entire trace as one frame because the marker for frames isn't being recorded. ~~When an event with `tracy.trace_marker=true` is recorded, `tracing-tracy` will mark the frame as finished: <https://github.com/nagisa/rust_tracy_client/blob/aa0b96b2ae2aee6f3831994f9a3a8c29bcc85fae/tracing-tracy/src/lib.rs#L240>~~ ~~Unfortunately this leads to~~ ```rs INFO bevy_app:frame: bevy_app::app: finished frame tracy.frame_mark=true ``` ~~being printed every frame (we can't use DEBUG because bevy_log sets `max_release_level_info`.~~ Instead of emitting an event that gets logged every frame, we can depend on tracy-client itself and call `finish_continuous_frame!();`
tracy.frame_mark
tracy.frame_mark
Currently `tracy` interprets the entire trace as one frame because the marker for frames isn't being recorded. ~~When an event with `tracy.trace_marker=true` is recorded, `tracing-tracy` will mark the frame as finished: <https://github.com/nagisa/rust_tracy_client/blob/aa0b96b2ae2aee6f3831994f9a3a8c29bcc85fae/tracing-tracy/src/lib.rs#L240>~~ ~~Unfortunately this leads to~~ ```rs INFO bevy_app:frame: bevy_app::app: finished frame tracy.frame_mark=true ``` ~~being printed every frame (we can't use DEBUG because bevy_log sets `max_release_level_info`.~~ Instead of emitting an event that gets logged every frame, we can depend on tracy-client itself and call `finish_continuous_frame!();`
Bevy was failing to print events from `info!()` and friends to the console if the `trace_tracy` feature was enabled. The problem was this per-layer filter that was added in bevyengine#4320 to suppress a noisy per-frame event (which Tracy requires in order to properly close out a frame): - The problem event's target was `"bevy_render::renderer"`, not `"tracy"`. - So, the filter wasn't specifically targeting the noisy event. - Without a default, `tracing_subscriber::filter::Targets` will remove _everything_ that doesn't match an explicit target rule. - So, the filter _was_ silencing the noisy event, along with everything else. This commit changes that filter to do what was probably intended in bevyengine#4320: suppress any events more verbose than `ERROR` from `bevy_render::renderer`, but allow anything else that already made it through the top-level filter_layer.
Bevy was failing to print events from `info!()` and friends to the console if the `trace_tracy` feature was enabled. The problem was this per-layer filter that was added in bevyengine#4320 to suppress a noisy per-frame event (which Tracy requires in order to properly close out a frame): - The problem event's target was `"bevy_render::renderer"`, not `"tracy"`. - So, the filter wasn't specifically targeting the noisy event. - Without a default, `tracing_subscriber::filter::Targets` will remove _everything_ that doesn't match an explicit target rule. - So, the filter _was_ silencing the noisy event, along with everything else. This commit changes that filter to do what was probably intended in bevyengine#4320: suppress any events more verbose than `ERROR` from `bevy_render::renderer`, but allow anything else that already made it through the top-level filter_layer.
) # Objective Fixes #6862 (oh hey good catch @alice-i-cecile) Bevy was failing to print events from `info!()` and friends to the console if the `trace_tracy` feature was enabled. It shouldn't be doing that. ## Solution The problem was this per-layer filter that was added in #4320 to suppress a noisy per-frame event (which Tracy requires in order to properly close out a frame): - The problem event's target was `"bevy_render::renderer"`, not `"tracy"`. - So, the filter wasn't specifically targeting the noisy event. - Without a default, `tracing_subscriber::filter::Targets` will remove _everything_ that doesn't match an explicit target rule. - So, the filter _was_ silencing the noisy event, along with everything else. This PR changes that filter to do what was probably intended in #4320: suppress ~any events more verbose than `ERROR` from `bevy_render::renderer`~ the one problematically noisy event, but allow anything else that already made it through the top-level filter_layer. Also, adds a comment to clarify the intent of that filter, since it's otherwise a bit opaque and required some research. --- ## Changelog Fixed a bug that hid console log messages when the `trace_tracy` feature was enabled.
…vyengine#6955) # Objective Fixes bevyengine#6862 (oh hey good catch @alice-i-cecile) Bevy was failing to print events from `info!()` and friends to the console if the `trace_tracy` feature was enabled. It shouldn't be doing that. ## Solution The problem was this per-layer filter that was added in bevyengine#4320 to suppress a noisy per-frame event (which Tracy requires in order to properly close out a frame): - The problem event's target was `"bevy_render::renderer"`, not `"tracy"`. - So, the filter wasn't specifically targeting the noisy event. - Without a default, `tracing_subscriber::filter::Targets` will remove _everything_ that doesn't match an explicit target rule. - So, the filter _was_ silencing the noisy event, along with everything else. This PR changes that filter to do what was probably intended in bevyengine#4320: suppress ~any events more verbose than `ERROR` from `bevy_render::renderer`~ the one problematically noisy event, but allow anything else that already made it through the top-level filter_layer. Also, adds a comment to clarify the intent of that filter, since it's otherwise a bit opaque and required some research. --- ## Changelog Fixed a bug that hid console log messages when the `trace_tracy` feature was enabled.
…vyengine#6955) # Objective Fixes bevyengine#6862 (oh hey good catch @alice-i-cecile) Bevy was failing to print events from `info!()` and friends to the console if the `trace_tracy` feature was enabled. It shouldn't be doing that. ## Solution The problem was this per-layer filter that was added in bevyengine#4320 to suppress a noisy per-frame event (which Tracy requires in order to properly close out a frame): - The problem event's target was `"bevy_render::renderer"`, not `"tracy"`. - So, the filter wasn't specifically targeting the noisy event. - Without a default, `tracing_subscriber::filter::Targets` will remove _everything_ that doesn't match an explicit target rule. - So, the filter _was_ silencing the noisy event, along with everything else. This PR changes that filter to do what was probably intended in bevyengine#4320: suppress ~any events more verbose than `ERROR` from `bevy_render::renderer`~ the one problematically noisy event, but allow anything else that already made it through the top-level filter_layer. Also, adds a comment to clarify the intent of that filter, since it's otherwise a bit opaque and required some research. --- ## Changelog Fixed a bug that hid console log messages when the `trace_tracy` feature was enabled.
Currently `tracy` interprets the entire trace as one frame because the marker for frames isn't being recorded. ~~When an event with `tracy.trace_marker=true` is recorded, `tracing-tracy` will mark the frame as finished: <https://github.com/nagisa/rust_tracy_client/blob/aa0b96b2ae2aee6f3831994f9a3a8c29bcc85fae/tracing-tracy/src/lib.rs#L240>~~ ~~Unfortunately this leads to~~ ```rs INFO bevy_app:frame: bevy_app::app: finished frame tracy.frame_mark=true ``` ~~being printed every frame (we can't use DEBUG because bevy_log sets `max_release_level_info`.~~ Instead of emitting an event that gets logged every frame, we can depend on tracy-client itself and call `finish_continuous_frame!();`
Currently
tracy
interprets the entire trace as one frame because the marker for frames isn't being recorded.When an event withtracy.trace_marker=true
is recorded,tracing-tracy
will mark the frame as finished:https://github.com/nagisa/rust_tracy_client/blob/aa0b96b2ae2aee6f3831994f9a3a8c29bcc85fae/tracing-tracy/src/lib.rs#L240
Unfortunately this leads tobeing printed every frame (we can't use DEBUG because bevy_log setsmax_release_level_info
.Instead of emitting an event that gets logged every frame, we can depend on tracy-client itself and call
finish_continuous_frame!();