@Test public void testGenerateSamples_many() throws Exception { System.out.println("generateSamples"); PerfMonSampleGenerator collector = new Gen(); channel.setBytesToRead(ByteBuffer.wrap("0.123 3424\n".getBytes())); instance.generateSamples(collector); }
public void generateSamples(PerfMonSampleGenerator collector) throws IOException { String[] data = transport.readMetrics(); for (int n = 0; n < data.length; n++) { if (!data[n].isEmpty()) { try { collector.generateSample(Double.parseDouble(data[n]), metricLabels[n]); } catch (NumberFormatException | ArrayIndexOutOfBoundsException e) { collector.generateErrorSample(metricLabels[n], e.toString()); } } } }
NewAgentConnector implements PerfMonAgentConnector { public void generateSamples(PerfMonSampleGenerator collector) throws IOException { String[] data = transport.readMetrics(); for (int n = 0; n < data.length; n++) { if (!data[n].isEmpty()) { try { collector.generateSample(Double.parseDouble(data[n]), metricLabels[n]); } catch (NumberFormatException | ArrayIndexOutOfBoundsException e) { collector.generateErrorSample(metricLabels[n], e.toString()); } } } } }
NewAgentConnector implements PerfMonAgentConnector { public void generateSamples(PerfMonSampleGenerator collector) throws IOException { String[] data = transport.readMetrics(); for (int n = 0; n < data.length; n++) { if (!data[n].isEmpty()) { try { collector.generateSample(Double.parseDouble(data[n]), metricLabels[n]); } catch (NumberFormatException | ArrayIndexOutOfBoundsException e) { collector.generateErrorSample(metricLabels[n], e.toString()); } } } }  }
NewAgentConnector implements PerfMonAgentConnector { public void generateSamples(PerfMonSampleGenerator collector) throws IOException { String[] data = transport.readMetrics(); for (int n = 0; n < data.length; n++) { if (!data[n].isEmpty()) { try { collector.generateSample(Double.parseDouble(data[n]), metricLabels[n]); } catch (NumberFormatException | ArrayIndexOutOfBoundsException e) { collector.generateErrorSample(metricLabels[n], e.toString()); } } } }  void setTransport(Transport atransport); void connect(); void disconnect(); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label); }
NewAgentConnector implements PerfMonAgentConnector { public void generateSamples(PerfMonSampleGenerator collector) throws IOException { String[] data = transport.readMetrics(); for (int n = 0; n < data.length; n++) { if (!data[n].isEmpty()) { try { collector.generateSample(Double.parseDouble(data[n]), metricLabels[n]); } catch (NumberFormatException | ArrayIndexOutOfBoundsException e) { collector.generateErrorSample(metricLabels[n], e.toString()); } } } }  void setTransport(Transport atransport); void connect(); void disconnect(); void generateSamples(PerfMonSampleGenerator collector); void addMetric(String metric, String params, String label);  }