bdk icon indicating copy to clipboard operation
bdk copied to clipboard

Consider adding support for tracing

Open torkelrogstad opened this issue 10 months ago • 4 comments

Describe the enhancement
It'd be great if support for tracing/logs in general could be added to BDK. It's currently very hard to understand what's happening under the hood when debugging performance issues or error messages.

It'd be fantastic if BDK could integrate the tracing framework.

Use case
In the last few days I've had two distinct issues pop up where I'd love to have better insight into what's going on:

  1. Esplora sync fails. A request sent to my Esplora backend failed with a decode error, and all I'm getting is this: Reqwest(reqwest::Error { kind: Decode, source: Error(\"failed to parse hex\", line: 1, column: 9007) })"}. Without any further logs that indicate more as to what's going wrong, it's very hard to debug this
  2. Performance issues with large wallets. I have a large signet wallet, currently sitting at around 30 000 UTXOs. Constructing transactions here is now taking an unacceptable amount of time. I'm working on enhancements on my end wrt. how data is persisted, but again I have very little to go on. It's impossible to see which operations are taking how much time, for example.

torkelrogstad avatar Feb 14 '25 08:02 torkelrogstad

Hi @torkelrogstad , just checking in on this one since it’s been quiet for a while. Do you still need tracing support for your use case? Or was it mainly tied to a specific performance issue you were running into?

Happy to scope this out if it’s still useful — or if there’s another way we can help address the underlying need, let us know!

LagginTimes avatar Jun 24 '25 19:06 LagginTimes

I figured out my specific issues. But I still think adding tracing is a good idea! My main point is really this from the OP:

It's currently very hard to understand what's happening under the hood

Making BDK less of a black box for consumers would be a win, IMO.

torkelrogstad avatar Jul 07 '25 07:07 torkelrogstad

I think prior to BDK 1.0 the crate depended on log, which was however dropped. There were also prior discussion at https://github.com/bitcoindevkit/bdk/issues/1222 that concluded logging wasn't needed.

Personally I think logging and/or tracing support could make sense in some parts (e.g. the chain syncing crates), but if it was to be re-added it would be crucial to add the log and tracing dependencies as optional, so that users that don't need/want them can keep them out of their dependency tree.

tnull avatar Jul 07 '25 11:07 tnull

Yeah, I’m personally in favor of adding tracing (behind a feature flag) — not for full coverage, but just to give users more visibility into what’s going on under the hood. Parts like chain crate syncing may feel like a black box, and a bit of targeted instrumentation could go a long way.

LagginTimes avatar Jul 08 '25 18:07 LagginTimes