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

Improve Error Reporting and Reduce Log Redundancy #327

Conversation

rdumas01
Copy link
Contributor

Changelog

None

Docs

None

Description

The ROS 1 foxglove_bridge rejects parameter names with . and spams the terminal with redundant error messages.

While it is possible for ROS 1 parameters to have a . in their name, they are not "supposed" to (Character [.] is not valid in Graph Resource Name). For this reason, the foxglove_bridge will keep raising errors for parameter names with .

This PR addresses the error handling part of this issue: an unordered set tracks the encountered invalid parameters to throttle error log messages.

BeforeAfter

The bridge std_out gets periodically spammed with the same error messages until the invalid parameter is removed.
In the app, the only visible error message is too vague.

error_log_before

The bridge std_out only prints errors when invalid parameters are first encountered—one error message per invalid parameter.
In the app, the error message lists the invalid parameters.

error_log_after

Comment on lines 701 to 702
std::ostringstream errorMsg;
errorMsg << "Failed to retrieve the following parameters: ";
Copy link
Member

Choose a reason for hiding this comment

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

for something simple like this, I imagine you could use += on a std::string rather than a stringstream, however this is fine too

@jtbandes
Copy link
Member

Looks good to me, might want to double-check with @achim-k if he has any feedback

@defunctzombie
Copy link
Contributor

If the issue is error logging spam - I'd propose using the throttled variants of these macros:

https://docs.ros.org/en/indigo/api/rosconsole/html/macros__generated_8h.html#a1c4cdfdfd4dcc53e6226f0533a0992b7

This avoids the needs to track the params. If you still want to track the params - maybe some upper bound on number of params tracked? I don't imagine too many problems with this vector growing but as written it is definitely a thing that can grow unbounded if you keep making invalid params.

@rdumas01
Copy link
Contributor Author

If the issue is error logging spam - I'd propose using the throttled variants of these macros

I think it's more a dedupe issue than a throttling one, the printing rate is already quite slow (basically it slowly floods the terminal with the same errors, and the more invalid parameters, the more error lines)

maybe some upper bound on number of params tracked?

Yes, good point. I've never had projects with a lot of parameters, is 100 a realistic upper bound?

@defunctzombie
Copy link
Contributor

Yes, good point. I've never had projects with a lot of parameters, is 100 a realistic upper bound?

Could probably make it a thousand - a list of strings is not so insane to store - more that if some weird software does iterate params constantly you don't want that to make the bridge fall over after a few hours. I don't know how realistic of an issue this is but that's what came to mind with adding these to the set.

@rdumas01 rdumas01 merged commit 7f2968f into foxglove:main Nov 26, 2024
9 checks passed
@rdumas01 rdumas01 deleted the robin/fg-9205-ros-1-foxglove_bridge-rejects-parameter-names-with branch November 26, 2024 22:19
@rdumas01 rdumas01 mentioned this pull request Nov 26, 2024
jtbandes pushed a commit that referenced this pull request Nov 26, 2024
### Changelog
* Improve Error Reporting and Reduce Log Redundancy
(#327)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants