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 Fri, 27 Jul 2018 20:00:29 GMT
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/315#discussion_r205884048
  
    --- Diff: phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java
---
    @@ -204,6 +219,39 @@ private static void resetGlobalMetrics() {
             }
         }
     
    +    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);
    +        }
    +        return false;
    +    }
    +
    +    private boolean verifyMetricsFromSinkOnce(Map<String, Long> expectedMetrics)
{
    +        synchronized (GlobalPhoenixMetricsTestSink.lock) {
    --- End diff --
    
    If it were me, I would have used a Queue or something to save off the metrics, but there's
nothing wrong with your approach here :)


---

Mime
View raw message