imaffe commented on a change in pull request #18816:
URL: https://github.com/apache/flink/pull/18816#discussion_r810455595
##########
File path:
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/sink/writer/PulsarWriter.java
##########
@@ -270,5 +287,40 @@ public void flush(boolean endOfInput) throws IOException,
InterruptedException {
public void close() throws Exception {
// Close all the resources and throw the exception at last.
closeAll(metadataListener, producerRegister);
+ closed = true;
+ }
+
+ private void setupFlinkMetrics() {
+ lastMetricUpdateTimestamp = timeService.getCurrentProcessingTime();
+ registerGlobalGauges();
+ registerMetricUpdateTimer();
+ }
+
+ /**
+ * Producer is lazy initialized in Pulsar Sink. Some metrics (currently
only some gauges) can
+ * only be set after creating the producer. Those gauges are per producer
wise. Some other
+ * metrics is based aggregation of all producers or they are based on sink
implementations so
+ * they are called global gauges.
+ */
+ private void registerGlobalGauges() {
+
pulsarSinkWriterMetrics.setCurrentSendTimeGauge(this::getCurrentSendTime);
+ producerRegister.registerMaxSendLatencyGauges();
+ }
+
+ private void registerMetricUpdateTimer() {
Review comment:
Move these timer tasks to a dedicated class
--
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]