dipdup-io / dipdup

Modular framework for creating selective indexers and featureful backends for dapps
https://dipdup.io
MIT License
97 stars 52 forks source link

Refactoring Prometheus Metrics (Follow up for #1131) #1135

Closed bigherc18 closed 3 weeks ago

bigherc18 commented 4 weeks ago

This PR introduces a set of classes extending Prometheus metrics with additional functionality

The goal is to make the use of Prometheus metrics easier in DipDup, directly integrating them with the existing _MetricManager class in the dipdup.performance module

The first goal was to be able to transform _MetricManager's attributes into Prometheus metrics with as little changes as possible, that's why we make it possible to perform arithmetic operations between metrics and/or numeric values and retrieve their values easily with the value property for reporting

You can now transform an attributes in _MetricManager into a Prometheus metric or add a new metric by using one of the classes, you can then interact with the metric as if it was a regular numeric value