-
Notifications
You must be signed in to change notification settings - Fork 40
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 Support for Tracing #453
Conversation
5ac611f
to
3f18b6b
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #453 +/- ##
==========================================
- Coverage 88.61% 87.91% -0.71%
==========================================
Files 39 38 -1
Lines 9109 8192 -917
==========================================
- Hits 8072 7202 -870
+ Misses 1037 990 -47 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm thanks for the great addition!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
8bd1527
to
b40f08c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
**Context** The [`tracing`](https://docs.rs/tracing/latest/tracing/index.html) crate enables more robust instrumentation of Rust programs compared to basic logging. With this patch, we introduce the `tracing` crate into AKD and only enable it when the `tracing` feature is specified. By default, the feature is disabled and we continue to leverage basic logging. To enable instrumentation, we leverage another feature `tracing_instrument` to control whether or not AKD generates spans for instrumented functions. In addition to adding `tracing` based logging and instrumentation throughout the `akd` lib (i.e. not `akd_core`), various grammatical and organizational improvements were made in areas where tracing was being added. Notably, the `log_metrics` functions which exist throughout the storage layer were updated to simply log with `info` level instead of taking an argument to specify the level. Rationale being that the `log_metrics` functions are only called when the `runtime_metrics` feature is enabled and `info` is a fair median to assume. **Testing** Since no major functional changes were made, the changes were tested via existing automated tests with various different feature flags being passed to toggle `tracing` on and off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple of tiny changes, but overall lgtm
pub(crate) async fn retrieve_azks(&self) -> Result<Azks, crate::errors::AkdError> { | ||
Directory::<TC, S, V>::get_azks_from_storage(&self.storage, false).await | ||
} | ||
|
||
#[cfg_attr(feature = "tracing_instrument", tracing::instrument(skip_all, fields(ignore_cache = ignore_cache)))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: fields(ignore_cache)
/// Shim module to group logging-related macros more easily | ||
/// when switching between [log](https://docs.rs/log/latest/log/) | ||
/// and [tracing](https://docs.rs/tracing/latest/tracing/). | ||
pub mod log { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: pub(crate)
whoops totally missed that this was already merged, sorry! |
Context
The
tracing
crate enables more robust instrumentation of Rust programs compared to basic logging. With this patch, we introduce thetracing
crate into AKD and only enable it when thetracing
feature is specified. By default, the feature is disabled and we continue to leverage basic logging.In addition to adding
tracing
based logging and instrumentation throughout theakd
lib (i.e. notakd_core
), various grammatical and organizational improvements were made in areas where tracing was being added. Notably, thelog_metrics
functions which exist throughout the storage layer were updated to simply log withinfo
level instead of taking an argument to specify the level. Rationale being that thelog_metrics
functions are only called when theruntime_metrics
feature is enabled andinfo
is a fair median to assume.Testing
Since no major functional changes were made, the changes were tested via existing automated tests with various different feature flags being passed to toggle
tracing
on and off.