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