feat/refactor: Replace Logger module with tracing_subscriber + tracing libs #135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One of the plans for patch-hub is to support generating metrics—both usage metrics and product-specific metrics—so that it's possible to analyze user interaction with the application and identify potential performance bottlenecks. To collect these metrics (or any kind of telemetry, really), we should use the OTLP protocol integration with Rust. One way to achieve this is through the opentelemetry-rust crate along with tracing_subscriber.
With that in mind, if we were to follow the same pattern we use for collecting application logs, we would need to create a new module for telemetry, and we’d have to manage both the instrumentation and the instantiation of the metrics in-house. Instead, I believe the better approach is to start using the well-known crates tracing and tracing_subscriber for both logs and metrics. This PR is a proof of concept for that possibility—still without introducing anything directly related to telemetry, only replacing our current logging setup.
The PR is split into a few commits, and it's worth noting that two of them should be dropped before merging. I created 0ee020a23d64d50b3963a9cace39c118dab517a6 just to make it easier to validate the logging behavior.
As always, I'm totally open for new ideas and suggestions. Let me know what you think.