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 string type version of a regionserver.
045   */
046  default String getVersion() {
047    return "0.0.0";
048  }
049
050  /**
051   * @return the number of requests per second.
052   */
053  long getRequestCountPerSecond();
054
055  /**
056   * @return total Number of requests from the start of the region server.
057   */
058  long getRequestCount();
059
060  /**
061   * @return the amount of used heap
062   */
063  Size getUsedHeapSize();
064
065  /**
066   * @return the maximum allowable size of the heap
067   */
068  Size getMaxHeapSize();
069
070  int getInfoServerPort();
071
072  /**
073   * Call directly from client such as hbase shell
074   * @return the list of ReplicationLoadSource
075   */
076  List<ReplicationLoadSource> getReplicationLoadSourceList();
077
078  /**
079   * Call directly from client such as hbase shell
080   * @return ReplicationLoadSink
081   */
082  @Nullable
083  ReplicationLoadSink getReplicationLoadSink();
084
085  /**
086   * @return region load metrics
087   */
088  Map<byte[], RegionMetrics> getRegionMetrics();
089
090  /**
091   * Return the RegionServer-level and Region-level coprocessors
092   * @return string set of loaded RegionServer-level and Region-level coprocessors
093   */
094  Set<String> getCoprocessorNames();
095
096  /**
097   * @return the timestamp (server side) of generating this metrics
098   */
099  long getReportTimestamp();
100
101  /**
102   * @return the last timestamp (server side) of generating this metrics
103   */
104  long getLastReportTimestamp();
105
106}