1u0 commented on a change in pull request #9773: [FLINK-14210][metrics]support
connect timeout and write timeout confi…
URL: https://github.com/apache/flink/pull/9773#discussion_r328194644
##########
File path:
flink-metrics/flink-metrics-influxdb/src/main/java/org/apache/flink/metrics/influxdb/InfluxdbReporter.java
##########
@@ -77,10 +81,15 @@ public void open(MetricConfig config) {
this.database = database;
this.retentionPolicy = getString(config, RETENTION_POLICY);
+
+ int connectTimeout = getInteger(config, CONNECT_TIMEOUT);
+ int writeTimeout = getInteger(config, WRITE_TIMEOUT);
+ OkHttpClient.Builder client = new
OkHttpClient.Builder().connectTimeout(connectTimeout,
TimeUnit.MICROSECONDS).writeTimeout(writeTimeout, TimeUnit.MICROSECONDS);
+
if (username != null && password != null) {
- influxDB = InfluxDBFactory.connect(url, username,
password);
+ influxDB = InfluxDBFactory.connect(url, username,
password, client, InfluxDB.ResponseFormat.JSON);
Review comment:
There is an overloaded version of `InfluxDBFactory.connect()` method without
the last argument, please use that, so that `InfluxDB.ResponseFormat.JSON`
won't be exposed here.
**Side note:** `influxDB` initialization starts to grow a little bit.
**Optionally**, you can move it's initialization to a dedicated private static
method.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services