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.master;
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 the HBase Master.
024 */
025@InterfaceAudience.Private
026public interface MetricsMasterQuotaSource extends BaseSource {
027
028  String METRICS_NAME = "Quotas";
029  String METRICS_CONTEXT = "master";
030  String METRICS_JMX_CONTEXT = "Master,sub=" + METRICS_NAME;
031  String METRICS_DESCRIPTION = "Metrics about HBase Quotas by the Master";
032
033  String NUM_SPACE_QUOTAS_NAME = "numSpaceQuotas";
034  String NUM_SPACE_QUOTAS_DESC = "Number of space quotas defined";
035  String NUM_TABLES_QUOTA_VIOLATIONS_NAME = "numTablesInQuotaViolation";
036  String NUM_TABLES_QUOTA_VIOLATIONS_DESC = "Number of tables violating space quotas";
037  String NUM_NS_QUOTA_VIOLATIONS_NAME = "numNamespaceInQuotaViolation";
038  String NUM_NS_QUOTA_VIOLATIONS_DESC = "Number of namespaces violating space quotas";
039  String NUM_REGION_SIZE_REPORTS_NAME = "numRegionSizeReports";
040  String NUM_REGION_SIZE_REPORTS_DESC = "Number of Region sizes reported";
041  String QUOTA_OBSERVER_CHORE_TIME_NAME = "quotaObserverChoreTime";
042  String QUOTA_OBSERVER_CHORE_TIME_DESC =
043      "Histogram for the time in millis for the QuotaObserverChore";
044  String SNAPSHOT_OBSERVER_CHORE_TIME_NAME = "snapshotQuotaObserverChoreTime";
045  String SNAPSHOT_OBSERVER_CHORE_TIME_DESC =
046      "Histogram for the time in millis for the SnapshotQuotaObserverChore";
047  String SNAPSHOT_OBSERVER_SIZE_COMPUTATION_TIME_NAME = "snapshotObserverSizeComputationTime";
048  String SNAPSHOT_OBSERVER_SIZE_COMPUTATION_TIME_DESC =
049      "Histogram for the time in millis to compute the size of each snapshot";
050  String SNAPSHOT_OBSERVER_FETCH_TIME_NAME = "snapshotObserverSnapshotFetchTime";
051  String SNAPSHOT_OBSERVER_FETCH_TIME_DESC =
052      "Histogram for the time in millis to fetch all snapshots from HBase";
053  String TABLE_QUOTA_USAGE_NAME = "tableSpaceQuotaOverview";
054  String TABLE_QUOTA_USAGE_DESC = "A JSON summary of the usage of all tables with space quotas";
055  String NS_QUOTA_USAGE_NAME = "namespaceSpaceQuotaOverview";
056  String NS_QUOTA_USAGE_DESC = "A JSON summary of the usage of all namespaces with space quotas";
057
058  /**
059   * Updates the metric tracking the number of space quotas defined in the system.
060   *
061   * @param numSpaceQuotas The number of space quotas defined
062   */
063  void updateNumSpaceQuotas(long numSpaceQuotas);
064
065  /**
066   * Updates the metric tracking the number of tables the master has computed to be in
067   * violation of their space quota.
068   *
069   * @param numTablesInViolation The number of tables violating a space quota
070   */
071  void updateNumTablesInSpaceQuotaViolation(long numTablesInViolation);
072
073  /**
074   * Updates the metric tracking the number of namespaces the master has computed to be in
075   * violation of their space quota.
076   *
077   * @param numNamespacesInViolation The number of namespaces violating a space quota
078   */
079  void updateNumNamespacesInSpaceQuotaViolation(long numNamespacesInViolation);
080
081  /**
082   * Updates the metric tracking the number of region size reports the master is currently
083   * retaining in memory.
084   *
085   * @param numCurrentRegionSizeReports The number of region size reports the master is holding in
086   *    memory
087   */
088  void updateNumCurrentSpaceQuotaRegionSizeReports(long numCurrentRegionSizeReports);
089
090  /**
091   * Updates the metric tracking the amount of time taken by the {@code QuotaObserverChore}
092   * which runs periodically.
093   *
094   * @param time The execution time of the chore in milliseconds
095   */
096  void incrementSpaceQuotaObserverChoreTime(long time);
097
098  /**
099   * Updates the metric tracking the amount of time taken by the {@code SnapshotQuotaObserverChore}
100   * which runs periodically.
101   */
102  void incrementSnapshotObserverChoreTime(long time);
103
104  /**
105   * Updates the metric tracking the amount of time taken by the {@code SnapshotQuotaObserverChore}
106   * to compute the size of one snapshot, relative to the files referenced by the originating table.
107   */
108  void incrementSnapshotObserverSnapshotComputationTime(long time);
109
110  /**
111   * Updates the metric tracking the amount of time taken by the {@code SnapshotQuotaObserverChore}
112   * to fetch all snapshots.
113   */
114  void incrementSnapshotObserverSnapshotFetchTime(long time);
115}