phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joshelser <...@git.apache.org>
Subject [GitHub] phoenix pull request #315: PHOENIX-3655 Global Phoenix Client Metrics for PQ...
Date Tue, 31 Jul 2018 16:36:17 GMT
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/315#discussion_r206595985
  
    --- Diff: phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java
---
    @@ -204,6 +230,45 @@ private static void resetGlobalMetrics() {
             }
         }
     
    +    // Phoenix Client Metrics are transported via Hadoop-metrics2 sink
    +    // The test sink is defined at GlobalPhoenixMetricsTestSink
    +    // Configuration for Hadoop-metrics2 comes from hadoop-metrics2.properties file located
in test/resources
    +    private boolean verifyMetricsFromSink() throws InterruptedException {
    +        Map<String, Long> expectedMetrics = new HashMap<>();
    +        for (GlobalMetric m : PhoenixRuntime.getGlobalPhoenixClientMetrics()) {
    +            expectedMetrics.put(m.getMetricType().name(), m.getTotalSum());
    +        }
    +
    +        for (int i = 0; i < MAX_RETRIES; i++) {
    +            LOG.info("Verifying Global Metrics from Hadoop Sink, Retry: " + (i + 1));
    +            if (verifyMetricsFromSinkOnce(expectedMetrics)) {
    +                LOG.info("Values from Hadoop Metrics Sink match actual values");
    +                return true;
    +            }
    +            Thread.sleep(1000);
    --- End diff --
    
    Change this to:
    ```
    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
       return false;
    }
    ```
    Then, remove the `throws InterruptedException`.
    We should be catching, re-setting the interrupted state and just returning ASAP. Likely,
this code never gets invoked in a unit-test context, but good practice.


---

Mime
View raw message