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

ASF GitHub Bot commented on HDFS-17684:
---------------------------------------

balodesecurity opened a new pull request, #8317:
URL: https://github.com/apache/hadoop/pull/8317

   ## Summary
   
   `DataNodeMetrics` already tracks `WritesFromLocalClient` / 
`WritesFromRemoteClient` (count only) and `RemoteBytesRead` / 
`RemoteBytesWritten` (bytes), but there is no byte-level metric for **local** 
client reads/writes.
   
   This patch adds two new `MutableCounterLong` metrics:
   
   | Metric | Description |
   |---|---|
   | `LocalBytesRead` | Bytes read by local (same-host) clients |
   | `LocalBytesWritten` | Bytes written by local (same-host) clients |
   
   These are incremented in `incrReadsFromClient(boolean local, long size)` and 
`incrWritesFromClient(boolean local, long size)` alongside the existing 
remote-bytes counters, so no call-site changes are required.
   
   ## Changes
   
   - `DataNodeMetrics.java` — added `localBytesRead` / `localBytesWritten` 
fields and updated `incrReadsFromClient` / `incrWritesFromClient` to increment 
them
   - `TestDataNodeMetrics.java` — added `testLocalBytesMetrics` which spins up 
a `MiniDFSCluster`, writes then reads a file from the local client, and asserts 
both new counters are positive while the remote-bytes counters remain zero
   
   ## Testing
   
   | Test class | Test method | Result | Duration |
   |---|---|---|---|
   | `TestDataNodeMetrics` | `testLocalBytesMetrics` | PASSED | 2.391 s |




> Add bytes written and read by local client.
> -------------------------------------------
>
>                 Key: HDFS-17684
>                 URL: https://issues.apache.org/jira/browse/HDFS-17684
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: datanode
>            Reporter: fuchaohong
>            Priority: Major
>              Labels: pull-request-available
>
> Add bytes written and read by local client.
> |LocalBytesRead|Number of bytes read by local clients|
> |LocalBytesWritten|Number of bytes written by local clients|
>  
>  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to