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
068  String CLUSTER_REQUESTS_NAME = "clusterRequests";
069  String OLD_WAL_DIR_SIZE_NAME = "oldWALsDirSize";
070  String MASTER_ACTIVE_TIME_DESC = "Master Active Time";
071  String MASTER_START_TIME_DESC = "Master Start Time";
072  String MASTER_FINISHED_INITIALIZATION_TIME_DESC =
073    "Timestamp when Master has finished initializing";
074  String AVERAGE_LOAD_DESC = "AverageLoad";
075  String LIVE_REGION_SERVERS_DESC = "Names of live RegionServers";
076  String NUMBER_OF_REGION_SERVERS_DESC = "Number of RegionServers";
077  String DEAD_REGION_SERVERS_DESC = "Names of dead RegionServers";
078  String NUMBER_OF_DEAD_REGION_SERVERS_DESC = "Number of dead RegionServers";
079  String DRAINING_REGION_SERVER_DESC = "Names of draining RegionServers";
080  String NUMBER_OF_DRAINING_REGION_SERVERS_DESC = "Number of draining RegionServers";
081  String ZOOKEEPER_QUORUM_DESC = "ZooKeeper Quorum";
082  String SERVER_NAME_DESC = "Server Name";
083  String CLUSTER_ID_DESC = "Cluster Id";
084  String IS_ACTIVE_MASTER_DESC = "Is Active Master";
085  String SPLIT_PLAN_COUNT_DESC = "Number of Region Split Plans executed";
086  String MERGE_PLAN_COUNT_DESC = "Number of Region Merge Plans executed";
087
088  String SERVER_CRASH_METRIC_PREFIX = "serverCrash";
089  String OLD_WAL_DIR_SIZE_DESC = "size of old WALs directory in bytes";
090
091  /**
092   * Increment the number of requests the cluster has seen.
093   * @param inc Ammount to increment the total by.
094   */
095  void incRequests(final long inc);
096
097  /** Returns {@link OperationMetrics} containing common metrics for server crash operation */
098  OperationMetrics getServerCrashMetrics();
099}