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

Add trace log while dropping the messages. #1607

Merged
merged 2 commits into from
Nov 22, 2024
Merged

Conversation

evshary
Copy link
Contributor

@evshary evshary commented Nov 22, 2024

It will be convenient to debug if there is a trace log while dropping the messages

Copy link

PR missing one of the required labels: {'new feature', 'dependencies', 'internal', 'enhancement', 'breaking-change', 'bug', 'documentation'}

@evshary evshary added the enhancement Existing things could work better label Nov 22, 2024
Signed-off-by: ChenYing Kuo <[email protected]>
@evshary evshary requested a review from Mallets November 22, 2024 10:05
@Mallets Mallets added internal Changes not included in the changelog and removed enhancement Existing things could work better labels Nov 22, 2024
@@ -235,6 +235,10 @@ impl StageIn {
// Still no available batch.
// Restore the sequence number and drop the message
$($restore_sn)?
tracing::trace!(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for catching it only now, but in case $restore_sn returns early, the log will not be printed but the message will still be dropped. What about moving the log before $restore_sn? Please double check what is actually executed in the $restore_sn.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I will double check that, although the return value is bool and I don't think it can be returned earlier

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, then I'm a bit confused about the $($restore_sn)? syntax. What is ?? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means the code is optional. It will be added if the macro has the argument $restore_sn
For example, https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=07557c8c874e8944528c3f030c7f96dc

In our case, $($restore_sn)? will become tch.sn.set(sn).unwrap() according to

batch = zgetbatch_rets!(tch.sn.set(sn).unwrap());

And will become empty when it comes to

let mut batch = zgetbatch_rets!();

BTW, I just learned that we can easily get expanded macro with rust-analyzer in vscode
https://stackoverflow.com/a/71454821/22130710
Learn something new each day 😆

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@Mallets Mallets merged commit 9a84e6d into eclipse-zenoh:main Nov 22, 2024
14 checks passed
@evshary evshary deleted the add_log branch November 22, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Changes not included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants