Source:
<code>public LogReplicationEntry read(UUID logEntryRequestId) throws TrimmedException { List<OpaqueEntry> opaqueEntryList = new ArrayList<>(); int currentEntrySize = 0; int currentMsgSize = 0; try { while (currentMsgSize < maxDataSizePerMsg) { if (lastOpaqueEntry != null) { if (lastOpaqueEntryValid) { lastOpaqueEntry = filterTransactionEntry(lastOpaqueEntry); currentEntrySize = ReaderUtility.calculateOpaqueEntrySize(lastOpaqueEntry); if (!checkValidSize(currentMsgSize, currentEntrySize)) { break; } opaqueEntryList.add(lastOpaqueEntry); currentMsgSize += currentEntrySize; } lastOpaqueEntry = null; } if (!txOpaqueStream.hasNext()) { break; } lastOpaqueEntry = txOpaqueStream.next(); deltaCounter.ifPresent(Counter::increment); lastOpaqueEntryValid = isValidTransactionEntry(lastOpaqueEntry); currentProcessedEntryMetadata = new StreamIteratorMetadata(txOpaqueStream.txStream.pos(), lastOpaqueEntryValid); } log.trace("Generate LogEntryDataMessage size with entries for maxDataSizePerMsg {}. lastEntry size {}", <START> currentMsgSize, opaqueEntryList.size(), maxDataSizePerMsg, lastOpaqueEntry == null ? 0 : currentEntrySize); <END> final double currentMsgSizeSnapshot = currentMsgSize; messageSizeDistributionSummary.ifPresent(distribution -> distribution.record(currentMsgSizeSnapshot)); if (opaqueEntryList.isEmpty()) { return null; } LogReplicationEntry txMessage = generateMessageWithOpaqueEntryList(opaqueEntryList, logEntryRequestId); return txMessage; } catch (Exception e) { log.warn("Caught an exception while reading transaction stream {}", e); throw e; } }</code><technical_language>this, another good metric expose is in average opaque entries message... opaqueEntryList.size()</technical_language>

Target:
public LogReplicationEntry read(UUID logEntryRequestId) throws TrimmedException { List<OpaqueEntry> opaqueEntryList = new ArrayList<>(); int currentEntrySize = 0; int currentMsgSize = 0; try { while (currentMsgSize < maxDataSizePerMsg) { if (lastOpaqueEntry != null) { if (lastOpaqueEntryValid) { lastOpaqueEntry = filterTransactionEntry(lastOpaqueEntry); currentEntrySize = ReaderUtility.calculateOpaqueEntrySize(lastOpaqueEntry); if (!checkValidSize(currentMsgSize, currentEntrySize)) { break; } opaqueEntryList.add(lastOpaqueEntry); currentMsgSize += currentEntrySize; } lastOpaqueEntry = null; } if (!txOpaqueStream.hasNext()) { break; } lastOpaqueEntry = txOpaqueStream.next(); deltaCounter.ifPresent(Counter::increment); lastOpaqueEntryValid = isValidTransactionEntry(lastOpaqueEntry); if (lastOpaqueEntryValid) { validDeltaCounter.ifPresent(Counter::increment); } currentProcessedEntryMetadata = new StreamIteratorMetadata(txOpaqueStream.txStream.pos(), lastOpaqueEntryValid); } log.trace("Generate LogEntryDataMessage size with entries for maxDataSizePerMsg {}. lastEntry size {}", currentMsgSize, opaqueEntryList.size(), maxDataSizePerMsg, lastOpaqueEntry == null ? 0 : currentEntrySize); final double currentMsgSizeSnapshot = currentMsgSize; messageSizeDistributionSummary.ifPresent(distribution -> distribution.record(currentMsgSizeSnapshot)); opaqueEntryCounter.ifPresent(counter -> counter.increment(opaqueEntryList.size())); if (opaqueEntryList.isEmpty()) { return null; } LogReplicationEntry txMessage = generateMessageWithOpaqueEntryList(opaqueEntryList, logEntryRequestId); return txMessage; } catch (Exception e) { log.warn("Caught an exception while reading transaction stream {}", e); throw e; } }