jt2594838 commented on code in PR #13105:
URL: https://github.com/apache/iotdb/pull/13105#discussion_r1706556009


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/WritingMetrics.java:
##########
@@ -174,10 +174,24 @@ private void 
unbindFlushSubTaskMetrics(AbstractMetricService metricService) {
   // region wal overview metrics
   public static final String WAL_NODES_NUM = "wal_nodes_num";
   public static final String USED_RATIO = "used_ratio";
+  public static final String SERIALIZED_WAL_BUFFER_SIZE = 
"serialized_wal_buffer_size";
+  public static final String WROTE_WAL_BUFFER_SIZE = "wrote_wal_buffer_size";
+  public static final String WAL_COMPRESS_COST = "wal_compress_cost";
+  public static final String WAL_UNCOMPRESS_COST = "wal_uncompress_cost";
+  public static final String READ_WAL_BUFFER_SIZE = "read_wal_buffer_size";
+  public static final String READ_WAL_BUFFER_COST = "read_wal_buffer_cost";
+  public static final String WRITE_WAL_BUFFER_COST = "write_wal_buffer_cost";

Review Comment:
   It would be better to indicate the units in the names, like 
"READ_WAL_BUFFER_COST_NS", "READ_WAL_BUFFER_SIZE_BYTE".



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/io/WALInputStream.java:
##########
@@ -360,6 +365,23 @@ private SegmentInfo getNextSegmentInfo() throws 
IOException {
     return info;
   }
 
+  private int readWALBufferFromChannel(ByteBuffer buffer) throws IOException {
+    long startTime = System.nanoTime();
+    long startPosition = channel.position();
+    int size = channel.read(buffer);
+    WritingMetrics.getInstance()
+        .recordWALRead(channel.position() - startPosition, System.nanoTime() - 
startTime);

Review Comment:
   How about just using size to avoid calling position().



-- 
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]

Reply via email to