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 MASTER_ACTIVE_TIME_DESC = "Master Active Time";
075  String MASTER_START_TIME_DESC = "Master Start Time";
076  String MASTER_FINISHED_INITIALIZATION_TIME_DESC =
077    "Timestamp when Master has finished initializing";
078  String AVERAGE_LOAD_DESC = "AverageLoad";
079  String LIVE_REGION_SERVERS_DESC = "Names of live RegionServers";
080  String NUMBER_OF_REGION_SERVERS_DESC = "Number of RegionServers";
081  String DEAD_REGION_SERVERS_DESC = "Names of dead RegionServers";
082  String NUMBER_OF_DEAD_REGION_SERVERS_DESC = "Number of dead RegionServers";
083  String DRAINING_REGION_SERVER_DESC = "Names of draining RegionServers";
084  String NUMBER_OF_DRAINING_REGION_SERVERS_DESC = "Number of draining RegionServers";
085  String ZOOKEEPER_QUORUM_DESC = "ZooKeeper Quorum";
086  String SERVER_NAME_DESC = "Server Name";
087  String CLUSTER_ID_DESC = "Cluster Id";
088  String IS_ACTIVE_MASTER_DESC = "Is Active Master";
089  String SPLIT_PLAN_COUNT_DESC = "Number of Region Split Plans executed";
090  String MERGE_PLAN_COUNT_DESC = "Number of Region Merge Plans executed";
091  String ONLINE_REGION_COUNT_DESC = "Number of Online Regions";
092  String OFFLINE_REGION_COUNT_DESC = "Number of Offline Regions";
093
094  String SERVER_CRASH_METRIC_PREFIX = "serverCrash";
095  String OLD_WAL_DIR_SIZE_DESC = "size of old WALs directory in bytes";
096
097  /**
098   * Increment the number of requests the cluster has seen.
099   * @param inc Ammount to increment the total by.
100   */
101  void incRequests(final long inc);
102
103  /**
104   * Increment the number of read requests the cluster has seen.
105   * @param inc Ammount to increment the total by.
106   */
107  void incReadRequests(final long inc);
108
109  /**
110   * Increment the number of write requests the cluster has seen.
111   * @param inc Ammount to increment the total by.
112   */
113  void incWriteRequests(final long inc);
114
115  /** Returns {@link OperationMetrics} containing common metrics for server crash operation */
116  OperationMetrics getServerCrashMetrics();
117}