sajjad-moradi commented on code in PR #9249:
URL: https://github.com/apache/pinot/pull/9249#discussion_r950500727


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeConsumptionRateManager.java:
##########
@@ -131,4 +144,22 @@ public void throttle(int numMsgs) {
       return _rate;
     }
   }
+
+  @VisibleForTesting
+  @FunctionalInterface
+  interface PartitionCountFetcher {
+    Integer fetch(StreamConfig streamConfig);
+  }
+
+  @VisibleForTesting
+  static final PartitionCountFetcher DEFAULT_PARTITION_COUNT_FETCHER = 
streamConfig -> {
+    String clientId = streamConfig.getTopicName() + 
"-consumption.rate.manager";
+    StreamConsumerFactory factory = 
StreamConsumerFactoryProvider.create(streamConfig);
+    try (StreamMetadataProvider streamMetadataProvider = 
factory.createStreamMetadataProvider(clientId)) {
+      return 
streamMetadataProvider.fetchPartitionCount(/*maxWaitTimeMs*/10_000);
+    } catch (Exception e) {
+      LOGGER.warn("Error fetching metadata for topic " + 
streamConfig.getTopicName(), e);

Review Comment:
   I checked the server side and there's none. I agree we should add one metric 
for when there's a stream connection failures, but IMO that should be a 
separate PR.



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to