[ https://issues.apache.org/jira/browse/HDFS-7331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14200880#comment-14200880 ]
Haohui Mai commented on HDFS-7331: ---------------------------------- Thanks for the work. Some comments: {code} + final int dncCacheMaxSize = + conf.getInt(DFS_DATANODE_NETWORK_COUNTS_CACHE_MAX_SIZE_KEY, + DFS_DATANODE_NETWORK_COUNTS_CACHE_MAX_SIZE_DEFAULT) ; {code} Is there a reason to make it configurable? Maybe we can first experiment with a reasonable default value, and make it configurable later. {code} + @InterfaceAudience.Private + public static class NetworkStatsServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + @Override + public void doGet(HttpServletRequest request, + HttpServletResponse response) throws IOException { + response.setContentType("text/plain"); + + final DataNode datanode = (DataNode) + getServletContext().getAttribute("datanode"); + final Map<String, Map<String, Long>> dnc = + datanode.getDatanodeNetworkCounts(); + + final StringBuilder buffer = new StringBuilder(8*1024); + buffer.append("Network counters for datanode "). + append(datanode.getDisplayName()).append(":\n"); + for (Map.Entry<String, Map<String, Long>> ent : dnc.entrySet()) { + buffer.append(ent.getKey()).append(":\n"); + for (Map.Entry<String, Long> ent2 : ent.getValue().entrySet()) { + buffer.append(String.format(" %-26s : %8s\n", + ent2.getKey(), ent2.getValue())); + } + } + buffer.append("\n"); + response.getWriter().write(buffer.toString()); + } + } + {code} Does the stats servlet return the exact value of {{getDatanodeNetworkCounts()}}? If so we can get rid of it. > Add Datanode network counts to datanode jmx page > ------------------------------------------------ > > Key: HDFS-7331 > URL: https://issues.apache.org/jira/browse/HDFS-7331 > Project: Hadoop HDFS > Issue Type: Improvement > Components: datanode > Reporter: Charles Lamb > Assignee: Charles Lamb > Priority: Minor > Attachments: HDFS-7331.001.patch, HDFS-7331.002.patch > > > Add per-datanode counts to the datanode jmx page. For example, networkErrors > could be exposed like this: > {noformat} > }, { > ... > "DatanodeNetworkCounts" : "{\"dn1\":{\"networkErrors\":1}}", > ... > "NamenodeAddresses" : > "{\"localhost\":\"BP-1103235125-127.0.0.1-1415057084497\"}", > "VolumeInfo" : > "{\"/tmp/hadoop-cwl/dfs/data/current\":{\"freeSpace\":3092725760,\"usedSpace\":28672,\"reservedSpace\":0}}", > "ClusterId" : "CID-4b38f2ae-5e58-4e15-b3cf-3ba3f46e724e" > }, { > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)