001/**
002 * Copyright The Apache Software Foundation
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 * http://www.apache.org/licenses/LICENSE-2.0
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
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  /**
037   * @return the version number of a regionserver.
038   */
039  default int getVersionNumber() {
040    return 0;
041  }
042
043  /**
044   * @return the number of requests per second.
045   */
046  long getRequestCountPerSecond();
047
048  /**
049   * @return total Number of requests from the start of the region server.
050   */
051  long getRequestCount();
052
053  /**
054   * @return the amount of used heap
055   */
056  Size getUsedHeapSize();
057
058  /**
059   * @return the maximum allowable size of the heap
060   */
061  Size getMaxHeapSize();
062
063  int getInfoServerPort();
064
065  /**
066   * Call directly from client such as hbase shell
067   * @return the list of ReplicationLoadSource
068   */
069  List<ReplicationLoadSource> getReplicationLoadSourceList();
070
071  /**
072   * Call directly from client such as hbase shell
073   * @return ReplicationLoadSink
074   */
075  @Nullable
076  ReplicationLoadSink getReplicationLoadSink();
077
078  /**
079   * @return region load metrics
080   */
081  Map<byte[], RegionMetrics> getRegionMetrics();
082
083  /**
084   * Return the RegionServer-level and Region-level coprocessors
085   * @return string set of loaded RegionServer-level and Region-level coprocessors
086   */
087  Set<String> getCoprocessorNames();
088
089  /**
090   * @return the timestamp (server side) of generating this metrics
091   */
092  long getReportTimestamp();
093
094  /**
095   * @return the last timestamp (server side) of generating this metrics
096   */
097  long getLastReportTimestamp();
098
099}