CrynetLogistics commented on a change in pull request #17687:
URL: https://github.com/apache/flink/pull/17687#discussion_r743542460
##########
File path:
flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/writer/AsyncSinkWriter.java
##########
@@ -172,6 +229,15 @@ public AsyncSinkWriter(
this.inFlightRequestsCount = 0;
this.bufferedRequestEntriesTotalSizeInBytes = 0;
+
+ this.metrics = context.metricGroup();
+ this.metrics.setCurrentSendTimeGauge(
+ () -> {
+ long time = this.ackTime - this.lastSendTimestamp;
+ return time < 0 ? this.lastSendDuration : time;
Review comment:
It's true, race conditions between the in-flight requests occurs. I've
modified it such that updates to `ackTime` and `lastSendTimestamp` occur in the
same single threaded block now. `lastSendDuration` has been removed since it's
not necessary. Added a test to prove too.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]