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