Skip to content

Commit 53cb07f

Browse files
mderevyankoaqaMikhail Derevyanko
andauthored
Supported JMeter 5.6.3 (#104)
* Supported JMeter 5.6.3; updated libs, improved java docs. --------- Co-authored-by: Mikhail Derevyanko <[email protected]>
1 parent 129bf1e commit 53cb07f

File tree

10 files changed

+114
-38
lines changed

10 files changed

+114
-38
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ Pay attention on "Sending metrics performance tuning" chapter, see below.
6262

6363
## Compatibility
6464
The supported versions:
65-
* Java 11 - make sure that you have it (its minimum version).
65+
* 🚨 Java 11 - make sure that you have it (its minimum version); otherwise errors will occur while plugin loading.
6666
* InfluxDB v2.x, see release notes: https://docs.influxdata.com/influxdb/v2.0/reference/release-notes/influxdb/ (1.8 is not supported)
67-
* JMeter 5.6.2 only.
67+
* JMeter 5.6.3 only.
6868

69-
* The current board and plugin were tested on Grafana 10.1.4 and InfluxDB 2.7.1, JAVA 15.
69+
* The current board and plugin were tested on Grafana 11.1.3 and InfluxDB 2.7.8, JAVA 21.0.1.
7070

7171
## Maven Support
7272
Please see the latest release here https://search.maven.org/artifact/io.github.mderevyankoaqa/jmeter-plugins-influxdb2-listener.
@@ -77,7 +77,7 @@ The example of the adding plugin to the project with the jmeter-maven:
7777

7878
<configuration>
7979
<jmeterExtensions>
80-
<artifact>io.github.mderevyankoaqa:jmeter-plugins-influxdb2-listener:2.1</artifact>
80+
<artifact>io.github.mderevyankoaqa:jmeter-plugins-influxdb2-listener:2.8</artifact>
8181
</jmeterExtensions>
8282
</configuration>
8383
Some notes cab be found in the article [Adding jar's to the /lib/ext directory](https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Adding-Excluding-libraries-to-from-the-classpath).

build.gradle

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,31 @@ repositories {
2424

2525
sourceCompatibility = 11
2626
group = 'io.github.mderevyankoaqa'
27-
version = '2.7'
27+
version = '2.8'
2828

2929
def title = 'JMeterInfluxDB2Listener'
3030
def archiveName = 'jmeter-plugins-influxdb2-listener'
3131

3232

3333
// There's a bug in JMeter leaving extra metadata right now. This is a workaround.
34-
class JMeterRule implements ComponentMetadataRule {
34+
abstract class JMeterRule implements ComponentMetadataRule {
3535
void execute(ComponentMetadataContext context) {
36-
context.details.allVariants {
37-
withDependencies {
38-
removeAll { it.group == "org.apache.jmeter" && it.name == "bom" }
36+
context.details.allVariants { variant ->
37+
variant.withDependencies { dependencies ->
38+
dependencies.removeAll { it.group == "org.apache.jmeter" && it.name == "bom" }
3939
}
4040
}
4141
}
4242
}
4343

4444
dependencies {
45-
// classpath "com.github.johnrengelman:shadow:8.1.1"
46-
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_core', version: '5.6.2'
47-
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_java', version: '5.6.2'
48-
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_components', version: '5.6.2'
49-
implementation group: 'org.apache.jmeter', name: 'jorphan', version: '5.6.2'
50-
implementation group: 'com.influxdb', name: 'influxdb-client-java', version: '6.10.0'
51-
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
52-
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_http', version: '5.6.2'
45+
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_core', version: '5.6.3'
46+
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_java', version: '5.6.3'
47+
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_components', version: '5.6.3'
48+
implementation group: 'org.apache.jmeter', name: 'jorphan', version: '5.6.3'
49+
implementation group: 'com.influxdb', name: 'influxdb-client-java', version: '6.12.0'
50+
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.14.0'
51+
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_http', version: '5.6.3'
5352
components {
5453
withModule("org.apache.jmeter:ApacheJMeter_core", JMeterRule)
5554
withModule("org.apache.jmeter:ApacheJMeter_java", JMeterRule)

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-8.4-all.zip
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
33
distributionBase=GRADLE_USER_HOME
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@
3535
*/
3636

3737
public class InfluxDatabaseBackendListenerClient extends AbstractBackendListenerClient implements Runnable {
38+
39+
/**
40+
* Constructs a new instance of {@link InfluxDatabaseBackendListenerClient}.
41+
* This constructor is currently empty, but can be used to initialize any necessary
42+
* resources or configurations in future extensions.
43+
*/
44+
public InfluxDatabaseBackendListenerClient() {
45+
46+
}
47+
3848
/**
3949
* Logger.
4050
*/

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
*/
77
public final class ArgsValidator {
88

9+
/**
10+
* Private constructor to prevent instantiation of {@link ArgsValidator}.
11+
* <p>
12+
* This constructor is intentionally left empty as this class is designed to be a
13+
* utility class with only static methods and should not be instantiated.
14+
* </p>
15+
*/
16+
private ArgsValidator() {
17+
// This constructor is intentionally left empty to prevent instantiation.
18+
}
19+
920
/**
1021
* Checks that http scheme is "http" or "https".
1122
* @param scheme represents the http scheme.

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,21 @@ public class InfluxDBConfig {
133133
private int responseBodyLength;
134134

135135
/**
136-
* Creates the new instance of {@link InfluxDBConfig}
136+
* Constructs a new {@link InfluxDBConfig} instance using the provided {@link BackendListenerContext}.
137+
* <p>
138+
* This constructor initializes the InfluxDB configuration settings by extracting parameters
139+
* from the provided context and performing necessary validation checks.
140+
* </p>
137141
*
138-
* @param context the {@link BackendListenerContext}
142+
* <ul>
143+
* <li>Validates and sets the InfluxDB URL, ensuring that the scheme is either HTTP or HTTPS.</li>
144+
* <li>Validates and sets the InfluxDB authentication token.</li>
145+
* <li>Validates and sets the InfluxDB organization and bucket names.</li>
146+
* <li>Validates and sets batch size, flush interval, error threshold, and response body length.</li>
147+
* </ul>
148+
*
149+
* @param context the {@link BackendListenerContext} containing the configuration parameters for InfluxDB.
150+
* @throws IllegalArgumentException if any of the required parameters are missing or invalid.
139151
*/
140152
public InfluxDBConfig(BackendListenerContext context) {
141153
String influxDBURL = context.getParameter(KEY_INFLUX_DB_URL);

src/main/java/io/github/mderevyankoaqa/influxdb2/visualizer/influxdb/client/InfluxDatabaseClient.java

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ public class InfluxDatabaseClient {
2626

2727

2828
/**
29-
* Creates a new instance of the @link InfluxDatabaseClient.
29+
* Private constructor for creating a new instance of {@link InfluxDatabaseClient}.
30+
* <p>
31+
* This constructor initializes the {@code InfluxDatabaseClient} with the provided configuration and logger.
32+
* It also sets up synchronized lists for managing points and error counts.
33+
* </p>
3034
*
31-
* @param config {@link InfluxDBConfig}
32-
* @param logger {@link Logger}
35+
* @param config the {@link InfluxDBConfig} used to configure the client.
36+
* @param logger the {@link Logger} used for logging within the client.
3337
*/
3438
private InfluxDatabaseClient(InfluxDBConfig config, Logger logger) {
3539

@@ -42,10 +46,17 @@ private InfluxDatabaseClient(InfluxDBConfig config, Logger logger) {
4246
}
4347

4448
/**
45-
* Creates the singleton instance of the {@link InfluxDatabaseClient}.
46-
* @param config {@link InfluxDBConfig}
47-
* @param logger {@link Logger}
48-
* @return the created instance of {@link InfluxDatabaseClient}
49+
* Creates and returns the singleton instance of {@link InfluxDatabaseClient}.
50+
* <p>
51+
* This method ensures that only one instance of {@link InfluxDatabaseClient}
52+
* is created throughout the application's lifecycle. If the instance already
53+
* exists, it returns the existing one; otherwise, it creates a new instance
54+
* with the provided {@link InfluxDBConfig} and {@link Logger}.
55+
* </p>
56+
*
57+
* @param config the configuration for the InfluxDB connection.
58+
* @param logger the logger to be used by the InfluxDatabaseClient.
59+
* @return the singleton instance of {@link InfluxDatabaseClient}.
4960
*/
5061
public static InfluxDatabaseClient getInstance(InfluxDBConfig config, Logger logger) {
5162

src/main/java/io/github/mderevyankoaqa/influxdb2/visualizer/influxdb/client/InfluxDatabaseUtility.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
*/
77
public class InfluxDatabaseUtility {
88

9+
// Private constructor to prevent instantiation
10+
private InfluxDatabaseUtility() {
11+
// This constructor is intentionally left empty to prevent instantiation.
12+
}
13+
914
/**
1015
* Updates not supported values.
1116
* @param value the string which is going to be updated.
@@ -20,10 +25,19 @@ public static String getEscapedString(String value) {
2025
}
2126

2227
/**
23-
* Gets the substring from the value.
24-
* @param value the initial value.
25-
* @param expectedLength the expected length.
26-
* @return returns the the truncated string if the initial string length is less or equal to expected length; otherwise initial string.
28+
* Returns a substring of the specified length from the given string.
29+
* <p>
30+
* If the length of the provided string is greater than or equal to the
31+
* expected length, this method returns the substring starting from the
32+
* beginning of the string up to the expected length. If the length of the
33+
* string is less than the expected length, the entire string is returned
34+
* without any truncation.
35+
* </p>
36+
*
37+
* @param value the original string from which the substring will be extracted.
38+
* @param expectedLength the desired length of the substring.
39+
* @return the substring of the specified length if the original string is
40+
* longer than the expected length; otherwise, the original string.
2741
*/
2842
public static String getSubstring(String value, int expectedLength)
2943
{

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ public class SampleResultPointContext {
1717
private int ResponseBodyLength;
1818
private String samplerType;
1919

20+
/**
21+
* Default constructor for the {@code SampleResultPointContext} class.
22+
* <p>
23+
* This constructor initializes a new instance of {@code SampleResultPointContext} with default settings.
24+
* It does not perform any additional setup or initialization tasks.
25+
* </p>
26+
*/
27+
public SampleResultPointContext()
28+
{
29+
}
30+
2031
/**
2132
* Checks whether the body of the failed repose is going to be saved.
2233
* @return true to save body; otherwise false to skip saving.

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,21 @@ public class SampleResultPointProvider {
1515
private static final String NO_DATA = "noData";
1616

1717
/**
18-
* Creates the new instance of the {@link SampleResultPointProvider}.
19-
* @param sampleResultContext the {@link SampleResultPointContext}.
18+
* Creates a new instance of the {@link SampleResultPointProvider}.
19+
* Initializes the provider with the given {@link SampleResultPointContext}.
20+
*
21+
* @param sampleResultContext the context used to initialize the provider; must be an instance of {@link SampleResultPointContext}.
2022
*/
2123
public SampleResultPointProvider(SampleResultPointContext sampleResultContext) {
2224
this.sampleResultContext = sampleResultContext;
2325
}
2426

2527
/**
26-
* Gets {@link Point}, returns the OK or KO jmeter point, depends from the sample result.
27-
* @return {@link Point} to save.
28+
* Retrieves a {@link Point} based on the sample result.
29+
* The returned point is marked as either "pass" or "fail" depending on the error count of the sample result.
30+
*
31+
* @return the {@link Point} representing the result of the sample; the point is tagged with "pass" if there are no errors,
32+
* or "fail" if there are errors.
2833
*/
2934
public Point getPoint() {
3035
Point point = this.getDefaultPoint();
@@ -40,9 +45,12 @@ public Point getPoint() {
4045
}
4146

4247
/**
43-
* Gets the error body to be saved in the point.
44-
* @param isToBeSaved set to true if body need to be saved; otherwise false.
45-
* @return the normalized string if parameter @param isToBeSaved set to true; 'noData' string otherwise.
48+
* Retrieves the error body to be saved in the point.
49+
*
50+
* @param isToBeSaved if true, the error body will be saved; if false, 'noData' will be returned.
51+
* @param isSuccessful if true, the error body will be retrieved; otherwise 'noData' will be returned.
52+
* @return the error body as a normalized string if {@code isToBeSaved} and {@code isSuccessful} are true;
53+
* otherwise returns 'noData'.
4654
*/
4755
private String getErrorBodyToBeSaved(boolean isToBeSaved, boolean isSuccessful)
4856
{

0 commit comments

Comments
 (0)