Switch to tracing for logging #6

Closed
opened 2022-11-10 16:42:53 +05:30 by realaravinth · 3 comments
Owner

tracing is a structured logging library that works well with async Rust. Since LibrePages system uses multiple, small components, having structured, traceable logging will ease debugging.

I'm new to tracing, and observability in general. So implementing this will require research.

`tracing` is a structured logging library that works well with async Rust. Since LibrePages system uses multiple, small components, having structured, traceable logging will ease debugging. I'm new to tracing, and observability in general. So implementing this will require research.
realaravinth started working 2022-11-11 11:14:06 +05:30
Author
Owner
## References 1. [Rust-specific logging guide](https://www.lpalmieri.com/posts/2020-09-27-zero-to-production-4-are-we-observable-yet/) 2. [Tracing documentation index page](https://docs.rs/tracing/latest/tracing/) 3. [`tracing-actix-web` README](https://crates.io/crates/tracing-actix-web) 4. [`honeycomb.io`'s observability guide](https://docs.honeycomb.io/getting-started/learning-about-observability)
realaravinth stopped working 2022-11-11 13:37:08 +05:30
2 hours 23 minutes
realaravinth started working 2022-11-11 14:33:32 +05:30
Author
Owner

Tracing separates processing logs from instrumentation1.

For now, we are only going to "instrument" Librepages and come back to processing backends later. Jager is a FOSS distributed tracing backend that implements OpenTelemetry Protocol. Looks nice, but requires research.

Processing backends are relevant only for large deployments, so they should be gated behind feature flags/configuration options. They should be disabled by default, favoring small deployments.



  1. Instrumentation is the process of adding code to your application so you can understand its inner state. Instrumented applications measure what code is doing when it responds to active requests by collecting data such as metrics, events, logs, and traces (MELT). In contrast to an application that isn’t instrumented and only uses point-in-time logs, an instrumented application tracks as much information as possible about the service’s operations and behavior. It provides more detail about what is happening, so you can see relationships between requests. Source ↩︎

Tracing separates processing logs from instrumentation[^0]. For now, we are only going to "instrument" Librepages and come back to processing backends later. [Jager](https://www.jaegertracing.io/) is a FOSS distributed tracing backend that implements OpenTelemetry Protocol. Looks nice, but requires research. Processing backends are relevant only for large deployments, so they should be gated behind feature flags/configuration options. They should be disabled by default, favoring small deployments. --- [^0]: Instrumentation is the process of adding code to your application so you can understand its inner state. Instrumented applications measure what code is doing when it responds to active requests by collecting data such as metrics, events, logs, and traces (MELT). In contrast to an application that isn’t instrumented and only uses point-in-time logs, an instrumented application tracks as much information as possible about the service’s operations and behavior. It provides more detail about what is happening, so you can see relationships between requests. [Source](https://newrelic.com/blog/best-practices/logging-vs-instrumentation)
Author
Owner

Changes live in wip-tracing branch.

Diff: 58bb606879..3a961bc524

Summary:

  • Port log crate usage across the codebase to using tracing crate
  • Add instrumentation code to all route handlers to log relevant info

Merged into wip-dashboard.

Changes live in [`wip-tracing`](https://git.batsense.net/LibrePages/librepages/src/branch/wip-tracing) branch. Diff: https://git.batsense.net/LibrePages/librepages/compare/58bb60687943336546656d8665a1b6954eb6fa18..3a961bc52417edcf907a64c80b3be82a5b565184 ## Summary: - Port `log` crate usage across the codebase to using `tracing` crate - Add instrumentation code to all route handlers to log relevant info --- Merged into `wip-dashboard`.
realaravinth stopped working 2022-11-11 15:45:32 +05:30
1 hour 12 minutes
realaravinth self-assigned this 2022-11-12 16:01:22 +05:30
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Total Time Spent: 3 hours 35 minutes
realaravinth
3 hours 35 minutes
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: LibrePages/librepages#6
No description provided.