summaryrefslogtreecommitdiffstats
path: root/jrt
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@oath.com>2019-01-16 16:38:20 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2019-01-22 12:26:50 +0100
commitc9633d4e3d387179472dda33bbbe522eeac8a91c (patch)
treeac33f6288bc2fcf6f4702de0c3be825f99fc2de4 /jrt
parentc5dea8617b63687f8c28b38526bdb88ee3d5c256 (diff)
Add method to create snapshot of transport metrics
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 +
+ '}';
+ }
+ }
}