@Test public void testRegisteringIMetricsConsumer() { Config config = new Config(); BulletStormConfig bulletStormConfig = new BulletStormConfig(); Assert.assertNull(bulletStormConfig.get(CustomIMetricsConsumer.CUSTOM_METRICS_REGISTERED)); ReflectionUtils.registerMetricsConsumer(LoggingMetricsConsumer.class.getName(), config, bulletStormConfig); Assert.assertNull(config.get(Config.TOPOLOGY_METRICS_CONSUMER_REGISTER)); ReflectionUtils.registerMetricsConsumer(CustomIMetricsConsumer.class.getName(), config, bulletStormConfig); Assert.assertNotNull(config.get(Config.TOPOLOGY_METRICS_CONSUMER_REGISTER)); Assert.assertTrue((Boolean) bulletStormConfig.get(CustomIMetricsConsumer.CUSTOM_METRICS_REGISTERED)); } }
if (enableMetrics) { List<String> classNames = config.getAs(BulletStormConfig.TOPOLOGY_METRICS_CLASSES, List.class); classNames.forEach(className -> ReflectionUtils.registerMetricsConsumer(className, stormConfig, config));
if (enableMetrics) { List<String> classNames = config.getAs(BulletStormConfig.TOPOLOGY_METRICS_CLASSES, List.class); classNames.forEach(className -> ReflectionUtils.registerMetricsConsumer(className, stormConfig, config));