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.regionserver;
019
020import org.apache.hadoop.hbase.metrics.BaseSource;
021import org.apache.yetus.audience.InterfaceAudience;
022
023/**
024 * A collection of exposed metrics for space quotas from an HBase RegionServer.
025 */
026@InterfaceAudience.Private
027public interface MetricsRegionServerQuotaSource extends BaseSource {
028
029  String METRICS_NAME = "Quotas";
030  String METRICS_CONTEXT = "regionserver";
031  String METRICS_DESCRIPTION = "Metrics about HBase RegionServer Quotas";
032  String METRICS_JMX_CONTEXT = "RegionServer,sub=" + METRICS_NAME;
033
034  String NUM_TABLES_IN_VIOLATION_NAME = "numTablesInViolation";
035  String NUM_SPACE_SNAPSHOTS_RECEIVED_NAME = "numSpaceSnapshotsReceived";
036  String FILE_SYSTEM_UTILIZATION_CHORE_TIME = "fileSystemUtilizationChoreTime";
037  String SPACE_QUOTA_REFRESHER_CHORE_TIME = "spaceQuotaRefresherChoreTime";
038
039  String NUM_REGION_SIZE_REPORT_NAME = "numRegionSizeReports";
040  String REGION_SIZE_REPORTING_CHORE_TIME_NAME = "regionSizeReportingChoreTime";
041
042  /**
043   * Updates the metric tracking how many tables this RegionServer has marked as in violation of
044   * their space quota.
045   */
046  void updateNumTablesInSpaceQuotaViolation(long tablesInViolation);
047
048  /**
049   * Updates the metric tracking how many tables this RegionServer has received
050   * {@code SpaceQuotaSnapshot}s for.
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 the size
057   * of each region hosted by this RegionServer.
058   * @param time The execution time of the chore in milliseconds.
059   */
060  void incrementSpaceQuotaFileSystemScannerChoreTime(long time);
061
062  /**
063   * Updates the metric tracking how much time was spent updating the RegionServer with the latest
064   * information on space quotas from the {@code hbase:quota} table.
065   * @param time The execution time of the chore in milliseconds.
066   */
067  void incrementSpaceQuotaRefresherChoreTime(long time);
068
069  /**
070   * Updates the metric tracking how many region size reports were sent from this RegionServer to
071   * the Master. These reports contain information on the size of each Region hosted locally.
072   * @param numReportsSent The number of region size reports sent
073   */
074  void incrementNumRegionSizeReportsSent(long numReportsSent);
075
076  /**
077   * Updates the metric tracking how much time was spent sending region size reports to the Master
078   * by the RegionSizeReportingChore.
079   * @param time The execution time in milliseconds.
080   */
081  void incrementRegionSizeReportingChoreTime(long time);
082}