[ 
https://issues.apache.org/jira/browse/HDFS-15711?focusedWorklogId=522409&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-522409
 ]

ASF GitHub Bot logged work on HDFS-15711:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Dec/20 19:54
            Start Date: 09/Dec/20 19:54
    Worklog Time Spent: 10m 
      Work Description: jbrennan333 commented on a change in pull request #2521:
URL: https://github.com/apache/hadoop/pull/2521#discussion_r539601616



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/fs/http/server/TestHttpFSServer.java
##########
@@ -120,6 +122,25 @@
  */
 public class TestHttpFSServer extends HFSTestCase {
 
+  /**
+   * define metric getters for unit tests.
+   */
+  private static Callable<Long> defaultEntryMetricGetter = () -> 0L;
+  private static Callable<Long> defaultExitMetricGetter = () -> 1L;
+  private static HashMap<String, Callable<Long>> metricsGetter =
+      new HashMap<String, Callable<Long>>() {
+        {
+          put("LISTSTATUS",
+              () -> HttpFSServerWebApp.get().getMetrics().getOpsListing());
+          put("MKDIRS",
+              () -> HttpFSServerWebApp.get().getMetrics().getOpsMkdir());
+          put("GETFILESTATUS",
+              () -> HttpFSServerWebApp.get().getMetrics().getOpsStat());
+        }
+      };
+

Review comment:
       Oh I see that makes sense for `getStatus()`.  I was looking at 
`testMkdirs() `when I was trying to understand why you were using it, and it 
didn't make sense to me.  I don't think you should use the metricsGetter in 
`testMkdirs()`, or at least not use `getOrDefault()` - the default case here 
does not make sense - it renders that part of the test meaningless.  I'd prefer 
to just get the ops directly in this case.
   




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 522409)
    Time Spent: 1h 20m  (was: 1h 10m)

> Add Metrics to HttpFS Server
> ----------------------------
>
>                 Key: HDFS-15711
>                 URL: https://issues.apache.org/jira/browse/HDFS-15711
>             Project: Hadoop HDFS
>          Issue Type: New Feature
>          Components: httpfs
>            Reporter: Ahmed Hussein
>            Assignee: Ahmed Hussein
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Currently HttpFS Server does not have any metrics.
> [~kihwal] has implemented serverMetrics for HttpFs on our internal grid.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to