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;
019
020import edu.umd.cs.findbugs.annotations.Nullable;
021import java.util.List;
022import java.util.Map;
023import java.util.Set;
024import org.apache.hadoop.hbase.replication.ReplicationLoadSink;
025import org.apache.hadoop.hbase.replication.ReplicationLoadSource;
026import org.apache.yetus.audience.InterfaceAudience;
027
028/**
029 * This class is used for exporting current state of load on a RegionServer.
030 */
031@InterfaceAudience.Public
032public interface ServerMetrics {
033
034  ServerName getServerName();
035
036  /** Returns the version number of a regionserver. */
037  default int getVersionNumber() {
038    return 0;
039  }
040
041  /** Returns the string type version of a regionserver. */
042  default String getVersion() {
043    return "0.0.0";
044  }
045
046  /** Returns the number of requests per second. */
047  long getRequestCountPerSecond();
048
049  /** Returns total Number of requests from the start of the region server. */
050  long getRequestCount();
051
052  /** Returns the amount of used heap */
053  Size getUsedHeapSize();
054
055  /** Returns the maximum allowable size of the heap */
056  Size getMaxHeapSize();
057
058  int getInfoServerPort();
059
060  /**
061   * Call directly from client such as hbase shell
062   * @return the list of ReplicationLoadSource
063   */
064  List<ReplicationLoadSource> getReplicationLoadSourceList();
065
066  /**
067   * Call directly from client such as hbase shell
068   * @return a map of ReplicationLoadSource list per peer id
069   */
070  Map<String, List<ReplicationLoadSource>> getReplicationLoadSourceMap();
071
072  /**
073   * Call directly from client such as hbase shell n
074   */
075  @Nullable
076  ReplicationLoadSink getReplicationLoadSink();
077
078  /** Returns region load metrics */
079  Map<byte[], RegionMetrics> getRegionMetrics();
080
081  /** Returns metrics per user */
082  Map<byte[], UserMetrics> getUserMetrics();
083
084  /**
085   * Return the RegionServer-level and Region-level coprocessors
086   * @return string set of loaded RegionServer-level and Region-level coprocessors
087   */
088  Set<String> getCoprocessorNames();
089
090  /** Returns the timestamp (server side) of generating this metrics */
091  long getReportTimestamp();
092
093  /** Returns the last timestamp (server side) of generating this metrics */
094  long getLastReportTimestamp();
095
096  /**
097   * Called directly from clients such as the hbase shell
098   * @return the active monitored tasks
099   */
100  @Nullable
101  List<ServerTask> getTasks();
102
103}