smiklosovic commented on code in PR #3085:
URL: https://github.com/apache/cassandra/pull/3085#discussion_r1478725504


##########
src/java/org/apache/cassandra/metrics/ClientMetrics.java:
##########
@@ -118,6 +193,31 @@ public long getCount()
         authSuccess = registerMeter("AuthSuccess");
         authFailure = registerMeter("AuthFailure");
 
+        // For each of SSL, non-SSL register a gauge:
+        encryptedConnectedNativeClients = registerGauge(new 
DefaultNameFactory("Client", "Encrypted"), CONNECTED_NATIVE_CLIENTS, () -> 
countConnectedClients((ServerConnection::isSSL)));
+        unencryptedConnectedNativeClients = registerGauge(new 
DefaultNameFactory("Client", "Unencrypted"), CONNECTED_NATIVE_CLIENTS, () -> 
countConnectedClients(((ServerConnection connection) -> !connection.isSSL())));
+
+        // for each supported authentication mode, register a meter for 
success and failures.
+        final IAuthenticator authenticator = 
DatabaseDescriptor.getAuthenticator();
+        for (String mode : authenticator.getSupportedAuthenticationModes())
+        {
+            String capitalizedMode = StringUtils.capitalize(mode);
+            MetricNameFactory factory = new DefaultNameFactory("Client", 
capitalizedMode);
+            authSuccessByMode.put(mode, registerMeter(factory, AUTH_SUCCESS));
+            authFailureByMode.put(mode, registerMeter(factory, AUTH_FAILURE));
+
+            Gauge<Integer> clients = registerGauge(factory, 
CONNECTED_NATIVE_CLIENTS, () -> countConnectedClients((ServerConnection 
connection) -> {
+                final ClientState state = connection.getClientState();

Review Comment:
   Why is `state` final and `user` is not? Why does it have to be final?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to