public JmxMetricsReader(final JmxInputConfig config) { super(config); try { this.connection = new JmxConnection(config); } catch (final IOException e) { throw new MetricReadException(e); } }
public JmxMetricsReader(final JmxInputConfig config) { super(config); try { this.connection = new JmxConnection(config); } catch (final IOException e) { throw new MetricReadException(e); } }
@Override public Metrics readAllMetrics() throws MetricReadException { try(final Socket socket = createAndConnect(config.getHost(), config.getPort(), config.getSocketOptions())) { final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), ASCII_CHARSET)); final BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), ASCII_CHARSET)); final Metrics result = new Metrics(); fetchStatistics("general", reader, writer, result); quit(writer); return result; } catch (IOException e) { throw new MetricReadException(e); } }
throw new MetricReadException("Failed to establish connection", e);
timingsLogger.debug("Read metric {} in {} ms", metric.getName(), end - start); } catch (final AttributeNotFoundException e) { throw new MetricReadException(e); } catch (final InstanceNotFoundException e) { throw new MetricReadException(e); } catch (final MBeanException e) { throw new MetricReadException(e); } catch (final RuntimeMBeanException e) { throw new MetricReadException(e); } catch (final ReflectionException e) { throw new MetricReadException(e); } catch (final NullPointerException e) { throw new MetricReadException(e); } catch (final IOException e) { reconnect(); throw new MetricReadException(e);
} catch (final SQLException e) { reconnect(); throw new MetricReadException("Failed to create statement. Will reconnect just in case", e);
} catch (final SQLException e) { reconnect(); throw new MetricReadException("Failed to create statement. Will reconnect just in case", e);
timingsLogger.debug("Read metric {} in {} ms", metric.getName(), end - start); } catch (final AttributeNotFoundException e) { throw new MetricReadException(e); } catch (final InstanceNotFoundException e) { throw new MetricReadException(e); } catch (final MBeanException e) { throw new MetricReadException(e); } catch (final RuntimeMBeanException e) { throw new MetricReadException(e); } catch (final ReflectionException e) { throw new MetricReadException(e); } catch (final NullPointerException e) { throw new MetricReadException(e); } catch (final IOException e) { reconnect(); throw new MetricReadException(e);
throw new MetricReadException("Failed to establish connection", e);
@Override public Metrics readAllMetrics() throws MetricReadException { reconnectIfNecessary(); try { final long timestamp = System.currentTimeMillis(); final Metrics result = new Metrics(); fetchMetricsFromInfo(timestamp, result); fetchMetricsFromCommands(timestamp, result); return result; } catch (final JedisConnectionException e) { forceDisconnect(); throw new MetricReadException(e); } }
@Override public Metrics readAllMetrics() throws MetricReadException { reconnectIfNecessary(); try { final long timestamp = System.currentTimeMillis(); final Metrics result = new Metrics(); fetchMetricsFromInfo(timestamp, result); fetchMetricsFromCommands(timestamp, result); return result; } catch (final JedisConnectionException e) { forceDisconnect(); throw new MetricReadException(e); } }
@Override public Metrics readAllMetrics() throws MetricReadException { if (service == null) { throw new MetricReadException("No command service available"); } final Metrics result = new Metrics(); boolean failureEncountered = false; try { addStatusMetrics(result); } catch (RemoteException | KVSecurityException e) { logger.warn("Failed to fetch the status metrics", e); failureEncountered = true; } try { addPerfMapMetrics(result); } catch (RemoteException | KVSecurityException e) { logger.warn("Failed to fetch the perf map metrics", e); failureEncountered = true; } try { addTopologyMetrics(result); } catch (RemoteException e) { logger.warn("Failed to fetch the topology metrics", e); failureEncountered = true; } if (failureEncountered) { reset(); } return result; }