Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: dougEfish on May 08, 2021, 04:28:13 PM



Title: Metrics in Bitcoin Core with Opentelemetry
Post by: dougEfish on May 08, 2021, 04:28:13 PM
jlopp has a great fork for node metrics  https://github.com/jlopp/statoshi (https://github.com/jlopp/statoshi) and I'll like to extend it.
Currently statoshi only exports metrics to statsd but I want to the ability to write (easily) to another collector.
Opentelemetry ( https://github.com/open-telemetry/opentelemetry-cpp  (https://github.com/open-telemetry/opentelemetry-cpp)) is one lib I found that provides an abstract interface and already has multiple collectors (e.g. https://github.com/open-o11y/docs/tree/master/cpp-prometheus (https://github.com/open-o11y/docs/tree/master/cpp-prometheus))
Thoughts on this approach? Is there another lib or methodology that makes more sense?

 


Title: Re: Metrics in Bitcoin Core with Opentelemetry
Post by: NotATether on May 08, 2021, 04:39:39 PM
Why wire Core to pass stats through a separate collector lib when you can just hardcode the information-gathering inside Core itself and have it export the data directly to a monitor like statsd or prometheus?

Any collecting will have to be done by making Core dump the stats to files since connecting Bitcoind with sockets to other auxiliary programs is not something I think the core devs are enthusiastic about doing.


Title: Re: Metrics in Bitcoin Core with Opentelemetry
Post by: odolvlobo on May 08, 2021, 07:08:12 PM
jlopp has a great fork for node metrics  https://github.com/jlopp/statoshi (https://github.com/jlopp/statoshi) and I'll like to extend it.
Currently statoshi only exports metrics to statsd but I want to the ability to write (easily) to another collector.
Opentelemetry ( https://github.com/open-telemetry/opentelemetry-cpp  (https://github.com/open-telemetry/opentelemetry-cpp)) is one lib I found that provides an abstract interface and already has multiple collectors (e.g. https://github.com/open-o11y/docs/tree/master/cpp-prometheus (https://github.com/open-o11y/docs/tree/master/cpp-prometheus))

The actual OpenTelemetry site is this: https://opentelemetry.io/ (https://opentelemetry.io/). The github project that you link to is a C++ client that is still in development.

Why wire Core to pass stats through a separate collector lib when you can just hardcode the information-gathering inside Core itself and have it export the data directly to a monitor like statsd or prometheus?

Any collecting will have to be done by making Core dump the stats to files since connecting Bitcoind with sockets to other auxiliary programs is not something I think the core devs are enthusiastic about doing.

If you are going to hard-code the information-gathering, you are going to end up creating a collection module anyway, so you might be better off using a mature well-tested library rather than rolling your own.

Bitcoin Core has performance bottlenecks. Creating a special telemetry build that would not be intended for general use is a good idea. Core devs should be enthusiastic about something like that.


Title: Re: Metrics in Bitcoin Core with Opentelemetry
Post by: dougEfish on May 08, 2021, 07:16:46 PM
My intent is not to integrate this into Core, but to fork Core so that:

1. I learn about the bitcoin software architecture through metrics
2. integrate an abstract lib that can be configured to export to statsd or prometheus (or even both and others)

 https://github.com/jlopp/statoshi hard codes statsd, I personally want prometheus.

Opentelemetry-cpp seems to be flexible in collecting metrics.   I'm wondering if opentelemetry-cpp is stable and worth it...or maybe there's another way.




Title: Re: Metrics in Bitcoin Core with Opentelemetry
Post by: NotATether on May 08, 2021, 09:59:47 PM
If you are going to hard-code the information-gathering, you are going to end up creating a collection module anyway, so you might be better off using a mature well-tested library rather than rolling your own.

My idea of performance logging is that all of those statoshi metrics don't need to be tracked, all listed as a graph in https://statoshi.info/, just the most important ones such as mempool size. This can be logged with a large interval and then written to disk while bitcoind is poll()ing for a message to come.

Opentelemetry-cpp seems to be flexible in collecting metrics.   I'm wondering if opentelemetry-cpp is stable and worth it...or maybe there's another way.

Whatever you do end up using, it had better lend itself easily to being included in automake/configure builds.