@Test public void testCollectMeasurements() throws InitializationException { InfluxNiFiClusterMetricsReporter metricsInfluxDbReporter = new InfluxNiFiClusterMetricsReporter(); ProcessGroupStatusMetric processGroupStatusMetric = new ProcessGroupStatusMetric() .setId("id") .setProcessGroupName("root") .setActiveThreadCount(15.0) .setBytesRead(1.4) .setBytesReceived(4.) .setBytesSent(45.) .setBytesWritten(2387.) .setFlowFilesReceived(3425.) .setFlowFilesSent(3425.) .setFlowFilesTransferred(4243.) .setQueued(34521.) .setQueuedContentSize(487652.); Map<String, Object> memory = new HashMap<>(); memory.put("mem", 1.2); Map<String, Object> jvm = new HashMap<>(); jvm.put("free", 1.2); SystemMetricsSnapshot metrics = new SystemMetricsSnapshot() .setClusterNodeIdentifier("clusterId") .setMachineMemory(memory) .setJvmMetrics(jvm) .setRootProcessGroupSnapshot(processGroupStatusMetric) .setProcessGroupSnapshots(Arrays.asList(processGroupStatusMetric)); BatchPoints batchPoints = BatchPoints .database("mock_database") .build(); metricsInfluxDbReporter.collectMeasurements(System.currentTimeMillis(), metrics, batchPoints); List<Point> points = batchPoints.getPoints(); assertEquals(4, points.size()); }
void collectMeasurements(long now, SystemMetricsSnapshot snapshot, BatchPoints points) { collectMemoryMetrics(now, snapshot, points); collectJvmMetrics(now, snapshot, points); collectDiskUsageMetrics(now, snapshot, points); collectProcessGroupMetrics(now, Collections.singletonList(snapshot.getRootProcessGroupSnapshot()), points); collectProcessGroupMetrics(now, snapshot.getProcessGroupSnapshots(), points); collectRemoteProcessGroupMetrics(now, snapshot.getRemoteProcessGroupSnapshots(), points); collectProcessorMetrics(now, snapshot.getProcessorSnapshots(), points); collectConnectionMetrics(now, snapshot.getConnectionSnapshots(), points); collectInputPortMetrics(now, snapshot.getInputPortSnapshots(), points); collectOutputPortMetrics(now, snapshot.getOutputPortSnapshots(), points); }
InfluxNiFiClusterMetricsReporter extends AbstractNiFiClusterMetricsReporter { void collectMeasurements(long now, SystemMetricsSnapshot snapshot, BatchPoints points) { collectMemoryMetrics(now, snapshot, points); collectJvmMetrics(now, snapshot, points); collectDiskUsageMetrics(now, snapshot, points); collectProcessGroupMetrics(now, Collections.singletonList(snapshot.getRootProcessGroupSnapshot()), points); collectProcessGroupMetrics(now, snapshot.getProcessGroupSnapshots(), points); collectRemoteProcessGroupMetrics(now, snapshot.getRemoteProcessGroupSnapshots(), points); collectProcessorMetrics(now, snapshot.getProcessorSnapshots(), points); collectConnectionMetrics(now, snapshot.getConnectionSnapshots(), points); collectInputPortMetrics(now, snapshot.getInputPortSnapshots(), points); collectOutputPortMetrics(now, snapshot.getOutputPortSnapshots(), points); } }
InfluxNiFiClusterMetricsReporter extends AbstractNiFiClusterMetricsReporter { void collectMeasurements(long now, SystemMetricsSnapshot snapshot, BatchPoints points) { collectMemoryMetrics(now, snapshot, points); collectJvmMetrics(now, snapshot, points); collectDiskUsageMetrics(now, snapshot, points); collectProcessGroupMetrics(now, Collections.singletonList(snapshot.getRootProcessGroupSnapshot()), points); collectProcessGroupMetrics(now, snapshot.getProcessGroupSnapshots(), points); collectRemoteProcessGroupMetrics(now, snapshot.getRemoteProcessGroupSnapshots(), points); collectProcessorMetrics(now, snapshot.getProcessorSnapshots(), points); collectConnectionMetrics(now, snapshot.getConnectionSnapshots(), points); collectInputPortMetrics(now, snapshot.getInputPortSnapshots(), points); collectOutputPortMetrics(now, snapshot.getOutputPortSnapshots(), points); }  }
InfluxNiFiClusterMetricsReporter extends AbstractNiFiClusterMetricsReporter { void collectMeasurements(long now, SystemMetricsSnapshot snapshot, BatchPoints points) { collectMemoryMetrics(now, snapshot, points); collectJvmMetrics(now, snapshot, points); collectDiskUsageMetrics(now, snapshot, points); collectProcessGroupMetrics(now, Collections.singletonList(snapshot.getRootProcessGroupSnapshot()), points); collectProcessGroupMetrics(now, snapshot.getProcessGroupSnapshots(), points); collectRemoteProcessGroupMetrics(now, snapshot.getRemoteProcessGroupSnapshots(), points); collectProcessorMetrics(now, snapshot.getProcessorSnapshots(), points); collectConnectionMetrics(now, snapshot.getConnectionSnapshots(), points); collectInputPortMetrics(now, snapshot.getInputPortSnapshots(), points); collectOutputPortMetrics(now, snapshot.getOutputPortSnapshots(), points); }  @OnScheduled void startup(ConfigurationContext context); @Override final List<PropertyDescriptor> getSupportedPropertyDescriptors(); }
InfluxNiFiClusterMetricsReporter extends AbstractNiFiClusterMetricsReporter { void collectMeasurements(long now, SystemMetricsSnapshot snapshot, BatchPoints points) { collectMemoryMetrics(now, snapshot, points); collectJvmMetrics(now, snapshot, points); collectDiskUsageMetrics(now, snapshot, points); collectProcessGroupMetrics(now, Collections.singletonList(snapshot.getRootProcessGroupSnapshot()), points); collectProcessGroupMetrics(now, snapshot.getProcessGroupSnapshots(), points); collectRemoteProcessGroupMetrics(now, snapshot.getRemoteProcessGroupSnapshots(), points); collectProcessorMetrics(now, snapshot.getProcessorSnapshots(), points); collectConnectionMetrics(now, snapshot.getConnectionSnapshots(), points); collectInputPortMetrics(now, snapshot.getInputPortSnapshots(), points); collectOutputPortMetrics(now, snapshot.getOutputPortSnapshots(), points); }  @OnScheduled void startup(ConfigurationContext context); @Override final List<PropertyDescriptor> getSupportedPropertyDescriptors();  }