diff --git a/build.gradle b/build.gradle index 9a47cb6..377d77f 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'java' apply plugin: 'eclipse' sourceCompatibility = 1.7 -version = '1.2x' +version = '1.2.1' def title = 'JMeterInfluxDBListener' jar { diff --git a/src/main/java/rocks/nt/apm/jmeter/config/influxdb/InfluxDBConfig.java b/src/main/java/rocks/nt/apm/jmeter/config/influxdb/InfluxDBConfig.java index 50ab86f..57964b1 100644 --- a/src/main/java/rocks/nt/apm/jmeter/config/influxdb/InfluxDBConfig.java +++ b/src/main/java/rocks/nt/apm/jmeter/config/influxdb/InfluxDBConfig.java @@ -21,6 +21,11 @@ public class InfluxDBConfig { */ public static final String DEFAULT_RETENTION_POLICY = "autogen"; + /** + * Default http scheme name. + */ + public static final String DEFAULT_HTTP_SCHEME = "http"; + /** * Default port. */ @@ -55,6 +60,11 @@ public class InfluxDBConfig { * Config key for retention policy name. */ public static final String KEY_RETENTION_POLICY = "retentionPolicy"; + + /** + * Config key for http scheme. + */ + public static final String KEY_HTTP_SCHEME = "influxHTTPScheme"; /** * InfluxDB Host. @@ -85,6 +95,11 @@ public class InfluxDBConfig { * InfluxDB Port. */ private int influxDBPort; + + /** + * InfluxDB database retention policy. + */ + private String influxHTTPScheme; public InfluxDBConfig(BackendListenerContext context) { String influxDBHost = context.getParameter(KEY_INFLUX_DB_HOST); @@ -113,6 +128,13 @@ public InfluxDBConfig(BackendListenerContext context) { influxRetentionPolicy = DEFAULT_RETENTION_POLICY; } setInfluxRetentionPolicy(influxRetentionPolicy); + + String influxHTTPScheme = context.getParameter(KEY_HTTP_SCHEME, DEFAULT_HTTP_SCHEME); + if (StringUtils.isEmpty(influxHTTPScheme)) { + influxHTTPScheme = DEFAULT_HTTP_SCHEME; + } + // TODO: no checks but should be only "http" and "https" + setInfluxHTTPScheme(influxHTTPScheme); } /** @@ -121,7 +143,7 @@ public InfluxDBConfig(BackendListenerContext context) { * @return influxDB URL. */ public String getInfluxDBURL() { - return "http://" + influxDBHost + ":" + influxDBPort; + return influxHTTPScheme + "://" + influxDBHost + ":" + influxDBPort; } /** @@ -199,6 +221,14 @@ public void setInfluxRetentionPolicy(String influxRetentionPolicy) { this.influxRetentionPolicy = influxRetentionPolicy; } + /** + * @param influxHTTPScheme + * the influxHTTPScheme to set + */ + public void setInfluxHTTPScheme(String influxHTTPScheme) { + this.influxHTTPScheme = influxHTTPScheme; + } + /** * @return the influxDBPort */