Skip to content

Add tracing support #114

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

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

Add tracing support #114

wants to merge 22 commits into from

Conversation

lonless9
Copy link

@lonless9 lonless9 commented Jun 5, 2025

Problem

Since optd is built on top of the asynchronous runtime tokio, traditional debugging (with print statements or gdb for example) is quite difficult. What most async Rust projects use instead is logging and tracing, specifically the tracing library.

Summary of changes

Added tracing support for the majority of functions that need to be traced. Placed a basic subscriber in optd_cli.

@lonless9
Copy link
Author

lonless9 commented Jun 5, 2025

Tracing is a quite flexible crate, and you can almost effortlessly place the spans you want anywhere. What needs careful consideration next is how to customize the subscribers built specifically for particular tasks, and change the related trace level/span/target. And these subscribers should be placed outside of optd finally.

We now need a standardized optd document template to explain how to use tracing as well as how to customize subscribers.

By the way. Once the doc is clear, we can convert all existing debug statements that use printf or eprintf to tracing under corresponding filtering rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant