question

pmeena avatar image
pmeena asked pmeena commented

How do I monitor client connections in Spring Data Cassandra?

We need to monitor cassandra connections for our applications. When we turned on logging, I am just seeing query logs but nothing about connections, like how many connections are open/idle/keepalive etc.. Is there a way? I remembered I have seen this in 2012, using HectorClient, not able to recollect:)

spring-data-cassandra
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

smadhavan avatar image
smadhavan answered pmeena commented

Hi @pmeena, I am not very sure if that is supported out of the box with Spring Data Cassandra v3.2.0, but it is directly available via the DataStax Java Driver.

16 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

pmeena avatar image pmeena commented ·

Thanks Madhavan, yes you are right after I post I found this https://docs.datastax.com/en/developer/java-driver/4.9/manual/core/metrics/

But not able to understand the implementation using AbstractCassandraConfiguration. If you can share any class implementation, that would really help. Thanks for your prompt reply.

0 Likes 0 ·
smadhavan avatar image smadhavan ♦ pmeena commented ·

Hi @pmeena, with DataStax Java Driver (click the hyperlink for downloading the latest version 4.11.1 from Maven Central) leverages Dropwizard as the driver’s default metrics library; there is no additional configuration nor any extra dependency to add if you wish to use Dropwizard.

If you need to enabled specific driver metrics, you could always configure that in the application.conf file (or by other configuration mechanisms listed here in the documentation) and apply the metrics as per the reference configuration documentation here.

0 Likes 0 ·
pmeena avatar image pmeena smadhavan ♦ commented ·

I am trying https://docs.datastax.com/en/developer/java-driver/4.6/manual/core/metrics/ as I am using 4.6 driver, I could enabled the metrics, I am not able to understand where to put

MetricRegistry registry = session.getMetrics()
    .orElseThrow(() -> new IllegalStateException("Metrics are disabled"))
    .getRegistry();

Anyexample would help, thanks
0 Likes 0 ·
Show more comments