Skip to content

Commit 3aa16ae

Browse files
Version 2.6.5
1 parent c8910b4 commit 3aa16ae

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

src/main/java/io/github/delirius325/jmeter/backendlistener/elasticsearch/ElasticSearchMetric.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ public Map<String, Object> getMetric(BackendListenerContext context) throws Exce
7171
addFilteredJSON("ThreadName", this.sampleResult.getThreadName());
7272
addFilteredJSON("URL", this.sampleResult.getURL());
7373
addFilteredJSON("ResponseCode", this.sampleResult.getResponseCode());
74-
addFilteredJSON("StartTime", sdf.format(new Date(this.sampleResult.getStartTime())));
75-
addFilteredJSON("EndTime", sdf.format(new Date(this.sampleResult.getEndTime())));
74+
addFilteredJSON("TestStartTime", JMeterContextService.getTestStartTime());
75+
addFilteredJSON("SampleStartTime", sdf.format(new Date(this.sampleResult.getStartTime())));
76+
addFilteredJSON("SampleEndTime", sdf.format(new Date(this.sampleResult.getEndTime())));
7677
addFilteredJSON("Timestamp", sdf.format(new Date(this.sampleResult.getTimeStamp())));
7778
addFilteredJSON("InjectorHostname", InetAddress.getLocalHost().getHostName());
7879

src/main/java/io/github/delirius325/jmeter/backendlistener/elasticsearch/ElasticSearchMetricSender.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,10 @@ private Request setAuthorizationHeader(Request request) {
8989
* @throws IOException
9090
*/
9191
public void createIndex() throws IOException {
92-
Response response = null;
9392
try {
94-
response = this.client.performRequest(setAuthorizationHeader(new Request("PUT", "/" + this.esIndex)));
95-
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK && logger.isErrorEnabled()) {
96-
logger.error("ElasticSearch Backend Listener failed to create index {}", this.esIndex);
97-
}
93+
this.client.performRequest(setAuthorizationHeader(new Request("PUT", "/" + this.esIndex)));
9894
} catch (Exception e) {
99-
logger.info("ElasticSearch Backend Listener failed to create index {}", this.esIndex);
100-
if (logger.isErrorEnabled()) {
101-
logger.error("Exception" + e);
102-
}
95+
logger.info("Index already exists!");
10396
}
10497
}
10598

src/main/java/io/github/delirius325/jmeter/backendlistener/elasticsearch/ElasticsearchBackendClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class ElasticsearchBackendClient extends AbstractBackendListenerClient {
6161
DEFAULT_ARGS.put(ES_BULK_SIZE, "100");
6262
DEFAULT_ARGS.put(ES_TIMEOUT_MS, Long.toString(DEFAULT_TIMEOUT_MS));
6363
DEFAULT_ARGS.put(ES_SAMPLE_FILTER, null);
64+
DEFAULT_ARGS.put(ES_FIELDS, null);
6465
DEFAULT_ARGS.put(ES_TEST_MODE, "info");
6566
DEFAULT_ARGS.put(ES_AUTH_USER, "");
6667
DEFAULT_ARGS.put(ES_AUTH_PWD, "");

0 commit comments

Comments
 (0)