[ 
https://issues.apache.org/jira/browse/KAFKA-15636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17928493#comment-17928493
 ] 

Shivsundar R edited comment on KAFKA-15636 at 2/19/25 4:30 PM:
---------------------------------------------------------------

Hi [~kirktrue] , I was looking into this. Yes expectedBytes is calculated as 
total instead of avg.
{code:java}
assertEquals(expectedBytes, (Double) fetchSizeAverage.metricValue(), 
EPSILON);{code}
In *{color:#172b4d}testFetchResponseMetrics{color}* we are building a single 
fetch request to 2 topics. So here *fetchSizeAvg* would be same as 
*bytesConsumedTotal.* Hence the test passes.
{code:java}
/* Client level */
String groupName = metricGrpPrefix + "-fetch-manager-metrics";

this.fetchSizeAvg = new MetricNameTemplate("fetch-size-avg", groupName,
        "The average number of bytes fetched per request", tags);

this.fetchSizeMax = new MetricNameTemplate("fetch-size-max", groupName,
        "The maximum number of bytes fetched per request", tags);
this.bytesConsumedRate = new MetricNameTemplate("bytes-consumed-rate", 
groupName,
        "The average number of bytes consumed per second", tags);
this.bytesConsumedTotal = new MetricNameTemplate("bytes-consumed-total", 
groupName,
        "The total number of bytes consumed", tags); {code}
{color:#172b4d}Should I add another fetch request in the test, then testing for 
fetchSizeAvg would make sense, else we can change this metric check to 
*bytes-consumed-total* instead of *fetch-size-avg,*  then it would make more 
sense for the existing test.{color}


was (Author: JIRAUSER303745):
Hi [~kirktrue] , I was looking into this. Yes expectedBytes is calculated as 
total instead of avg.
{code:java}
assertEquals(expectedBytes, (Double) fetchSizeAverage.metricValue(), 
EPSILON);{code}
In {color:#172b4d}testFetchResponseMetrics{color} *we are building a single 
fetch request to 2 topics. So here *fetchSizeAvg* would be same as 
*bytesConsumedTotal.* Hence the test passes.
{code:java}
/* Client level */
String groupName = metricGrpPrefix + "-fetch-manager-metrics";

this.fetchSizeAvg = new MetricNameTemplate("fetch-size-avg", groupName,
        "The average number of bytes fetched per request", tags);

this.fetchSizeMax = new MetricNameTemplate("fetch-size-max", groupName,
        "The maximum number of bytes fetched per request", tags);
this.bytesConsumedRate = new MetricNameTemplate("bytes-consumed-rate", 
groupName,
        "The average number of bytes consumed per second", tags);
this.bytesConsumedTotal = new MetricNameTemplate("bytes-consumed-total", 
groupName,
        "The total number of bytes consumed", tags); {code}
{color:#172b4d}Should I add another fetch request in the test, then testing for 
fetchSizeAvg would make sense, else we can change this metric check to 
*bytes-consumed-total* instead of *fetch-size-avg,*  then it would make more 
sense for the existing test.{color}

> Investigate FetcherTest's/FetchRequestManager's testFetchResponseMetrics
> ------------------------------------------------------------------------
>
>                 Key: KAFKA-15636
>                 URL: https://issues.apache.org/jira/browse/KAFKA-15636
>             Project: Kafka
>          Issue Type: Test
>          Components: clients, consumer, unit tests
>            Reporter: Kirk True
>            Assignee: Shivsundar R
>            Priority: Minor
>              Labels: consumer-threading-refactor, fetcher, unit-tests
>
> {{expectedBytes}} is calculated as total, instead of avg. Is this correct?



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

Reply via email to