@Test public void testDefaultLookoutClient_addRegsitry() throws Exception { LookoutConfig lookoutConfig = new LookoutConfig(); DefaultLookoutClient client = new DefaultLookoutClient("demo"); LookoutRegistry lookoutRegistry = new LookoutRegistry(lookoutConfig); client.addRegistry(lookoutRegistry); client.addRegistry(new DefaultRegistry(lookoutConfig)); Assert.assertEquals(2, ((CompositeRegistry) client.getRegistry()).getRegistries().size()); client.close(); }
@Override public synchronized void addRegistry(MetricRegistry registry) { if (registry == null) { return; } if (isAutoRegisterExtendedMetrics) { registry.registerExtendedMetrics(); } super.addRegistry(registry); if (registry instanceof LookoutRegistry) { MetricConfig config = ((LookoutRegistry) registry).getConfig(); if (!config.containsKey(APP_NAME)) { config.setProperty(APP_NAME, getAppName()); } if (!config.getBoolean(LOOKOUT_EXPORTER_ENABLE, false)) { return; } try { setMetricsHttpExporter(PollerUtils.exportHttp((LookoutRegistry) registry)); } catch (Exception e) { logger.error("fail to start MetricsHttpExporter", e); } } }
DefaultLookoutClient extends AbstractLookoutClient { @Override public synchronized void addRegistry(MetricRegistry registry) { if (registry == null) { return; } if (isAutoRegisterExtendedMetrics) { registry.registerExtendedMetrics(); } super.addRegistry(registry); if (registry instanceof LookoutRegistry) { MetricConfig config = ((LookoutRegistry) registry).getConfig(); if (!config.containsKey(APP_NAME)) { config.setProperty(APP_NAME, getAppName()); } if (!config.getBoolean(LOOKOUT_EXPORTER_ENABLE, false)) { return; } try { setMetricsHttpExporter(PollerUtils.exportHttp((LookoutRegistry) registry)); } catch (Exception e) { logger.error("fail to start MetricsHttpExporter", e); } } } }
DefaultLookoutClient extends AbstractLookoutClient { @Override public synchronized void addRegistry(MetricRegistry registry) { if (registry == null) { return; } if (isAutoRegisterExtendedMetrics) { registry.registerExtendedMetrics(); } super.addRegistry(registry); if (registry instanceof LookoutRegistry) { MetricConfig config = ((LookoutRegistry) registry).getConfig(); if (!config.containsKey(APP_NAME)) { config.setProperty(APP_NAME, getAppName()); } if (!config.getBoolean(LOOKOUT_EXPORTER_ENABLE, false)) { return; } try { setMetricsHttpExporter(PollerUtils.exportHttp((LookoutRegistry) registry)); } catch (Exception e) { logger.error("fail to start MetricsHttpExporter", e); } } } DefaultLookoutClient(String appName); }
DefaultLookoutClient extends AbstractLookoutClient { @Override public synchronized void addRegistry(MetricRegistry registry) { if (registry == null) { return; } if (isAutoRegisterExtendedMetrics) { registry.registerExtendedMetrics(); } super.addRegistry(registry); if (registry instanceof LookoutRegistry) { MetricConfig config = ((LookoutRegistry) registry).getConfig(); if (!config.containsKey(APP_NAME)) { config.setProperty(APP_NAME, getAppName()); } if (!config.getBoolean(LOOKOUT_EXPORTER_ENABLE, false)) { return; } try { setMetricsHttpExporter(PollerUtils.exportHttp((LookoutRegistry) registry)); } catch (Exception e) { logger.error("fail to start MetricsHttpExporter", e); } } } DefaultLookoutClient(String appName); @Override synchronized void addRegistry(MetricRegistry registry); @Override synchronized void registerExtendedMetrics(); }
DefaultLookoutClient extends AbstractLookoutClient { @Override public synchronized void addRegistry(MetricRegistry registry) { if (registry == null) { return; } if (isAutoRegisterExtendedMetrics) { registry.registerExtendedMetrics(); } super.addRegistry(registry); if (registry instanceof LookoutRegistry) { MetricConfig config = ((LookoutRegistry) registry).getConfig(); if (!config.containsKey(APP_NAME)) { config.setProperty(APP_NAME, getAppName()); } if (!config.getBoolean(LOOKOUT_EXPORTER_ENABLE, false)) { return; } try { setMetricsHttpExporter(PollerUtils.exportHttp((LookoutRegistry) registry)); } catch (Exception e) { logger.error("fail to start MetricsHttpExporter", e); } } } DefaultLookoutClient(String appName); @Override synchronized void addRegistry(MetricRegistry registry); @Override synchronized void registerExtendedMetrics();  }