alchemyplatform / rundler

An ERC-4337 Bundler in Rust
GNU Lesser General Public License v3.0
269 stars 41 forks source link

rpc: Add tracing to methods where appropriate #106

Open dancoombs opened 1 year ago

dancoombs commented 1 year ago

Add configuration to export the traces to an OpenTelemetry collector.

dancoombs commented 1 year ago

There are 2 main issues with this:

  1. Ethers-rs (which we use for node calls) doesn't support reqwest-middleware https://github.com/gakonst/ethers-rs/issues/2401. In the PR above I had to copy their HTTP provider code and modify it to support the middleware needed for tracing. I don't want to maintain this code and can wait for them to fix it

  2. Tower (which we use in jsonrpsee) doesn't have an OTEL layer by default. It does support tracing middleware, however you need to write a pretty significant amount of code to make it work with distributed tracing. Here is a package someone wrote for Axum: https://github.com/davidB/axum-tracing-opentelemetry/blob/main/src/middleware/trace_extractor.rs#L336

If we really need distributed tracing we can spend the time to write the above.

dancoombs commented 1 year ago

Draft PR for adding tracing: https://github.com/OMGWINNING/rundler/pull/211

dancoombs commented 1 year ago

Useful docs:

https://docs.rs/tower-http/latest/tower_http/trace/struct.TraceLayer.html https://docs.rs/reqwest-tracing/latest/reqwest_tracing/

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.