Skip to content

Commit ca90d53

Browse files
Development (#24)
Updated influxdb-client-java to -> 3.2.0 and gradle version to -> 7.0
1 parent fb8875f commit ca90d53

File tree

5 files changed

+173
-86
lines changed

5 files changed

+173
-86
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 102 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,65 @@
1-
apply plugin: 'java'
2-
apply plugin: 'eclipse'
1+
plugins {
2+
id 'com.github.johnrengelman.shadow' version "7.0.0"
3+
id 'java'
4+
id 'project-report'
5+
id 'idea'
6+
}
7+
8+
repositories {
9+
mavenCentral()
10+
{
11+
12+
mavenCentral()
13+
}
14+
}
315

416
sourceCompatibility = 11
5-
version = '1.1'
17+
version = '1.2'
618
def title = 'JMeterInfluxDBListener'
719
def archiveName = 'jmeter-plugin-influxdb2-listener'
820

9-
repositories {
10-
11-
mavenCentral()
12-
}
1321

1422
// There's a bug in JMeter leaving extra metadata right now. This is a workaround.
15-
class JMeterRule implements ComponentMetadataRule {
16-
void execute(ComponentMetadataContext context) {
17-
context.details.allVariants {
18-
withDependencies {
19-
removeAll { it.group == "org.apache.jmeter" && it.name == "bom" }
20-
}
21-
}
22-
}
23-
}
23+
class JMeterRule implements ComponentMetadataRule {
24+
void execute(ComponentMetadataContext context) {
25+
context.details.allVariants {
26+
withDependencies {
27+
removeAll { it.group == "org.apache.jmeter" && it.name == "bom" }
28+
}
29+
}
30+
}
31+
}
2432

25-
dependencies {
26-
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_core', version: '5.4.1'
27-
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_java', version: '5.4.1'
28-
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_components', version: '5.4.1'
29-
implementation group: 'org.apache.jmeter', name: 'jorphan', version: '5.4.1'
30-
implementation group: 'com.influxdb', name: 'influxdb-client-java', version: '2.0.0'
31-
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
33+
dependencies {
34+
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_core', version: '5.4.1'
35+
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_java', version: '5.4.1'
36+
implementation group: 'org.apache.jmeter', name: 'ApacheJMeter_components', version: '5.4.1'
37+
implementation group: 'org.apache.jmeter', name: 'jorphan', version: '5.4.1'
38+
implementation group: 'com.influxdb', name: 'influxdb-client-java', version: '3.2.0'
39+
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
3240

33-
components {
34-
withModule("org.apache.jmeter:ApacheJMeter_core", JMeterRule)
35-
withModule("org.apache.jmeter:ApacheJMeter_java", JMeterRule)
36-
withModule("org.apache.jmeter:ApacheJMeter_components", JMeterRule)
37-
withModule("org.apache.jmeter:jorphan", JMeterRule)
38-
withModule("org.apache.jmeter:ApacheJMeter", JMeterRule)
39-
}
40-
}
4141

42-
jar {
43-
manifest {
44-
attributes 'Implementation-Title': title,
45-
'Implementation-Version': archiveVersion,
46-
'Main-Class': 'org.md.jmeter.influxdb.visualizer.JMeterInfluxDBBackendListenerClient'
47-
}
48-
}
42+
components {
43+
withModule("org.apache.jmeter:ApacheJMeter_core", JMeterRule)
44+
withModule("org.apache.jmeter:ApacheJMeter_java", JMeterRule)
45+
withModule("org.apache.jmeter:ApacheJMeter_components", JMeterRule)
46+
withModule("org.apache.jmeter:jorphan", JMeterRule)
47+
withModule("org.apache.jmeter:ApacheJMeter", JMeterRule)
48+
}
49+
}
4950

50-
task fatJar(type: Jar) {
51-
manifest.from jar.manifest
52-
53-
archiveBaseName = archiveName
54-
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
51+
jar {
5552

56-
from {
57-
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
58-
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
53+
manifest {
54+
attributes 'Implementation-Title': title,
55+
'Implementation-Version': archiveVersion,
56+
'Main-Class': 'org.md.jmeter.influxdb.visualizer.JMeterInfluxDBBackendListenerClient'
57+
}
58+
}
5959

60-
} {
61-
exclude "META-INF/*.SF"
62-
exclude "META-INF/*.DSA"
63-
exclude "META-INF/*.RSA"
64-
}
65-
with jar
60+
shadowJar {
61+
archiveBaseName.set(archiveName)
62+
manifest {
63+
inheritFrom project.tasks.jar.manifest
64+
}
6665
}

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

src/main/java/org/md/jmeter/influxdb2/visualizer/influxdb/client/InfluxDatabaseClient.java

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,23 @@ public InfluxDatabaseClient(BackendListenerContext context, Logger logger) {
3535
*/
3636
public void setupInfluxClient() {
3737

38-
this.influxDB = InfluxDBClientFactory.
39-
create(this.influxDBConfig.getInfluxDBURL(),
40-
this.influxDBConfig.getInfluxToken().toCharArray(),
41-
this.influxDBConfig.getInfluxOrganization(),
42-
this.influxDBConfig.getInfluxBucket());
38+
LOGGER.info("InfluxDBClientFactory is going to use the following properties:");
39+
LOGGER.info("URL --> " + this.influxDBConfig.getInfluxDBURL());
40+
LOGGER.info("Token --> " + this.influxDBConfig.getInfluxToken());
41+
LOGGER.info("Organization --> " + this.influxDBConfig.getInfluxOrganization());
42+
LOGGER.info("Bucket --> " + this.influxDBConfig.getInfluxBucket());
43+
44+
try {
45+
this.influxDB = InfluxDBClientFactory.
46+
create(this.influxDBConfig.getInfluxDBURL(),
47+
this.influxDBConfig.getInfluxToken().toCharArray(),
48+
this.influxDBConfig.getInfluxOrganization(),
49+
this.influxDBConfig.getInfluxBucket());
50+
}
51+
catch (Exception e)
52+
{
53+
LOGGER.error("Failed to create client", e);
54+
}
4355
}
4456

4557
/**
@@ -49,15 +61,10 @@ public void setupInfluxClient() {
4961
public void write(Point point) {
5062

5163
// Write by Data Point
52-
try (WriteApi writeApi = this.influxDB.getWriteApi()) {
64+
try (WriteApi writeApi = this.influxDB.makeWriteApi()) {
5365

5466
writeApi.writePoint(point);
5567
}
56-
57-
catch (Exception e)
58-
{
59-
LOGGER.error("Failed writing to influx", e);
60-
}
6168
}
6269

6370
public void close()

0 commit comments

Comments
 (0)