Skip to content

Commit a12a892

Browse files
Code cleanup
1 parent d9530e2 commit a12a892

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,12 @@
3030
/**
3131
*
3232
* @author: Delirius325
33-
* @inspired_by: korteke & zumo64
34-
* @source_1: https://github.com/korteke/JMeter_ElasticsearchBackendListener
35-
* @source_2: https://github.com/zumo64/ELK_POC
3633
*/
3734
public class ElasticsearchBackend extends AbstractBackendListenerClient {
3835
private static final String BUILD_NUMBER = "BuildNumber";
3936
private static final String ES_SCHEME = "es.scheme";
4037
private static final String ES_HOST = "es.host";
41-
private static final String ES_PORT = "es.transport.port";
38+
private static final String ES_PORT = "es.port";
4239
private static final String ES_INDEX = "es.index";
4340
private static final String ES_TIMESTAMP = "es.timestamp";
4441
private static final String ES_STATUS_CODE = "es.status.code";
@@ -110,12 +107,13 @@ public void onFailure(HttpHost host) {
110107
public void handleSampleResults(List<SampleResult> results, BackendListenerContext context) {
111108
for(SampleResult sr : results) {
112109
boolean validSample = false;
110+
String sampleLabel = sr.getSampleLabel().toLowerCase().trim();
113111

114112
if(this.filters == null) {
115113
validSample = true;
116114
} else {
117115
for(String filter : this.filters) {
118-
if(filter.toLowerCase().trim().equals(sr.getSampleLabel().toLowerCase().trim())) {
116+
if(filter.toLowerCase().trim().equals(sampleLabel) || sampleLabel.contains(filter.toLowerCase().trim())) {
119117
validSample = true;
120118
break;
121119
}
@@ -169,7 +167,7 @@ private void sendRequest(List<String> bulkList) throws IOException {
169167
}
170168
} catch (Exception e) {
171169
if(logger.isErrorEnabled()) {
172-
logger.error("ElasticSearch Backend Listener was unable to perform request to the ElasticSearch engine.");
170+
logger.error("ElasticSearch Backend Listener was unable to perform request to the ElasticSearch engine. Request reached timeout.");
173171
}
174172
}
175173
}

0 commit comments

Comments
 (0)