smiklosovic commented on code in PR #3147:
URL: https://github.com/apache/cassandra/pull/3147#discussion_r1511734983
##########
src/java/org/apache/cassandra/dht/BootStrapper.java:
##########
@@ -72,6 +90,33 @@ public BootStrapper(InetAddressAndPort address,
this.strictMovements = strictMovements;
}
+ public void init()
+ {
+ addProgressListener((tag, event) -> {
Review Comment:
what do you think about changing init() to accept listeners... (might be on
varargs)
in StorageService we do
bootstrapper.init();
bootstrapper.addProgressListener(progressSupport);
could not we do all of this in init() ?
##########
src/java/org/apache/cassandra/dht/BootStrapper.java:
##########
@@ -59,6 +69,14 @@ public class BootStrapper extends
ProgressEventNotifierSupport
private final MovementMap movements;
private final MovementMap strictMovements;
+ static
Review Comment:
is this ... ok? why cant we put this to e.g. init()
##########
test/distributed/org/apache/cassandra/distributed/test/ring/BootstrapTest.java:
##########
@@ -154,9 +163,58 @@ public void bootstrapJMXStatus() throws Throwable
assertEquals("COMPLETED",
StorageService.instance.getBootstrapState());
assertFalse(StorageService.instance.isBootstrapFailed());
});
+
+ assertEquals(Long.valueOf(0L),
getMetricGaugeValue(joiningInstance, "BootstrapFilesTotal", Long.class));
+ assertEquals(Long.valueOf(0L),
getMetricGaugeValue(joiningInstance, "BootstrapFilesReceived", Long.class));
+ assertEquals("Bootstrap streaming success",
getMetricGaugeValue(joiningInstance, "BootstrapLastSeenStatus", String.class));
+ assertEquals("", getMetricGaugeValue(joiningInstance,
"BootstrapLastSeenError", String.class));
}
}
+ public static <T> T getMetricGaugeValue(IInvokableInstance instance,
String metricName, Class<T> gaugeReturnType)
+ {
+ return gaugeReturnType.cast(getMetricAttribute(instance, metricName,
"Value"));
+ }
+
+ public static long getMetricMeterRate(IInvokableInstance instance, String
metricName)
+ {
+ Object raw = getMetricAttribute(instance, metricName, "Count");
+ return raw == null ? 0 : (Long) raw;
+ }
+
+ public static Object getMetricAttribute(IInvokableInstance instance,
String metricName, String attributeName)
+ {
+ if (instance.isShutdown())
+ throw new IllegalStateException("Instance is shutdown");
+
+ try (JMXConnector jmxc = JMXUtil.getJmxConnector(instance.config()))
+ {
+ MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
+ ObjectName metric = mbsc.queryNames(null, null)
+ .stream()
Review Comment:
would you mind to align all of this under .queryNames, please?
--
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]