ConnectionErrors is always 0

Description

I have a cassandra cluster where a single driver runs on the same machine as the cassandra node. Each cassandra driver uses the following:

a. WhiteList policy with just that cassandra node in its policy
b. A constant reconnect policy

I am trying to output the connectionerror metrics and I only see 0. I am expecting every failed connection attempt which seems to be happening in a background thread by the driver to increase this value. But that does not seem to be the case.

Can anybody confirm if this is expected or a bug?

Here is the snippet if anybody is interested

{{ logger.info("Connection Errors " + metric.getErrorMetrics().getConnectionErrors().getCount());}}

The output is always something like this

INFO [] [pool-1-thread-5] [] Connection Errors 0

Environment

None

Pull Requests

None

Activity

Show:
Anirudh R
April 28, 2015, 9:20 AM

@Oliver,
Thank you for the response. I did execute a query and still see the connection errors to be 0.

I execute the query asynchronously. Here is the snippet i use for execution of the query.

ResultSetFuture resultSetFuture = session.executeAsync(query);

Futures.addCallback(resultSetFuture, new FutureCallback<ResultSet>() ....

Olivier Michallat
April 28, 2015, 10:26 AM

You would need to get a ConnectionException during query execution. This only happens for certain types of internal errors, so it's not easy to reproduce.

Anirudh R
April 28, 2015, 10:32 AM

Thanks again Oliver.

Is there any way I can get the number of times a retry has been attempted to the Cassandra host?
If my reconnect time is 5 seconds, i would assume the value would be around 12 after a minute.

Olivier Michallat
October 29, 2015, 2:48 PM

You could wrap the ReconnectionPolicy to count the number of times the schedule gets invoked, but the policy can't tell which host it's being called for, so that would only give a total.

Frankly I'd rather not expose this as a metric, as we don't have per-host metrics currently.

Olivier Michallat
November 4, 2015, 11:37 AM

Closing as I don't feel there is a very strong case to expose reconnection attempts as metrics.

Won't Fix

Assignee

Unassigned

Reporter

Anirudh R

Labels

None

PM Priority

None

Reproduced in

None

Affects versions

Fix versions

None

Pull Request

None

Doc Impact

None

Size

None

External issue ID

None

External issue ID

None

Priority

Major
Configure