cassandra-exporter icon indicating copy to clipboard operation
cassandra-exporter copied to clipboard

Feature: support for plugglabe metrics suppliers

Open chicobento opened this issue 4 years ago • 3 comments
trafficstars

We have a set of cassandra plugins developed within the company. The plugins are exposing their own set of metrics via JMX. We would like to expose those metrics to prometheus via cassandra-exporter along the standard set of supported metrics. Please, provide a way of plugging in new metrics.

By looking at the code, I found that it could be potentially achieved by dynamically loading FactoriesSupplier classes. Simple solution is to load multiple FactoriesSuppliers via java.util.ServiceLoader facility.

Please let me know your thoughts and I may contribute with a PR if such feature is acceptable.

chicobento avatar Mar 26 '21 17:03 chicobento

I created an initial PR. Some other refactoring may be done such as providing the existing metrics in FactoriesSupplier via the FactoryProvider interface.

With this feature, the #74 issue is still more relevant, so that cassandra-exporter plugins can get the common.jar dependency for compilation via maven or gradle.

chicobento avatar Apr 12 '21 15:04 chicobento

Thanks for the PR @chicobento. I really like the idea of having dynamic providers. In fact, this could even be a good path forward to enabling compatibility with C* 4.0 (since it'll need a different set of collectors).

zegelin avatar Apr 12 '21 23:04 zegelin

Hi @zegelin , yes, I was thinking on splitting the core module from the 'default' collector provider lets say, but that would make the deployment a bit more tricky for now - however this could be something to consider with the C* 4.0 in the landscape.

Just so you know, I did some integration tests internally and it is working fine: my cassandra plugin metrics can be seen on the scrap interface. Pls let me know your feedback on the PR and the minimal changes to get it merged - I might have some time to work on adjustments over the next days if needed.

ps: the company has intention on opening the code for the plugin, so both its core code and the cassandra-exporter integration should be available in github in near future

chicobento avatar Apr 13 '21 15:04 chicobento