/** * @return finished threads */ public int getFinishedThreads() { return JMeterContextService.getThreadCounts().finishedThreads; }
/** * @return started threads */ public int getStartedThreads() { return JMeterContextService.getThreadCounts().startedThreads; }
/** * Add a {@link SampleResult} to be used in the statistics * @param result {@link SampleResult} not used */ public synchronized void add(SampleResult result) { usersStats.addValue(JMeterContextService.getThreadCounts().activeThreads); }
sb.append(')'); if ("+".equals(type)) { ThreadCounts tc = JMeterContextService.getThreadCounts(); sb.append(" Active: "); sb.append(tc.activeThreads);
@Override public void teardownTest(BackendListenerContext context) throws Exception { LOGGER.info("Shutting down influxDB scheduler..."); scheduler.shutdown(); addVirtualUsersMetrics(0, 0, 0, 0, JMeterContextService.getThreadCounts().finishedThreads); Point endPoint = Point.measurement(TestStartEndMeasurement.MEASUREMENT_NAME).time(System.currentTimeMillis(), TimeUnit.MILLISECONDS) .tag(TestStartEndMeasurement.Tags.TYPE, TestStartEndMeasurement.Values.FINISHED).tag(TestStartEndMeasurement.Tags.TEST_NAME, testName).build(); exportFileWriter.append(endPoint.lineProtocol()); exportFileWriter.newLine(); try { scheduler.awaitTermination(30, TimeUnit.SECONDS); LOGGER.info("influxDB scheduler terminated!"); } catch (InterruptedException e) { LOGGER.error("Error waiting for end of scheduler"); } samplersToFilter.clear(); exportFileWriter.close(); super.teardownTest(context); }
/** * Periodically writes virtual users metrics to influxDB. */ public void run() { try { ThreadCounts tc = JMeterContextService.getThreadCounts(); addVirtualUsersMetrics(getUserMetrics().getMinActiveThreads(), getUserMetrics().getMeanActiveThreads(), getUserMetrics().getMaxActiveThreads(), tc.startedThreads, tc.finishedThreads); } catch (Exception e) { LOGGER.error("Failed writing to influx", e); } }
/** * Periodically writes virtual users metrics to influxDB. */ public void run() { try { ThreadCounts tc = JMeterContextService.getThreadCounts(); addVirtualUsersMetrics(getUserMetrics().getMinActiveThreads(), getUserMetrics().getMeanActiveThreads(), getUserMetrics().getMaxActiveThreads(), tc.startedThreads, tc.finishedThreads); } catch (Exception e) { LOGGER.error("Failed writing to influx", e); } }
@Override public void teardownTest(BackendListenerContext context) throws Exception { LOGGER.info("Shutting down influxDB scheduler..."); scheduler.shutdown(); addVirtualUsersMetrics(0,0,0,0,JMeterContextService.getThreadCounts().finishedThreads); influxDB.write( influxDBConfig.getInfluxDatabase(), influxDBConfig.getInfluxRetentionPolicy(), Point.measurement(TestStartEndMeasurement.MEASUREMENT_NAME).time(System.currentTimeMillis(), TimeUnit.MILLISECONDS) .tag(TestStartEndMeasurement.Tags.TYPE, TestStartEndMeasurement.Values.FINISHED) .tag(TestStartEndMeasurement.Tags.NODE_NAME, nodeName) .tag(TestStartEndMeasurement.Tags.RUN_ID, runId) .tag(TestStartEndMeasurement.Tags.TEST_NAME, testName) .addField(TestStartEndMeasurement.Fields.PLACEHOLDER,"1") .build()); influxDB.disableBatch(); try { scheduler.awaitTermination(30, TimeUnit.SECONDS); LOGGER.info("influxDB scheduler terminated!"); } catch (InterruptedException e) { LOGGER.error("Error waiting for end of scheduler"); } samplersToFilter.clear(); super.teardownTest(context); }