001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.master;
019
020import org.apache.hadoop.hbase.metrics.BaseSource;
021import org.apache.hadoop.hbase.metrics.OperationMetrics;
022import org.apache.yetus.audience.InterfaceAudience;
023
024/**
025 * Interface that classes that expose metrics about the master will implement.
026 */
027@InterfaceAudience.Private
028public interface MetricsMasterSource extends BaseSource {
029
030  /**
031   * The name of the metrics
032   */
033  String METRICS_NAME = "Server";
034
035  /**
036   * The context metrics will be under.
037   */
038  String METRICS_CONTEXT = "master";
039
040  /**
041   * The name of the metrics context that metrics will be under in jmx
042   */
043  String METRICS_JMX_CONTEXT = "Master,sub=" + METRICS_NAME;
044
045  /**
046   * Description
047   */
048  String METRICS_DESCRIPTION = "Metrics about HBase master server";
049
050  // Strings used for exporting to metrics system.
051  String MASTER_ACTIVE_TIME_NAME = "masterActiveTime";
052  String MASTER_START_TIME_NAME = "masterStartTime";
053  String MASTER_FINISHED_INITIALIZATION_TIME_NAME = "masterFinishedInitializationTime";
054  String AVERAGE_LOAD_NAME = "averageLoad";
055  String LIVE_REGION_SERVERS_NAME = "liveRegionServers";
056  String DEAD_REGION_SERVERS_NAME = "deadRegionServers";
057  String DRAINING_REGION_SERVER_NAME = "drainingRegionServers";
058  String NUM_REGION_SERVERS_NAME = "numRegionServers";
059  String NUM_DEAD_REGION_SERVERS_NAME = "numDeadRegionServers";
060  String NUM_DRAINING_REGION_SERVERS_NAME = "numDrainingRegionServers";
061  String ZOOKEEPER_QUORUM_NAME = "zookeeperQuorum";
062  String SERVER_NAME_NAME = "serverName";
063  String CLUSTER_ID_NAME = "clusterId";
064  String IS_ACTIVE_MASTER_NAME = "isActiveMaster";
065  String SPLIT_PLAN_COUNT_NAME = "splitPlanCount";
066  String MERGE_PLAN_COUNT_NAME = "mergePlanCount";
067  String ONLINE_REGION_COUNT_NAME = "onlineRegionCount";
068  String OFFLINE_REGION_COUNT_NAME = "offlineRegionCount";
069
070  String CLUSTER_REQUESTS_NAME = "clusterRequests";
071  String CLUSTER_READ_REQUESTS_NAME = "clusterReadRequests";
072  String CLUSTER_WRITE_REQUESTS_NAME = "clusterWriteRequests";
073  String OLD_WAL_DIR_SIZE_NAME = "oldWALsDirSize";
074  String BALANCER_ENABLED_NAME = "balancerEnabled";
075  String NORMALIZER_ENABLED_NAME = "normalizerEnabled";
076  String SPLIT_ENABLED_NAME = "splitEnabled";
077  String MERGE_ENABLED_NAME = "mergeEnabled";
078  String CLEANER_CHORE_ENABLED_NAME = "cleanerChoreEnabled";
079  String CATALOG_JANITOR_ENABLED_NAME = "catalogJanitorEnabled";
080  String SNAPSHOT_CLEANUP_ENABLED_NAME = "snapshotCleanupEnabled";
081  String REPLICATION_PEER_MODIFICATION_ENABLED_NAME = "replicationPeerModificationEnabled";
082  String RPC_THROTTLE_ENABLED_NAME = "rpcThrottleEnabled";
083  String SWITCH_STATE_DESC = "Switch state: 1 enabled, 0 disabled";
084  String MASTER_ACTIVE_TIME_DESC = "Master Active Time";
085  String MASTER_START_TIME_DESC = "Master Start Time";
086  String MASTER_FINISHED_INITIALIZATION_TIME_DESC =
087    "Timestamp when Master has finished initializing";
088  String AVERAGE_LOAD_DESC = "AverageLoad";
089  String LIVE_REGION_SERVERS_DESC = "Names of live RegionServers";
090  String NUMBER_OF_REGION_SERVERS_DESC = "Number of RegionServers";
091  String DEAD_REGION_SERVERS_DESC = "Names of dead RegionServers";
092  String NUMBER_OF_DEAD_REGION_SERVERS_DESC = "Number of dead RegionServers";
093  String DRAINING_REGION_SERVER_DESC = "Names of draining RegionServers";
094  String NUMBER_OF_DRAINING_REGION_SERVERS_DESC = "Number of draining RegionServers";
095  String ZOOKEEPER_QUORUM_DESC = "ZooKeeper Quorum";
096  String SERVER_NAME_DESC = "Server Name";
097  String CLUSTER_ID_DESC = "Cluster Id";
098  String IS_ACTIVE_MASTER_DESC = "Is Active Master";
099  String SPLIT_PLAN_COUNT_DESC = "Number of Region Split Plans executed";
100  String MERGE_PLAN_COUNT_DESC = "Number of Region Merge Plans executed";
101  String ONLINE_REGION_COUNT_DESC = "Number of Online Regions";
102  String OFFLINE_REGION_COUNT_DESC = "Number of Offline Regions";
103
104  String SERVER_CRASH_METRIC_PREFIX = "serverCrash";
105  String OLD_WAL_DIR_SIZE_DESC = "size of old WALs directory in bytes";
106
107  /**
108   * Increment the number of requests the cluster has seen.
109   * @param inc Ammount to increment the total by.
110   */
111  void incRequests(final long inc);
112
113  /**
114   * Increment the number of read requests the cluster has seen.
115   * @param inc Ammount to increment the total by.
116   */
117  void incReadRequests(final long inc);
118
119  /**
120   * Increment the number of write requests the cluster has seen.
121   * @param inc Ammount to increment the total by.
122   */
123  void incWriteRequests(final long inc);
124
125  /** Returns {@link OperationMetrics} containing common metrics for server crash operation */
126  OperationMetrics getServerCrashMetrics();
127}