bookkeeper-distributedlog-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject [02/29] incubator-distributedlog git commit: use zero padded partition strings in stats
Date Wed, 21 Dec 2016 08:00:10 GMT
use zero padded partition strings in stats

RB_ID=833803


Project: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/commit/00919605
Tree: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/tree/00919605
Diff: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/diff/00919605

Branch: refs/heads/merge/DL-98
Commit: 00919605f1bfa3f3e0c8514dc63552df4eeb3cc2
Parents: 904b898
Author: Jordan Bull <jbull@twitter.com>
Authored: Wed May 18 10:18:34 2016 -0700
Committer: Sijie Guo <sijieg@twitter.com>
Committed: Mon Dec 12 16:17:02 2016 -0800

----------------------------------------------------------------------
 .../twitter/distributedlog/service/stream/StreamOpStats.java | 5 +++--
 .../twitter/distributedlog/service/streamset/Partition.java  | 8 ++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/00919605/distributedlog-service/src/main/java/com/twitter/distributedlog/service/stream/StreamOpStats.java
----------------------------------------------------------------------
diff --git a/distributedlog-service/src/main/java/com/twitter/distributedlog/service/stream/StreamOpStats.java
b/distributedlog-service/src/main/java/com/twitter/distributedlog/service/stream/StreamOpStats.java
index 2a44d88..bfbc88c 100644
--- a/distributedlog-service/src/main/java/com/twitter/distributedlog/service/stream/StreamOpStats.java
+++ b/distributedlog-service/src/main/java/com/twitter/distributedlog/service/stream/StreamOpStats.java
@@ -85,8 +85,9 @@ public class StreamOpStats {
 
     public StatsLogger streamRequestStatsLogger(Partition partition) {
         return BroadCastStatsLogger.masterslave(
-            streamStatsLogger.scope(partition.getStream()).scope("partition").scope(Integer.toString(partition.getId())),
-            streamStatsLogger.scope(partition.getStream()).scope("aggregate"));
+            streamStatsLogger.scope(partition.getStream()).scope("partition")
+                .scope(partition.getPaddedId()), streamStatsLogger.scope(partition.getStream())
+                .scope("aggregate"));
     }
 
     public StatsLogger streamRequestScope(Partition partition, String scopeName) {

http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/00919605/distributedlog-service/src/main/java/com/twitter/distributedlog/service/streamset/Partition.java
----------------------------------------------------------------------
diff --git a/distributedlog-service/src/main/java/com/twitter/distributedlog/service/streamset/Partition.java
b/distributedlog-service/src/main/java/com/twitter/distributedlog/service/streamset/Partition.java
index f207eee..d199f88 100644
--- a/distributedlog-service/src/main/java/com/twitter/distributedlog/service/streamset/Partition.java
+++ b/distributedlog-service/src/main/java/com/twitter/distributedlog/service/streamset/Partition.java
@@ -57,6 +57,14 @@ public class Partition {
         return id;
     }
 
+    /**
+     * Get the 6 digit 0 padded id of this partition as a String.
+     * @return partition id
+     */
+    public String getPaddedId() {
+        return String.format("%06d", getId());
+    }
+
     @Override
     public boolean equals(Object o) {
         if (this == o) {


Mime
View raw message