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_r328194034
##########
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);
Review comment:
Time unit should be `TimeUnit.MILLISECONDS`.
Also, the line is a little bit too long. I suggest to reformat it like the
following (also inlining the config keys lookups):
```java
OkHttpClient.Builder client = new OkHttpClient.Builder()
.connectTimeout(getInteger(config, CONNECT_TIMEOUT),
TimeUnit.MILLISECONDS)
.writeTimeout(getInteger(config, WRITE_TIMEOUT),
TimeUnit.MILLISECONDS);
```
----------------------------------------------------------------
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