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

feat: tracing for structured, context-aware logs #499

Merged
merged 18 commits into from Nov 12, 2022
Merged

feat: tracing for structured, context-aware logs #499

merged 18 commits into from Nov 12, 2022

Conversation

swanandx
Copy link
Member

In asynchronous code, we can't rely on order of printed logs to determine the logical flow of execution. Static context like file, module or function in which the event was recorded in, isn't much useful for understanding runtime behavior of a program.

To solve this, we can use tracing crate, which can trace the logical contexts and how the flow of execution is moves between them. We also have fields with key-value pair to add more structure to logs. (ref)

We use tracing-subscriber to pretty print those logs. It is also used to dynamically filter the logs based on their level, spans, fields, etc.

@de-sh de-sh changed the title tracing for structured, context-aware logs which can be dynamically filtered feat: tracing for structured, context-aware logs Nov 11, 2022
@tekjar tekjar merged commit be6c3c7 into main Nov 12, 2022
@tekjar tekjar deleted the tracing branch November 12, 2022 10:24
de-sh added a commit that referenced this pull request Nov 14, 2022
carlocorradini pushed a commit to carlocorradini/rumqtt that referenced this pull request Aug 3, 2023
* feat: use tracing crate instead of log

* tracing subscriber in progress

* added client_idx as span field and use FILTER env var

* manually create spans

* initial POC for reloading filter

* feat: dynamically reloading filter for logs

* feat: filter the log with rumqttd as target by default

* feat: consume span and removed unnecessary fields

* return text instead of json if logs filter reloaded

* feat: removed count in run span and created span for server

* feat: tracing

* feat: pretty logs

* feat: use instrument combinator for attaching span to futures

* feat: stop logging run

* fix: merge issues

* fix: clippy warning

* feat: removed unnecessary client_id from log

Co-authored-by: Devdutt Shenoi <devdutt@bytebeam.io>
carlocorradini pushed a commit to carlocorradini/rumqtt that referenced this pull request Aug 3, 2023
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.

None yet

3 participants