001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to you under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
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 */
017package org.apache.hadoop.hbase.regionserver;
018
019import org.apache.hadoop.hbase.metrics.BaseSource;
020import org.apache.yetus.audience.InterfaceAudience;
021
022/**
023 * A collection of exposed metrics for space quotas from an HBase RegionServer.
024 */
025@InterfaceAudience.Private
026public interface MetricsRegionServerQuotaSource extends BaseSource {
027
028  String METRICS_NAME = "Quotas";
029  String METRICS_CONTEXT = "regionserver";
030  String METRICS_DESCRIPTION = "Metrics about HBase RegionServer Quotas";
031  String METRICS_JMX_CONTEXT = "RegionServer,sub=" + METRICS_NAME;
032
033  String NUM_TABLES_IN_VIOLATION_NAME = "numTablesInViolation";
034  String NUM_SPACE_SNAPSHOTS_RECEIVED_NAME = "numSpaceSnapshotsReceived";
035  String FILE_SYSTEM_UTILIZATION_CHORE_TIME = "fileSystemUtilizationChoreTime";
036  String SPACE_QUOTA_REFRESHER_CHORE_TIME = "spaceQuotaRefresherChoreTime";
037
038  String NUM_REGION_SIZE_REPORT_NAME = "numRegionSizeReports";
039  String REGION_SIZE_REPORTING_CHORE_TIME_NAME = "regionSizeReportingChoreTime";
040
041  /**
042   * Updates the metric tracking how many tables this RegionServer has marked as in violation
043   * of their space quota.
044   */
045  void updateNumTablesInSpaceQuotaViolation(long tablesInViolation);
046
047  /**
048   * Updates the metric tracking how many tables this RegionServer has received
049   * {@code SpaceQuotaSnapshot}s for.
050   *
051   * @param numSnapshots The number of {@code SpaceQuotaSnapshot}s received from the Master.
052   */
053  void updateNumTableSpaceQuotaSnapshots(long numSnapshots);
054
055  /**
056   * Updates the metric tracking how much time was spent scanning the filesystem to compute
057   * the size of each region hosted by this RegionServer.
058   *
059   * @param time The execution time of the chore in milliseconds.
060   */
061  void incrementSpaceQuotaFileSystemScannerChoreTime(long time);
062
063  /**
064   * Updates the metric tracking how much time was spent updating the RegionServer with the
065   * latest information on space quotas from the {@code hbase:quota} table.
066   *
067   * @param time The execution time of the chore in milliseconds.
068   */
069  void incrementSpaceQuotaRefresherChoreTime(long time);
070
071  /**
072   * Updates the metric tracking how many region size reports were sent from this RegionServer to
073   * the Master. These reports contain information on the size of each Region hosted locally.
074   *
075   * @param numReportsSent The number of region size reports sent
076   */
077  void incrementNumRegionSizeReportsSent(long numReportsSent);
078
079  /**
080   * Updates the metric tracking how much time was spent sending region size reports to the Master
081   * by the RegionSizeReportingChore.
082   *
083   * @param time The execution time in milliseconds.
084   */
085  void incrementRegionSizeReportingChoreTime(long time);
086}