Skip to content

Commit

Permalink
Rename bookkeeper metrics to specify OpenMetrics (#3406)
Browse files Browse the repository at this point in the history
### Motivation
See https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md
A COUNTER needs `metrics_name_total` or `metrics_name_created`

This PR contains metric name broken changes.

### Modifications
Rename counter's `_count` to `_total`

### metrics name broken changes
- rename `FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNTER` to `FAILED_TO_RESOLVE_NETWORK_LOCATION_TOTAL`
- rename `ENSEMBLE_NOT_ADHERING_TO_PLACEMENT_POLICY_COUNT` to `ENSEMBLE_NOT_ADHERING_TO_PLACEMENT_POLICY_TOTAL`
- rename `ACTIVE_ENTRY_LOG_COUNT` to `ACTIVE_ENTRY_LOG_TOTAL`
- rename `MAJOR_COMPACTION_COUNT` to `MAJOR_COMPACTION_TOTAL`
- rename `MINOR_COMPACTION_COUNT` to `MINOR_COMPACTION_TOTAL`
- rename `ACTIVE_LEDGER_COUNT` to `ACTIVE_LEDGER_TOTAL`
- rename `DELETED_LEDGER_COUNT` to `DELETED_LEDGER_TOTAL`
- rename `JOURNAL_FORCE_WRITE_GROUPING_COUNT` to `JOURNAL_FORCE_WRITE_GROUPING_TOTAL`

### Also see
- apache/pulsar#13785
- apache/pulsar#16591
- apache/pulsar#16610
- apache/pulsar#16611
  • Loading branch information
ZhangJian He authored Jul 16, 2022
1 parent f0a198e commit ba22bee
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public interface BookKeeperServerStats {
String WATCHER_SCOPE = "bookie_watcher";
String REPLACE_BOOKIE_TIME = "REPLACE_BOOKIE_TIME";
String NEW_ENSEMBLE_TIME = "NEW_ENSEMBLE_TIME";
String FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNTER = "FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNTER";
String ENSEMBLE_NOT_ADHERING_TO_PLACEMENT_POLICY_COUNTER = "ENSEMBLE_NOT_ADHERING_TO_PLACEMENT_POLICY_COUNTER";
String FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNT = "FAILED_TO_RESOLVE_NETWORK_LOCATION_TOTAL";
String ENSEMBLE_NOT_ADHERING_TO_PLACEMENT_POLICY_COUNT = "ENSEMBLE_NOT_ADHERING_TO_PLACEMENT_POLICY_TOTAL";

// Bookie Quarantine Stats
String BOOKIE_QUARANTINE = "BOOKIE_QUARANTINE";
Expand Down Expand Up @@ -148,15 +148,15 @@ public interface BookKeeperServerStats {
String LEDGER_CACHE_MISS = "LEDGER_CACHE_MISS";

// Compaction/Garbage Collection Related Counters
String ACTIVE_ENTRY_LOG_COUNT = "ACTIVE_ENTRY_LOG_COUNT";
String ACTIVE_ENTRY_LOG_COUNT = "ACTIVE_ENTRY_LOG_TOTAL";
String ACTIVE_ENTRY_LOG_SPACE_BYTES = "ACTIVE_ENTRY_LOG_SPACE_BYTES";
String RECLAIMED_COMPACTION_SPACE_BYTES = "RECLAIMED_COMPACTION_SPACE_BYTES";
String RECLAIMED_DELETION_SPACE_BYTES = "RECLAIMED_DELETION_SPACE_BYTES";
String THREAD_RUNTIME = "THREAD_RUNTIME";
String MAJOR_COMPACTION_COUNT = "MAJOR_COMPACTION_COUNT";
String MINOR_COMPACTION_COUNT = "MINOR_COMPACTION_COUNT";
String ACTIVE_LEDGER_COUNT = "ACTIVE_LEDGER_COUNT";
String DELETED_LEDGER_COUNT = "DELETED_LEDGER_COUNT";
String MAJOR_COMPACTION_COUNT = "MAJOR_COMPACTION_TOTAL";
String MINOR_COMPACTION_COUNT = "MINOR_COMPACTION_TOTAL";
String ACTIVE_LEDGER_COUNT = "ACTIVE_LEDGER_TOTAL";
String DELETED_LEDGER_COUNT = "DELETED_LEDGER_TOTAL";

// Index Related Counters
String INDEX_INMEM_ILLEGAL_STATE_RESET = "INDEX_INMEM_ILLEGAL_STATE_RESET";
Expand All @@ -181,7 +181,7 @@ public interface BookKeeperServerStats {
// Gauge
String NUM_INDEX_PAGES = "NUM_INDEX_PAGES";
String NUM_OPEN_LEDGERS = "NUM_OPEN_LEDGERS";
String JOURNAL_FORCE_WRITE_GROUPING_COUNT = "JOURNAL_FORCE_WRITE_GROUPING_COUNT";
String JOURNAL_FORCE_WRITE_GROUPING_COUNT = "JOURNAL_FORCE_WRITE_GROUPING_TOTAL";
String NUM_PENDING_READ = "NUM_PENDING_READ";
String NUM_PENDING_ADD = "NUM_PENDING_ADD";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
package org.apache.bookkeeper.client;

import static org.apache.bookkeeper.bookie.BookKeeperServerStats.ENSEMBLE_NOT_ADHERING_TO_PLACEMENT_POLICY_COUNTER;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.ENSEMBLE_NOT_ADHERING_TO_PLACEMENT_POLICY_COUNT;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.NEW_ENSEMBLE_TIME;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.REPLACE_BOOKIE_TIME;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.WATCHER_SCOPE;
Expand Down Expand Up @@ -95,7 +95,7 @@ class BookieWatcherImpl implements BookieWatcher {
)
private final OpStatsLogger replaceBookieTimer;
@StatsDoc(
name = ENSEMBLE_NOT_ADHERING_TO_PLACEMENT_POLICY_COUNTER,
name = ENSEMBLE_NOT_ADHERING_TO_PLACEMENT_POLICY_COUNT,
help = "total number of newEnsemble/replaceBookie operations failed to adhere"
+ " EnsemblePlacementPolicy"
)
Expand Down Expand Up @@ -134,7 +134,7 @@ public void onRemoval(RemovalNotification<BookieId, Boolean> bookie) {
this.newEnsembleTimer = statsLogger.getOpStatsLogger(NEW_ENSEMBLE_TIME);
this.replaceBookieTimer = statsLogger.getOpStatsLogger(REPLACE_BOOKIE_TIME);
this.ensembleNotAdheringToPlacementPolicy = statsLogger
.getCounter(BookKeeperServerStats.ENSEMBLE_NOT_ADHERING_TO_PLACEMENT_POLICY_COUNTER);
.getCounter(BookKeeperServerStats.ENSEMBLE_NOT_ADHERING_TO_PLACEMENT_POLICY_COUNT);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.BOOKIES_JOINED;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.BOOKIES_LEFT;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNTER;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNT;
import static org.apache.bookkeeper.client.BookKeeperClientStats.CLIENT_SCOPE;
import static org.apache.bookkeeper.client.BookKeeperClientStats.NUM_WRITABLE_BOOKIES_IN_DEFAULT_RACK;
import static org.apache.bookkeeper.client.BookKeeperClientStats.READ_REQUESTS_REORDERED;
Expand Down Expand Up @@ -122,7 +122,7 @@ public class RackawareEnsemblePlacementPolicyImpl extends TopologyAwareEnsembleP
)
protected OpStatsLogger readReorderedCounter = null;
@StatsDoc(
name = FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNTER,
name = FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNT,
help = "Counter for number of times DNSResolverDecorator failed to resolve Network Location"
)
protected Counter failedToResolveNetworkLocationCounter = null;
Expand Down Expand Up @@ -167,7 +167,7 @@ protected RackawareEnsemblePlacementPolicyImpl initialize(DNSToSwitchMapping dns
this.bookiesJoinedCounter = statsLogger.getOpStatsLogger(BOOKIES_JOINED);
this.bookiesLeftCounter = statsLogger.getOpStatsLogger(BOOKIES_LEFT);
this.readReorderedCounter = statsLogger.getOpStatsLogger(READ_REQUESTS_REORDERED);
this.failedToResolveNetworkLocationCounter = statsLogger.getCounter(FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNTER);
this.failedToResolveNetworkLocationCounter = statsLogger.getCounter(FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNT);
this.numWritableBookiesInDefaultRack = new Gauge<Integer>() {
@Override
public Integer getDefaultValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.BOOKIES_JOINED;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.BOOKIES_LEFT;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNTER;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNT;

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -533,7 +533,7 @@ static class DNSResolverDecorator implements DNSToSwitchMapping {
final Supplier<String> defaultRackSupplier;
final DNSToSwitchMapping resolver;
@StatsDoc(
name = FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNTER,
name = FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNT,
help = "total number of times Resolver failed to resolve rack information of a node"
)
final Counter failedToResolveNetworkLocationCounter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.BOOKIES_JOINED;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.BOOKIES_LEFT;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNTER;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNT;
import static org.apache.bookkeeper.client.BookKeeperClientStats.NUM_WRITABLE_BOOKIES_IN_DEFAULT_FAULTDOMAIN;

import com.google.common.cache.Cache;
Expand Down Expand Up @@ -104,7 +104,7 @@ public class ZoneawareEnsemblePlacementPolicyImpl extends TopologyAwareEnsembleP
protected HashedWheelTimer timer;
protected final ConcurrentMap<BookieId, ZoneAwareNodeLocation> address2NodePlacement;

@StatsDoc(name = FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNTER, help = "Counter for number of times"
@StatsDoc(name = FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNT, help = "Counter for number of times"
+ " DNSResolverDecorator failed to resolve Network Location")
protected Counter failedToResolveNetworkLocationCounter = null;
@StatsDoc(name = NUM_WRITABLE_BOOKIES_IN_DEFAULT_FAULTDOMAIN, help = "Gauge for the number of writable"
Expand Down Expand Up @@ -188,7 +188,7 @@ public EnsemblePlacementPolicy initialize(ClientConfiguration conf,
this.timer = timer;
this.bookiesJoinedCounter = statsLogger.getOpStatsLogger(BOOKIES_JOINED);
this.bookiesLeftCounter = statsLogger.getOpStatsLogger(BOOKIES_LEFT);
this.failedToResolveNetworkLocationCounter = statsLogger.getCounter(FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNTER);
this.failedToResolveNetworkLocationCounter = statsLogger.getCounter(FAILED_TO_RESOLVE_NETWORK_LOCATION_COUNT);
this.numWritableBookiesInDefaultFaultDomain = new Gauge<Integer>() {
@Override
public Integer getDefaultValue() {
Expand Down

0 comments on commit ba22bee

Please sign in to comment.