matrix-org / matrix-org/matrix-rust-sdk
Allow structured logging over the FFI and Rageshakes 2.0
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
Since #1447 we create a root span for our `Client` object, and since https://github.com/matrix-org/matrix-rust-sdk/pull/1428 EX can push traces to an OpenTelemetry collector, aka Jaeger in this case.
# Structured logging for EX
Sadly anything that EX itself logs, since it's not using any OpenTelemetry compatible logging library, will be missing from the Jaeger view.
It would be neat if we could have EX create, not only the root span from #1447, but also have the same capability of creating spans for basically anything the client does.
For this to work we would need to expose over the FFI some of the methods from the `tracing` crate.
# Rageshakes 2.0
One thing that would really nice to have is to have the rageshake functionality upload to Jaeger directly, on a on demand basis, just like our current rageshakes require user interaction.
I think it would make sense to build a tracing-subscriber `Layer` or `Filter` that sits between our traces and the OpenTelemetry exporter. The layer would cache the traces and only forward traces to the exporter when users explicitly demand them to be forwarded.
Something like this:
```rust
let rageshake_layer = RageShakeLayer::new()
.path("/home/foo/")
.max_file_size(100)
.with_exporter(otlp_layer);
tracing_subscriber::registry()
.with(EnvFilter::new(configuration))
.with(fmt::layer().with_ansi(false).with_writer(io::stderr))
.with(rageshake_layer)
.init();
```
Contributor guide
Research direction
Start with the root-span work from #1447 and the OpenTelemetry integration mentioned in PR #1428, then inspect the FFI boundary and tracing-subscriber setup. Define the scope for exposing tracing methods and for a RageShakeLayer that caches traces and forwards them to the exporter only on user demand; completion should cover both requested capabilities.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100