apoorvmittal10 commented on code in PR #18232:
URL: https://github.com/apache/kafka/pull/18232#discussion_r1893842482
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchMetricsManager.java:
##########
@@ -101,32 +105,38 @@ void recordRecordsFetched(int records) {
void recordBytesFetched(String topic, int bytes) {
String name = topicBytesFetchedMetricName(topic);
- Sensor bytesFetched = new SensorBuilder(metrics, name, () ->
topicTags(topic))
- .withAvg(metricsRegistry.topicFetchSizeAvg)
- .withMax(metricsRegistry.topicFetchSizeMax)
- .withMeter(metricsRegistry.topicBytesConsumedRate,
metricsRegistry.topicBytesConsumedTotal)
- .build();
+ maybeRecordDeprecatedBytesFetched(name, topic, bytes);
+
+ Sensor bytesFetched = new SensorBuilder(metrics, name, () ->
Map.of("topic", topic))
+ .withAvg(metricsRegistry.topicFetchSizeAvg)
+ .withMax(metricsRegistry.topicFetchSizeMax)
+ .withMeter(metricsRegistry.topicBytesConsumedRate,
metricsRegistry.topicBytesConsumedTotal)
+ .build();
bytesFetched.record(bytes);
}
void recordRecordsFetched(String topic, int records) {
String name = topicRecordsFetchedMetricName(topic);
- Sensor recordsFetched = new SensorBuilder(metrics, name, () ->
topicTags(topic))
- .withAvg(metricsRegistry.topicRecordsPerRequestAvg)
- .withMeter(metricsRegistry.topicRecordsConsumedRate,
metricsRegistry.topicRecordsConsumedTotal)
- .build();
+ maybeRecordDeprecatedRecordsFetched(name, topic, records);
+
+ Sensor recordsFetched = new SensorBuilder(metrics, name, () ->
Map.of("topic", topic))
+ .withAvg(metricsRegistry.topicRecordsPerRequestAvg)
+ .withMeter(metricsRegistry.topicRecordsConsumedRate,
metricsRegistry.topicRecordsConsumedTotal)
+ .build();
recordsFetched.record(records);
}
void recordPartitionLag(TopicPartition tp, long lag) {
this.recordsLag.record(lag);
String name = partitionRecordsLagMetricName(tp);
- Sensor recordsLag = new SensorBuilder(metrics, name, () ->
topicPartitionTags(tp))
- .withValue(metricsRegistry.partitionRecordsLag)
- .withMax(metricsRegistry.partitionRecordsLagMax)
- .withAvg(metricsRegistry.partitionRecordsLagAvg)
- .build();
+ maybeRecordDeprecatedPartitionLag(name, tp, lag);
+
+ Sensor recordsLag = new SensorBuilder(metrics, name, () ->
mkMap(mkEntry("topic", tp.topic()), mkEntry("partition",
String.valueOf(tp.partition()))))
Review Comment:
Done.
--
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]