zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] lvfangmin commented on a change in pull request #840: ZOOKEEPER-3143 Pluggable metrics system for ZooKeeper - Data Collection on Server
Date Fri, 15 Mar 2019 06:02:24 GMT
lvfangmin commented on a change in pull request #840:  ZOOKEEPER-3143 Pluggable metrics system
for ZooKeeper - Data Collection on Server
URL: https://github.com/apache/zookeeper/pull/840#discussion_r265856358
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ServerMetrics.java
 ##########
 @@ -15,139 +15,168 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.zookeeper.server;
 
-import org.apache.zookeeper.server.metric.AvgMinMaxCounter;
-import org.apache.zookeeper.server.metric.AvgMinMaxCounterSet;
-import org.apache.zookeeper.server.metric.AvgMinMaxPercentileCounter;
-import org.apache.zookeeper.server.metric.AvgMinMaxPercentileCounterSet;
-import org.apache.zookeeper.server.metric.Metric;
-import org.apache.zookeeper.server.metric.SimpleCounter;
+import org.apache.zookeeper.metrics.Counter;
+import org.apache.zookeeper.metrics.MetricsContext;
+
+import org.apache.zookeeper.metrics.MetricsProvider;
+import org.apache.zookeeper.metrics.Summary;
+import org.apache.zookeeper.metrics.impl.DefaultMetricsProvider;
+import org.apache.zookeeper.metrics.impl.NullMetricsProvider;
+
+public class ServerMetrics {
+
+    /**
+     * Dummy instance useful for tests.
+     */
+    public static final ServerMetrics NULL_METRICS
+            = new ServerMetrics(NullMetricsProvider.INSTANCE);
+
+    /**
+     * Dummy instance useful for tests.
+     */
+    public static final ServerMetrics DEFAULT_METRICS_FOR_TESTS
+            = new ServerMetrics(new DefaultMetricsProvider());
+
+    public ServerMetrics(MetricsProvider metricsProvider) {
+        this.metricsProvider = metricsProvider;
+        MetricsContext metricsContext = this.metricsProvider.getRootContext();
+
+        FSYNC_TIME = metricsContext.getBasicSummary("fsynctime");
+
+        SNAPSHOT_TIME = metricsContext.getBasicSummary("snapshottime");
+        DB_INIT_TIME = metricsContext.getBasicSummary("dbinittime");
+        READ_LATENCY = metricsContext.getSummary("readlatency");
 
 Review comment:
   Not sure this is rich enough to add other kind of metrics we have like the AvgMinMaxPercentileCounterSet
or not, @jhuan31 is upstreaming the other metrics we have, let's get that done and see how
to make it working smoothly with the new MetricProvider here.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message