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 optional tracing feature for development logging #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Notgnoshi
Copy link
Member

This PR adds optional tracing instrumentation in the ag_iso_stack::tracing module to enable tracing, if the tracing feature is enabled. Otherwise, the macros provided by the ag_iso_stack::tracing module compile away.

I expect this to be a helpful developer feature, that I don't expect a user to want to use. I also expect that as AgIsoStack-rs grows, we'd probably want to remove the tracing::trace! macros in the Drivers.

image

@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (da74b03) 11.52% compared to head (0160334) 10.89%.

Files Patch % Lines
src/driver/socketcan.rs 0.00% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #12      +/-   ##
==========================================
- Coverage   11.52%   10.89%   -0.63%     
==========================================
  Files          17       17              
  Lines        2664     2624      -40     
==========================================
- Hits          307      286      -21     
+ Misses       2357     2338      -19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Notgnoshi Notgnoshi marked this pull request as ready for review August 16, 2023 15:22
@Open-Agriculture Open-Agriculture deleted a comment from github-actions bot Aug 16, 2023
@Notgnoshi Notgnoshi changed the title DRAFT: Add optional tracing feature for development logging Add optional tracing feature for development logging Nov 7, 2023
JannesBrands
JannesBrands previously approved these changes Nov 7, 2023
Copy link
Member

@JannesBrands JannesBrands left a comment

Choose a reason for hiding this comment

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

Like a lot your optional tracing feature. But is the intention to use it only on the can driver layer or also for network management and other stuff? Would like to use it in all the library cause it helps also a lot to debug in the field. Another idea would be to have a possibility to activate it manually for single parts of the library. Cause with all that bus traffic the console would be a complete mess. For example to just trace the 11783-6 or only the network management...

src/tracing.rs Show resolved Hide resolved
examples/forward.rs Outdated Show resolved Hide resolved
@Notgnoshi
Copy link
Member Author

But is the intention to use it only on the can driver layer or also for network management and other stuff?

I intend to use it anywhere it's useful!

Another idea would be to have a possibility to activate it manually for single parts of the library.

Yeah, this would be awesome - but I'm not quite sure how to do that right now. I think for now it can be enabled/disabled globally until it becomes a problem?

Cause with all that bus traffic the console would be a complete mess.

Yes it would be 😆 - my original plan when I started this was to add it during development of a feature, and then remove it once I'm confident that feature works, but I like your idea of enabling it for different parts of the library more ❤️

@JannesBrands
Copy link
Member

JannesBrands commented Nov 7, 2023

Yes it would be 😆 - my original plan when I started this was to add it during development of a feature, and then remove it once I'm confident that feature works, but I like your idea of enabling it for different parts of the library more ❤️

I would like to have a custom tracing for each module/folder like in #26 where it prints for example: network_management: lipsem ido dasdoaisdn or some stuff like that. So you can activate and deactivate it for each module. Especially in field you dont know sometimes if it is the fault of the other ecu for something like a missing address claim or if its the own ecu with our library. With that library it would be easy to verify without doing a can trace. Especially things like the state of any state machine you cannot see inside the cantrace. Then it is so much more easy to identify a bug inside our code or who is causing the problem. Lets keep that idea in mind when #26 got merged.

@Notgnoshi
Copy link
Member Author

I would like to have a custom tracing for each module/folder like in #26 where it prints for example: network_management: lipsem ido dasdoaisdn or some stuff like that. So you can activate and deactivate it for each module.

I agree - I made #31 for this.

I suspect this lint was added to clippy since we last merged to main,
and that the CI/CD pipeline uses the latest clippy release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants