@Test public void testNoElasticsearchUrl() throws Exception { CorePlugin corePlugin = ConfigurationRegistry.builder() .addOptionProvider(new CorePlugin()) .addConfigSource(new SimpleSource("test")) .build() .getConfig(CorePlugin.class); assertNull(corePlugin.getElasticsearchUrl()); }
public URL getElasticsearchUrl() { final List<URL> urls = elasticsearchUrls.getValue(); if (urls.isEmpty()) { return null; } final int index = accessesToElasticsearchUrl.getAndIncrement() % urls.size(); URL elasticsearchURL = urls.get(index); final String defaultUsernameValue = elasticsearchDefaultUsername.getValue(); final String defaultPasswordValue = elasticsearchDefaultPassword.getValue(); if (elasticsearchURL.getUserInfo() == null && ! defaultUsernameValue.isEmpty() && ! defaultPasswordValue.isEmpty()) { try { String username = URLEncoder.encode(defaultUsernameValue, "UTF-8"); String password = URLEncoder.encode(defaultPasswordValue, "UTF-8"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder .append(elasticsearchURL.getProtocol()) .append(": .append(username) .append(":") .append(password) .append("@") .append(elasticsearchURL.getHost()) .append(":") .append(elasticsearchURL.getPort()) .append(elasticsearchURL.getPath()); return new URL(stringBuilder.toString()); } catch (Exception e) { logger.error(e.getMessage(), e); } } return elasticsearchURL; }
CorePlugin extends StagemonitorPlugin { public URL getElasticsearchUrl() { final List<URL> urls = elasticsearchUrls.getValue(); if (urls.isEmpty()) { return null; } final int index = accessesToElasticsearchUrl.getAndIncrement() % urls.size(); URL elasticsearchURL = urls.get(index); final String defaultUsernameValue = elasticsearchDefaultUsername.getValue(); final String defaultPasswordValue = elasticsearchDefaultPassword.getValue(); if (elasticsearchURL.getUserInfo() == null && ! defaultUsernameValue.isEmpty() && ! defaultPasswordValue.isEmpty()) { try { String username = URLEncoder.encode(defaultUsernameValue, "UTF-8"); String password = URLEncoder.encode(defaultPasswordValue, "UTF-8"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder .append(elasticsearchURL.getProtocol()) .append(": .append(username) .append(":") .append(password) .append("@") .append(elasticsearchURL.getHost()) .append(":") .append(elasticsearchURL.getPort()) .append(elasticsearchURL.getPath()); return new URL(stringBuilder.toString()); } catch (Exception e) { logger.error(e.getMessage(), e); } } return elasticsearchURL; } }
CorePlugin extends StagemonitorPlugin { public URL getElasticsearchUrl() { final List<URL> urls = elasticsearchUrls.getValue(); if (urls.isEmpty()) { return null; } final int index = accessesToElasticsearchUrl.getAndIncrement() % urls.size(); URL elasticsearchURL = urls.get(index); final String defaultUsernameValue = elasticsearchDefaultUsername.getValue(); final String defaultPasswordValue = elasticsearchDefaultPassword.getValue(); if (elasticsearchURL.getUserInfo() == null && ! defaultUsernameValue.isEmpty() && ! defaultPasswordValue.isEmpty()) { try { String username = URLEncoder.encode(defaultUsernameValue, "UTF-8"); String password = URLEncoder.encode(defaultPasswordValue, "UTF-8"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder .append(elasticsearchURL.getProtocol()) .append(": .append(username) .append(":") .append(password) .append("@") .append(elasticsearchURL.getHost()) .append(":") .append(elasticsearchURL.getPort()) .append(elasticsearchURL.getPath()); return new URL(stringBuilder.toString()); } catch (Exception e) { logger.error(e.getMessage(), e); } } return elasticsearchURL; } CorePlugin();  CorePlugin(ElasticsearchClient elasticsearchClient); }
CorePlugin extends StagemonitorPlugin { public URL getElasticsearchUrl() { final List<URL> urls = elasticsearchUrls.getValue(); if (urls.isEmpty()) { return null; } final int index = accessesToElasticsearchUrl.getAndIncrement() % urls.size(); URL elasticsearchURL = urls.get(index); final String defaultUsernameValue = elasticsearchDefaultUsername.getValue(); final String defaultPasswordValue = elasticsearchDefaultPassword.getValue(); if (elasticsearchURL.getUserInfo() == null && ! defaultUsernameValue.isEmpty() && ! defaultPasswordValue.isEmpty()) { try { String username = URLEncoder.encode(defaultUsernameValue, "UTF-8"); String password = URLEncoder.encode(defaultPasswordValue, "UTF-8"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder .append(elasticsearchURL.getProtocol()) .append(": .append(username) .append(":") .append(password) .append("@") .append(elasticsearchURL.getHost()) .append(":") .append(elasticsearchURL.getPort()) .append(elasticsearchURL.getPath()); return new URL(stringBuilder.toString()); } catch (Exception e) { logger.error(e.getMessage(), e); } } return elasticsearchURL; } CorePlugin();  CorePlugin(ElasticsearchClient elasticsearchClient); @Override void initializePlugin(InitArguments initArguments); @Override List<Class<? extends StagemonitorPlugin>> dependsOn(); @Override void onShutDown(); MeasurementSession getMeasurementSession(); Metric2Registry getMetricRegistry(); ElasticsearchClient getElasticsearchClient(); GrafanaClient getGrafanaClient(); void setElasticsearchClient(ElasticsearchClient elasticsearchClient); static String getNameOfLocalHost(); boolean isStagemonitorActive(); boolean isInternalMonitoringActive(); long getConsoleReportingInterval(); boolean isReportToJMX(); int getGraphiteReportingInterval(); String getGraphiteHostName(); int getGraphitePort(); String getApplicationName(); String getInstanceName(); String getHostName(); URL getElasticsearchUrl(); Collection<URL> getElasticsearchUrls(); String getElasticsearchUrlsWithoutAuthenticationInformation(); Collection<String> getElasticsearchConfigurationSourceProfiles(); boolean isDeactivateStagemonitorIfEsConfigSourceIsDown(); Collection<MetricName> getExcludedMetricsPatterns(); Collection<String> getDisabledPlugins(); Integer getReloadConfigurationInterval(); Collection<String> getExcludeContaining(); Collection<String> getIncludePackages(); Collection<String> getExcludePackages(); boolean isAttachAgentAtRuntime(); Collection<String> getExcludedInstrumenters(); URL getInfluxDbUrl(); String getInfluxDbDb(); boolean isReportToElasticsearch(); boolean isReportToGraphite(); String getGrafanaUrl(); String getGrafanaApiKey(); int getThreadPoolQueueCapacityLimit(); IndexSelector getIndexSelector(); int getElasticsearchReportingInterval(); Integer getMoveToColdNodesAfterDays(); boolean isOnlyLogElasticsearchMetricReports(); boolean isDebugInstrumentation(); Collection<String> getExportClassesWithName(); Integer getNumberOfReplicas(); Integer getNumberOfShards(); void closeOnShutdown(Closeable closeable); List<URL> getRemotePropertiesConfigUrls(); boolean isDeactivateStagemonitorIfRemotePropertyServerIsDown(); int getDeleteElasticsearchMetricsAfterDays(); String getMetricsIndexTemplate(); boolean isMetricsIndexTemplateDefaultValue(); boolean isInitializeElasticsearch(); HealthCheckRegistry getHealthCheckRegistry(); }
CorePlugin extends StagemonitorPlugin { public URL getElasticsearchUrl() { final List<URL> urls = elasticsearchUrls.getValue(); if (urls.isEmpty()) { return null; } final int index = accessesToElasticsearchUrl.getAndIncrement() % urls.size(); URL elasticsearchURL = urls.get(index); final String defaultUsernameValue = elasticsearchDefaultUsername.getValue(); final String defaultPasswordValue = elasticsearchDefaultPassword.getValue(); if (elasticsearchURL.getUserInfo() == null && ! defaultUsernameValue.isEmpty() && ! defaultPasswordValue.isEmpty()) { try { String username = URLEncoder.encode(defaultUsernameValue, "UTF-8"); String password = URLEncoder.encode(defaultPasswordValue, "UTF-8"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder .append(elasticsearchURL.getProtocol()) .append(": .append(username) .append(":") .append(password) .append("@") .append(elasticsearchURL.getHost()) .append(":") .append(elasticsearchURL.getPort()) .append(elasticsearchURL.getPath()); return new URL(stringBuilder.toString()); } catch (Exception e) { logger.error(e.getMessage(), e); } } return elasticsearchURL; } CorePlugin();  CorePlugin(ElasticsearchClient elasticsearchClient); @Override void initializePlugin(InitArguments initArguments); @Override List<Class<? extends StagemonitorPlugin>> dependsOn(); @Override void onShutDown(); MeasurementSession getMeasurementSession(); Metric2Registry getMetricRegistry(); ElasticsearchClient getElasticsearchClient(); GrafanaClient getGrafanaClient(); void setElasticsearchClient(ElasticsearchClient elasticsearchClient); static String getNameOfLocalHost(); boolean isStagemonitorActive(); boolean isInternalMonitoringActive(); long getConsoleReportingInterval(); boolean isReportToJMX(); int getGraphiteReportingInterval(); String getGraphiteHostName(); int getGraphitePort(); String getApplicationName(); String getInstanceName(); String getHostName(); URL getElasticsearchUrl(); Collection<URL> getElasticsearchUrls(); String getElasticsearchUrlsWithoutAuthenticationInformation(); Collection<String> getElasticsearchConfigurationSourceProfiles(); boolean isDeactivateStagemonitorIfEsConfigSourceIsDown(); Collection<MetricName> getExcludedMetricsPatterns(); Collection<String> getDisabledPlugins(); Integer getReloadConfigurationInterval(); Collection<String> getExcludeContaining(); Collection<String> getIncludePackages(); Collection<String> getExcludePackages(); boolean isAttachAgentAtRuntime(); Collection<String> getExcludedInstrumenters(); URL getInfluxDbUrl(); String getInfluxDbDb(); boolean isReportToElasticsearch(); boolean isReportToGraphite(); String getGrafanaUrl(); String getGrafanaApiKey(); int getThreadPoolQueueCapacityLimit(); IndexSelector getIndexSelector(); int getElasticsearchReportingInterval(); Integer getMoveToColdNodesAfterDays(); boolean isOnlyLogElasticsearchMetricReports(); boolean isDebugInstrumentation(); Collection<String> getExportClassesWithName(); Integer getNumberOfReplicas(); Integer getNumberOfShards(); void closeOnShutdown(Closeable closeable); List<URL> getRemotePropertiesConfigUrls(); boolean isDeactivateStagemonitorIfRemotePropertyServerIsDown(); int getDeleteElasticsearchMetricsAfterDays(); String getMetricsIndexTemplate(); boolean isMetricsIndexTemplateDefaultValue(); boolean isInitializeElasticsearch(); HealthCheckRegistry getHealthCheckRegistry(); static final String POOLS_QUEUE_CAPACITY_LIMIT_KEY; }