[ 
https://issues.apache.org/jira/browse/GOBBLIN-1934?focusedWorklogId=886874&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-886874
 ]

ASF GitHub Bot logged work on GOBBLIN-1934:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Oct/23 06:02
            Start Date: 24/Oct/23 06:02
    Worklog Time Spent: 10m 
      Work Description: phet commented on code in PR #3805:
URL: https://github.com/apache/gobblin/pull/3805#discussion_r1369650582


##########
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/kafka/HighLevelConsumer.java:
##########
@@ -197,6 +201,22 @@ protected void shutdownMetrics() throws IOException {
    */
   protected void createMetrics() {
     this.messagesRead = 
this.metricContext.counter(RuntimeMetrics.GOBBLIN_KAFKA_HIGH_LEVEL_CONSUMER_MESSAGES_READ);
+    this.queueSizeGauges = new ContextAwareGauge[numThreads];
+    this.queueSizeGaugeValues = new AtomicIntegerArray(numThreads);
+    for (int i=0; i < numThreads; i++) {
+      int finalI = i;
+      this.queueSizeGauges[i] = this.metricContext.newContextAwareGauge(
+          RuntimeMetrics.GOBBLIN_KAFKA_HIGH_LEVEL_CONSUMER_QUEUE_SIZE + "-" + 
i,
+          () -> queueSizeGaugeValues.get(finalI));

Review Comment:
   w/o a comment to explain the rationale, I'm left to wonder: why couldn't 
this be written:
   ```
   () -> queues[finalI].size()
   ```
   ?
   
   that would dispense w/ the need for `queueSizeGaugeValues` and with it the 
potential perf hit of updating that array upon every enqueing.
   
   and on that topic... why is `updateQueueSizes` only recalculated at enqueue 
time, rather than at dequeue time as well?





Issue Time Tracking
-------------------

    Worklog Id:     (was: 886874)
    Time Spent: 50m  (was: 40m)

> Monitor High Level Consumer queue size
> --------------------------------------
>
>                 Key: GOBBLIN-1934
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1934
>             Project: Apache Gobblin
>          Issue Type: Improvement
>          Components: gobblin-service
>            Reporter: Urmi Mustafi
>            Assignee: Abhishek Tiwari
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> We suspect that the HighLevelConsumer class may be dropping Kafka messages if 
> the thread for a particular consumption queue is interrupted or stalled. 
> Before changing how these queues are handled, we want to verify that blocked 
> or dropped queues is the reason for missed messages by emitting metrics about 
> each queue's size. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to