@Override public void open() throws MetricReadException { final long start = System.currentTimeMillis(); try { fetchOverHttp(httpClient, httpContext); } catch (final Exception e) { throw new OpenMetricsReaderException(e); } final long end = System.currentTimeMillis(); timingsLogger.debug("Discovered {} metrics in {} ms", values.size(), end - start); }
@Override public void open() throws MetricReadException { final long start = System.currentTimeMillis(); try { fetchOverHttp(httpClient, httpContext); } catch (final Exception e) { throw new OpenMetricsReaderException(e); } final long end = System.currentTimeMillis(); timingsLogger.debug("Discovered {} metrics in {} ms", values.size(), end - start); }
@Override public void open() throws MetricReadException { try { logger.debug("Fetching connection from pool {}", config.getPool()); this.connection = connectionPool.getConnection(); } catch (final SQLException e) { throw new OpenMetricsReaderException(e); } }
@Override public void open() throws MetricReadException { try { logger.debug("Fetching connection from pool {}", config.getPool()); this.connection = connectionPool.getConnection(); } catch (final SQLException e) { throw new OpenMetricsReaderException(e); } }
@Override public void open() { if (!connection.isEstablished()) { try { logger.info("Connecting to JMX server"); connection.connect(); } catch (final IOException e) { throw new OpenMetricsReaderException(e); } metadata = new MetricsMetaData(readMetaData()); } values.clear(); }
@Override public void open() { if (!connection.isEstablished()) { try { logger.info("Connecting to JMX server"); connection.connect(); } catch (final IOException e) { throw new OpenMetricsReaderException(e); } metadata = new MetricsMetaData(readMetaData()); } values.clear(); }
@Override public void open() { if (service == null) { SamplerStats.get().incConnectCount(); service = loadCommandService(); } if (service == null) { throw new OpenMetricsReaderException("Failed to open command service api to the admin"); } }
protected AdminLoginManager getAdminLoginManager(HostConfig host) { if (credentialsProvider == null) { logger.info("No admin login manager required because no login credentials were configured"); return null; } else { final LoginCredentials credentials = credentialsProvider.getCredentials(); logger.info("Bootstrapping the admin login manager at [{}] as [{}]", host, credentials.getUsername()); final AdminLoginManager result = new AdminLoginManager(credentials.getUsername(), true); try { final boolean bootstrapped = result.bootstrap(host.getHost(), host.getPort(), credentials); if (!bootstrapped) { throw new OpenMetricsReaderException("Failed to bootstrap the admin login manager at [" + host.toString() + "] as [" + credentials.getUsername() + "]"); } } catch (AuthenticationFailureException e) { throw new OpenMetricsReaderException("Failed to bootstrap the admin login manager due to authentication failure", e); } return result; } }
private void reconnectIfNecessary() { if (jedis == null) { jedis = new Jedis(config.getHost(), config.getPort()); if (config.hasPassword()) { final String response = jedis.auth(config.getPassword()); if (!"OK".equals(response)) { throw new OpenMetricsReaderException("Incorrect password: " + response); } } try { SamplerStats.get().incConnectCount(); jedis.connect(); } catch (final JedisConnectionException e) { jedis = null; throw new OpenMetricsReaderException(e); } } }
private void reconnectIfNecessary() { if (jedis == null) { jedis = new Jedis(config.getHost(), config.getPort()); if (config.hasPassword()) { final String response = jedis.auth(config.getPassword()); if (!"OK".equals(response)) { throw new OpenMetricsReaderException("Incorrect password: " + response); } } try { SamplerStats.get().incConnectCount(); jedis.connect(); } catch (final JedisConnectionException e) { jedis = null; throw new OpenMetricsReaderException(e); } } }
protected void connectStore() { final LoginCredentials credentials = credentialsProvider.getCredentials(); final Properties securityProps = createSecurityProperties(config.getTrustFile()); final KVStoreConfig kvStoreConfig = new KVStoreConfig(config.getStoreName(), helperHosts); kvStoreConfig.setSecurityProperties(securityProps); logger.info("Connecting to the secured kv store [{}] at {} as [{}]", kvStoreConfig.getStoreName(), helperHosts, credentials.getUsername()); try { final KVStore store = KVStoreFactory.getStore(kvStoreConfig, credentials, KVStoreLogin.makeReauthenticateHandler(credentialsProvider)); IOUtils.closeQuietly(store); } catch (FaultException e) { throw new OpenMetricsReaderException("Failed to connect to store", e); } }