summaryrefslogtreecommitdiffstats
path: root/jrt
diff options
context:
space:
mode:
Diffstat (limited to 'jrt')
-rw-r--r--jrt/src/com/yahoo/jrt/TransportMetrics.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/jrt/src/com/yahoo/jrt/TransportMetrics.java b/jrt/src/com/yahoo/jrt/TransportMetrics.java
index e0afbc495e7..dba68b88f34 100644
--- a/jrt/src/com/yahoo/jrt/TransportMetrics.java
+++ b/jrt/src/com/yahoo/jrt/TransportMetrics.java
@@ -41,6 +41,8 @@ public class TransportMetrics {
return clientUnencryptedConnectionsEstablished.get();
}
+ public Snapshot snapshot() { return new Snapshot(this); }
+
void incrementTlsCertificateVerificationFailures() {
tlsCertificateVerificationFailures.incrementAndGet();
}
@@ -76,4 +78,37 @@ public class TransportMetrics {
", clientUnencryptedConnectionsEstablished=" + clientUnencryptedConnectionsEstablished +
'}';
}
+
+ public static class Snapshot {
+ private final long tlsCertificateVerificationFailures, peerAuthorizationFailures, serverTlsConnectionsEstablished,
+ clientTlsConnectionsEstablished, serverUnencryptedConnectionsEstablished, clientUnencryptedConnectionsEstablished;
+
+ private Snapshot(TransportMetrics metrics) {
+ tlsCertificateVerificationFailures = metrics.tlsCertificateVerificationFailures.get();
+ peerAuthorizationFailures = metrics.peerAuthorizationFailures.get();
+ serverTlsConnectionsEstablished = metrics.serverTlsConnectionsEstablished.get();
+ clientTlsConnectionsEstablished = metrics.clientTlsConnectionsEstablished.get();
+ serverUnencryptedConnectionsEstablished = metrics.serverUnencryptedConnectionsEstablished.get();
+ clientUnencryptedConnectionsEstablished = metrics.clientUnencryptedConnectionsEstablished.get();
+ }
+
+ public long tlsCertificateVerificationFailures() { return tlsCertificateVerificationFailures; }
+ public long peerAuthorizationFailures() { return peerAuthorizationFailures; }
+ public long serverTlsConnectionsEstablished() { return serverTlsConnectionsEstablished; }
+ public long clientTlsConnectionsEstablished() { return clientTlsConnectionsEstablished; }
+ public long serverUnencryptedConnectionsEstablished() { return serverUnencryptedConnectionsEstablished; }
+ public long clientUnencryptedConnectionsEstablished() { return clientUnencryptedConnectionsEstablished; }
+
+ @Override
+ public String toString() {
+ return "Snapshot{" +
+ "tlsCertificateVerificationFailures=" + tlsCertificateVerificationFailures +
+ ", peerAuthorizationFailures=" + peerAuthorizationFailures +
+ ", serverTlsConnectionsEstablished=" + serverTlsConnectionsEstablished +
+ ", clientTlsConnectionsEstablished=" + clientTlsConnectionsEstablished +
+ ", serverUnencryptedConnectionsEstablished=" + serverUnencryptedConnectionsEstablished +
+ ", clientUnencryptedConnectionsEstablished=" + clientUnencryptedConnectionsEstablished +
+ '}';
+ }
+ }
}