I'm trying to capture Cassandra client-side query latency metrics using Micrometer. Cassandra Java driver exposes some metrics through Dropwizard, but there's no way to bridge Dropwizard -> Micrometer for general meters like timers and histograms (there exists a Dropwizard MetricRegistryListener, but the methods in it are invoked after a meter has been added to the registry, thus eliminating any chance of interception - filed https://github.com/dropwizard/dropwizard/issues/2840).
The idea is to time all calls to CqlOperations. This is, however, easier said than done due to the following problems in the code.
1. For some unknown reason, AbstractCassandraConfiguration.cassandraTemplate returns a concrete class CassandraAdminTemplate, not the interface type CassandraAdminOperations. This makes it very difficult to proxy the returned object.
2. CassandraAdminTemplate does not implement a constructor that allows invocation of the superclass constructor CassandraTemplate(CqlOperations cqlOperations, CassandraConverter converter). Had this been possible, simply passing in a proxied CqlOperations would have allowed for a clean way of capturing the metrics.
I'm currently forced to resort to ugly reflections hacks.