Skip to content

Commit 6e2f576

Browse files
mderevyankoaqaMikhail.Derevyankoushklianik
authored
Board update and libs (#69)
* Supported JMeter 5.5 (#54) Co-authored-by: Mikhail.Derevyanko <[email protected]> * New sample type tag (#67) These changes allow you to save to the database whether it is a request or a transaction. Which greatly simplifies data visualization and determining what is a request and what is a transaction controller. Co-authored-by: ushklianik <[email protected]> * Libs update: the influxdb-client-java to 6.5.0 and gradle to 7.5.1, readme and board updated as well Co-authored-by: Mikhail.Derevyanko <[email protected]> Co-authored-by: ushklianik <[email protected]>
1 parent 33d31be commit 6e2f576

File tree

10 files changed

+488
-244
lines changed

10 files changed

+488
-244
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ The supported versions:
6767
* Java 11 - make sure that you have it (its minimum version).
6868
* InfluxDB v2.x, see release notes: https://docs.influxdata.com/influxdb/v2.0/reference/release-notes/influxdb/ (1.8 is not supported)
6969
* JMeter 5.5.0 only.
70-
* The current board and plugin were tested on Grafana 8.5.4 and InfluxDB 2.2.0, JAVA 15.
70+
71+
* The current board and plugin were tested on Grafana 9.1.6 and InfluxDB 2.2.0, JAVA 15.
7172

7273
## Maven Support
7374
Please see the latest release here https://search.maven.org/artifact/io.github.mderevyankoaqa/jmeter-plugins-influxdb2-listener.
@@ -192,9 +193,14 @@ Notes: when test has been interrupted from UI; the processes may not be finished
192193
See deployment instructions here https://grafana.com/grafana/dashboards/13644
193194

194195
Dashboard helps:
196+
* Filter the results by Run Id or Type (can be requests or transactions).
197+
![](img/filterById.png)
198+
199+
![](img/filterByType.png)
200+
201+
195202
* Monitor throughput with active users.
196203
![](img/grafana1.png)
197-
198204

199205
* Overview and analise the response time, distribution as well. Added the filters to see requests with status "pass", "fail".
200206
![](img/grafana2.png)

build.gradle

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repositories {
2424

2525
sourceCompatibility = 11
2626
group = 'io.github.mderevyankoaqa'
27-
version = '2.4'
27+
version = '2.5'
2828
def title = 'JMeterInfluxDB2Listener'
2929
def archiveName = 'jmeter-plugins-influxdb2-listener'
3030

@@ -45,15 +45,17 @@ def archiveName = 'jmeter-plugins-influxdb2-listener'
4545
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_java', version: '5.5'
4646
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_components', version: '5.5'
4747
implementation group: 'org.apache.jmeter', name: 'jorphan', version: '5.5'
48-
implementation group: 'com.influxdb', name: 'influxdb-client-java', version: '6.1.0'
48+
implementation group: 'com.influxdb', name: 'influxdb-client-java', version: '6.5.0'
4949
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
50+
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_http', version: '5.4.3'
5051

5152
components {
5253
withModule("org.apache.jmeter:ApacheJMeter_core", JMeterRule)
5354
withModule("org.apache.jmeter:ApacheJMeter_java", JMeterRule)
5455
withModule("org.apache.jmeter:ApacheJMeter_components", JMeterRule)
5556
withModule("org.apache.jmeter:jorphan", JMeterRule)
5657
withModule("org.apache.jmeter:ApacheJMeter", JMeterRule)
58+
withModule("org.apache.jmeter:ApacheJMeter_http", JMeterRule)
5759
}
5860
}
5961

@@ -130,6 +132,11 @@ publishing {
130132
name = 'Pierre Brun'
131133
132134
}
135+
developer {
136+
id = 'ushklianik'
137+
name = 'Uladzislau Shklianik'
138+
139+
}
133140
}
134141
scm {
135142
connection = 'scm:git:git:github.com/mderevyankoaqa/jmeter-influxdb2-listener-plugin.git'

dashboard/JMeter Load Test (org.md.jmeter.influxdb2.visualizer) - influxdb v2.0 (Flux).json

Lines changed: 440 additions & 239 deletions
Large diffs are not rendered by default.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Fri Apr 17 22:39:55 EEST 2020
2-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
33
distributionBase=GRADLE_USER_HOME
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists

img/filterById.png

8.77 KB
Loading

img/filterByType.png

7.66 KB
Loading

src/main/java/io/github/mderevyankoaqa/influxdb2/visualizer/InfluxDatabaseBackendListenerClient.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import io.github.mderevyankoaqa.influxdb2.visualizer.result.SampleResultPointContext;
1010
import io.github.mderevyankoaqa.influxdb2.visualizer.result.SampleResultPointProvider;
1111
import org.apache.jmeter.config.Arguments;
12+
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult;
1213
import org.apache.jmeter.samplers.SampleResult;
1314
import org.apache.jmeter.threads.JMeterContextService;
1415
import org.apache.jmeter.threads.JMeterContextService.ThreadCounts;
@@ -124,6 +125,11 @@ public void handleSampleResults(List<SampleResult> sampleResults, BackendListene
124125

125126
for (SampleResult sampleResult : allSampleResults) {
126127
getUserMetrics().add(sampleResult);
128+
// Determine the type of sample, whether it is a request or a transaction controller
129+
String samplerType = "transaction";
130+
if (sampleResult instanceof HTTPSampleResult){
131+
samplerType = "request";
132+
}
127133

128134
if ((null != regexForSamplerList && sampleResult.getSampleLabel().matches(regexForSamplerList))
129135
|| samplersToFilter.contains(sampleResult.getSampleLabel())) {
@@ -133,6 +139,7 @@ public void handleSampleResults(List<SampleResult> sampleResults, BackendListene
133139
sampleResultContext.setTestName(this.testName);
134140
sampleResultContext.setNodeName(this.nodeName);
135141
sampleResultContext.setSampleResult(sampleResult);
142+
sampleResultContext.setSamplerType(samplerType);
136143
sampleResultContext.setTimeToSet(System.currentTimeMillis() * ONE_MS_IN_NANOSECONDS + this.getUniqueNumberForTheSamplerThread());
137144
sampleResultContext.setErrorBodyToBeSaved(context.getBooleanParameter(KEY_INCLUDE_BODY_OF_FAILURES, false));
138145
sampleResultContext.setResponseBodyLength(this.influxDBConfig.getResponseBodyLength());

src/main/java/io/github/mderevyankoaqa/influxdb2/visualizer/config/RequestMeasurement.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ interface Tags {
5858
* The result, can be pass or fail.
5959
*/
6060
String RESULT = "result";
61+
62+
/**
63+
* sampleType represents the type of sample, whether it is a request or a transaction controller.
64+
*/
65+
String SAMPLE_TYPE = "samplerType";
6166
}
6267

6368
/**

src/main/java/io/github/mderevyankoaqa/influxdb2/visualizer/result/SampleResultPointContext.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class SampleResultPointContext {
1515
private String testName;
1616
boolean errorBodyToBeSaved;
1717
private int ResponseBodyLength;
18+
private String samplerType;
1819

1920
/**
2021
* Checks whether the body of the failed repose is going to be saved.
@@ -127,4 +128,20 @@ public int getResponseBodyLength() {
127128
public void setResponseBodyLength(int responseBodyLength) {
128129
this.ResponseBodyLength = responseBodyLength;
129130
}
131+
132+
/**
133+
* Sets samplerType.
134+
* @param samplerType represents the type of sample, whether it is a request or a transaction controller.
135+
*/
136+
public void setSamplerType(String samplerType) {
137+
this.samplerType = samplerType;
138+
}
139+
140+
/**
141+
* Gets the SamplerType.
142+
* @return returns SamplerType.
143+
*/
144+
public String getSamplerType() {
145+
return this.samplerType;
146+
}
130147
}

src/main/java/io/github/mderevyankoaqa/influxdb2/visualizer/result/SampleResultPointProvider.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ private Point getDefaultPoint() {
106106
.addTag(RequestMeasurement.Tags.NODE_NAME, this.sampleResultContext.getNodeName())
107107
.addTag(RequestMeasurement.Tags.RESULT_CODE, this.sampleResultContext.getSampleResult().getResponseCode())
108108
.addTag(RequestMeasurement.Tags.ERROR_MSG, this.getAssertionFailure())
109+
.addTag(RequestMeasurement.Tags.SAMPLE_TYPE, this.sampleResultContext.getSamplerType())
109110
.addTag(RequestMeasurement.Tags.ERROR_RESPONSE_BODY, this.getErrorBodyToBeSaved(this.sampleResultContext.isErrorBodyToBeSaved()))
110111
.addField(RequestMeasurement.Fields.ERROR_COUNT, this.sampleResultContext.getSampleResult().getErrorCount())
111112
.addField(RequestMeasurement.Fields.REQUEST_COUNT, this.sampleResultContext.getSampleResult().getSampleCount())

0 commit comments

Comments
 (0)