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