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 java.util.Map;
021import java.util.Map.Entry;
022import org.apache.hadoop.hbase.util.PairOfSameType;
023import org.apache.yetus.audience.InterfaceAudience;
024
025/**
026 * This is the interface that will expose information to hadoop1/hadoop2 implementations of the
027 * MetricsMasterSource.
028 */
029@InterfaceAudience.Private
030public interface MetricsMasterWrapper {
031
032  /**
033   * Returns if the master is currently running and is not attempting to shutdown.
034   */
035  boolean isRunning();
036
037  /**
038   * Get ServerName
039   */
040  String getServerName();
041
042  /**
043   * Get Average Load
044   * @return Average Load
045   */
046  double getAverageLoad();
047
048  /**
049   * Get the Cluster ID
050   * @return Cluster ID
051   */
052  String getClusterId();
053
054  /**
055   * Get the ZooKeeper Quorum Info
056   * @return ZooKeeper Quorum Info
057   */
058  String getZookeeperQuorum();
059
060  /**
061   * Get the co-processors
062   * @return Co-processors
063   */
064  String[] getCoprocessors();
065
066  /**
067   * Get hbase master start time
068   * @return Start time of master in milliseconds
069   */
070  long getStartTime();
071
072  /**
073   * Get the hbase master active time
074   * @return Time in milliseconds when master became active
075   */
076  long getActiveTime();
077
078  /**
079   * Whether this master is the active master
080   * @return True if this is the active master
081   */
082  boolean getIsActiveMaster();
083
084  /**
085   * Get the live region servers
086   * @return Live region servers
087   */
088  String getRegionServers();
089
090  /**
091   * Get the number of live region servers
092   * @return number of Live region servers
093   */
094
095  int getNumRegionServers();
096
097  /**
098   * Get the dead region servers
099   * @return Dead region Servers
100   */
101  String getDeadRegionServers();
102
103  /**
104   * Get the number of dead region servers
105   * @return number of Dead region Servers
106   */
107  int getNumDeadRegionServers();
108
109  /**
110   * Get the draining region servers
111   * @return Draining region server
112   */
113  String getDrainingRegionServers();
114
115  /**
116   * Get the number of draining region servers
117   * @return number of draining region servers
118   */
119  int getNumDrainingRegionServers();
120
121  /**
122   * Get the number of master WAL files.
123   */
124  long getNumWALFiles();
125
126  /**
127   * Get the number of region split plans executed.
128   */
129  long getSplitPlanCount();
130
131  /**
132   * Get the number of region merge plans executed.
133   */
134  long getMergePlanCount();
135
136  /**
137   * Gets the space usage and limit for each table.
138   */
139  Map<String, Entry<Long, Long>> getTableSpaceUtilization();
140
141  /**
142   * Gets the space usage and limit for each namespace.
143   */
144  Map<String, Entry<Long, Long>> getNamespaceSpaceUtilization();
145
146  /**
147   * Get the time in Millis when the master finished initializing/becoming the active master
148   */
149  long getMasterInitializationTime();
150
151  /**
152   * Get the online and offline region counts
153   * @return pair of count for online regions and offline regions
154   */
155  PairOfSameType<Integer> getRegionCounts();
156
157  /**
158   * Get the size of old WALs directory in bytes.
159   */
160  long getOldWALsDirSize();
161}