zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iv...@apache.org
Subject svn commit: r1640597 - in /zookeeper/bookkeeper/trunk: ./ bookkeeper-stats-providers/codahale-metrics-provider/ bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/ bookkeeper-stats-providers/codahale-metrics-...
Date Wed, 19 Nov 2014 17:00:11 GMT
Author: ivank
Date: Wed Nov 19 17:00:11 2014
New Revision: 1640597

URL: http://svn.apache.org/r1640597
Log:
BOOKKEEPER-797: IllegalArgumentException when calling CodahaleOpStatsLogger#toOpStatsData()

Added:
    zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/test/
    zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/test/java/
    zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/test/java/org/
    zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/test/java/org/apache/
    zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/test/java/org/apache/bookkeeper/
    zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/test/java/org/apache/bookkeeper/stats/
    zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/test/java/org/apache/bookkeeper/stats/CodahaleOpStatsTest.java
Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/pom.xml
    zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleOpStatsLogger.java

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1640597&r1=1640596&r2=1640597&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Wed Nov 19 17:00:11 2014
@@ -12,6 +12,8 @@ Trunk (unreleased changes)
 
       BOOKKEEPER-793: Move to java 7
 
+      BOOKKEEPER-797: IllegalArgumentException when calling CodahaleOpStatsLogger#toOpStatsData()
+
     IMPROVEMENTS:
 
 Release 4.3.0 - 2014-10-03

Modified: zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/pom.xml
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/pom.xml?rev=1640597&r1=1640596&r2=1640597&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/pom.xml
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/pom.xml
Wed Nov 19 17:00:11 2014
@@ -58,5 +58,11 @@
       <artifactId>guava</artifactId>
       <version>${guava.version}</version>
     </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.8.1</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 </project>

Modified: zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleOpStatsLogger.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleOpStatsLogger.java?rev=1640597&r1=1640596&r2=1640597&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleOpStatsLogger.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleOpStatsLogger.java
Wed Nov 19 17:00:11 2014
@@ -61,7 +61,7 @@ class CodahaleOpStatsLogger implements O
         long[] latenciesMillis = new long[default_percentiles.length];
         Arrays.fill(latenciesMillis, Long.MAX_VALUE);
         for (int i = 0; i < default_percentiles.length; i++) {
-            latenciesMillis[i] = (long)s.getValue(default_percentiles[i]);
+            latenciesMillis[i] = (long)s.getValue(default_percentiles[i]/100);
         }
         return new OpStatsData(numSuccess, numFailed, avgLatencyMillis, latenciesMillis);
     }

Added: zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/test/java/org/apache/bookkeeper/stats/CodahaleOpStatsTest.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/test/java/org/apache/bookkeeper/stats/CodahaleOpStatsTest.java?rev=1640597&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/test/java/org/apache/bookkeeper/stats/CodahaleOpStatsTest.java
(added)
+++ zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/test/java/org/apache/bookkeeper/stats/CodahaleOpStatsTest.java
Wed Nov 19 17:00:11 2014
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.bookkeeper.stats;
+
+import static org.junit.Assert.*;
+
+public class CodahaleOpStatsTest {
+
+    @org.junit.Test
+    public void testToOpStatsData() {
+        OpStatsLogger logger = new CodahaleMetricsProvider().getStatsLogger("test").getOpStatsLogger("testLogger");
+        logger.registerSuccessfulEvent(1);
+        // the following should not throw any exception
+        OpStatsData statsData = logger.toOpStatsData();
+        assertEquals(1, statsData.getNumSuccessfulEvents());
+    }
+}



Mime
View raw message