You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by si...@apache.org on 2018/12/12 01:14:59 UTC

[bookkeeper] branch master updated: [STATS] [DOC] Add @StatsDoc annotation for entrylogger stats

This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new e5cf9d4  [STATS] [DOC] Add @StatsDoc annotation for entrylogger stats
e5cf9d4 is described below

commit e5cf9d4fe575bbb24fbd08d142a820362763b327
Author: Sijie Guo <gu...@gmail.com>
AuthorDate: Wed Dec 12 09:14:54 2018 +0800

    [STATS] [DOC] Add @StatsDoc annotation for entrylogger stats
    
    Descriptions of the changes in this PR:
    
    *Motivation*
    
    As part of [BP-36](https://github.com/apache/bookkeeper/issues/1785),
    this PR is to document the entrylogger stats.
    
    *Changes*
    
    - convert entrylogger stats to use StatsDoc for documenting metrics
    
    Master Issue: #1785
    
    
    
    
    Reviewers: Enrico Olivelli <eo...@gmail.com>, Jia Zhai <None>
    
    This closes #1871 from sijie/document_ledgerstorage_stats
---
 .../EntryLogManagerForEntryLogPerLedger.java       | 29 ++++++++++++++++++++++
 .../org/apache/bookkeeper/bookie/EntryLogger.java  |  4 ---
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogManagerForEntryLogPerLedger.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogManagerForEntryLogPerLedger.java
index 8093b53..5e123dc 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogManagerForEntryLogPerLedger.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogManagerForEntryLogPerLedger.java
@@ -21,6 +21,8 @@
 
 package org.apache.bookkeeper.bookie;
 
+import static org.apache.bookkeeper.bookie.BookKeeperServerStats.CATEGORY_SERVER;
+import static org.apache.bookkeeper.bookie.BookKeeperServerStats.ENTRYLOGGER_SCOPE;
 import static org.apache.bookkeeper.bookie.BookKeeperServerStats.ENTRYLOGS_PER_LEDGER;
 import static org.apache.bookkeeper.bookie.BookKeeperServerStats.NUM_LEDGERS_HAVING_MULTIPLE_ENTRYLOGS;
 import static org.apache.bookkeeper.bookie.BookKeeperServerStats.NUM_OF_WRITE_ACTIVE_LEDGERS;
@@ -61,6 +63,7 @@ import org.apache.bookkeeper.conf.ServerConfiguration;
 import org.apache.bookkeeper.stats.Counter;
 import org.apache.bookkeeper.stats.OpStatsLogger;
 import org.apache.bookkeeper.stats.StatsLogger;
+import org.apache.bookkeeper.stats.annotations.StatsDoc;
 import org.apache.bookkeeper.util.IOUtils;
 import org.apache.bookkeeper.util.MathUtils;
 import org.apache.bookkeeper.util.collections.ConcurrentLongHashMap;
@@ -115,11 +118,37 @@ class EntryLogManagerForEntryLogPerLedger extends EntryLogManagerBase {
         }
     }
 
+    @StatsDoc(
+        name = ENTRYLOGGER_SCOPE,
+        category = CATEGORY_SERVER,
+        help = "EntryLogger related stats"
+    )
     class EntryLogsPerLedgerCounter {
+
+        @StatsDoc(
+            name = NUM_OF_WRITE_ACTIVE_LEDGERS,
+            help = "Number of write active ledgers"
+        )
         private final Counter numOfWriteActiveLedgers;
+        @StatsDoc(
+            name = NUM_OF_WRITE_LEDGERS_REMOVED_CACHE_EXPIRY,
+            help = "Number of write ledgers removed after cache expiry"
+        )
         private final Counter numOfWriteLedgersRemovedCacheExpiry;
+        @StatsDoc(
+            name = NUM_OF_WRITE_LEDGERS_REMOVED_CACHE_MAXSIZE,
+            help = "Number of write ledgers removed due to reach max cache size"
+        )
         private final Counter numOfWriteLedgersRemovedCacheMaxSize;
+        @StatsDoc(
+            name = NUM_LEDGERS_HAVING_MULTIPLE_ENTRYLOGS,
+            help = "Number of ledgers having multiple entry logs"
+        )
         private final Counter numLedgersHavingMultipleEntrylogs;
+        @StatsDoc(
+            name = ENTRYLOGS_PER_LEDGER,
+            help = "The distribution of number of entry logs per ledger"
+        )
         private final OpStatsLogger entryLogsPerLedger;
         /*
          * ledgerIdEntryLogCounterCacheMap cache will be used to store count of
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
index f5913b3..6b41b6c 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
@@ -82,9 +82,6 @@ public class EntryLogger {
     @VisibleForTesting
     static final int UNINITIALIZED_LOG_ID = -0xDEAD;
 
-    // Expose Stats
-    private final StatsLogger statsLogger;
-
     static class BufferedLogChannel extends BufferedChannel {
         private final long logId;
         private final EntryLogMetadata entryLogMetadata;
@@ -375,7 +372,6 @@ public class EntryLogger {
         this.recentlyCreatedEntryLogsStatus = new RecentEntryLogsStatus(logId + 1);
         this.entryLoggerAllocator = new EntryLoggerAllocator(conf, ledgerDirsManager, recentlyCreatedEntryLogsStatus,
                 logId);
-        this.statsLogger = statsLogger;
         if (entryLogPerLedgerEnabled) {
             this.entryLogManager = new EntryLogManagerForEntryLogPerLedger(conf, ledgerDirsManager,
                     entryLoggerAllocator, listeners, recentlyCreatedEntryLogsStatus, statsLogger);