1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to you under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.hadoop.hbase.master;
18
19 import org.apache.hadoop.hbase.metrics.BaseSource;
20
21 /**
22 * A collection of exposed metrics for space quotas from the HBase Master.
23 */
24 public interface MetricsMasterQuotaSource extends BaseSource {
25
26 String METRICS_NAME = "Quotas";
27 String METRICS_CONTEXT = "master";
28 String METRICS_JMX_CONTEXT = "Master,sub=" + METRICS_NAME;
29 String METRICS_DESCRIPTION = "Metrics about HBase Quotas by the Master";
30
31 String NUM_SPACE_QUOTAS_NAME = "numSpaceQuotas";
32 String NUM_SPACE_QUOTAS_DESC = "Number of space quotas defined";
33 String NUM_TABLES_QUOTA_VIOLATIONS_NAME = "numTablesInQuotaViolation";
34 String NUM_TABLES_QUOTA_VIOLATIONS_DESC = "Number of tables violating space quotas";
35 String NUM_NS_QUOTA_VIOLATIONS_NAME = "numNamespaceInQuotaViolation";
36 String NUM_NS_QUOTA_VIOLATIONS_DESC = "Number of namespaces violating space quotas";
37 String NUM_REGION_SIZE_REPORTS_NAME = "numRegionSizeReports";
38 String NUM_REGION_SIZE_REPORTS_DESC = "Number of Region sizes reported";
39 String QUOTA_OBSERVER_CHORE_TIME_NAME = "quotaObserverChoreTime";
40 String QUOTA_OBSERVER_CHORE_TIME_DESC =
41 "Histogram for the time in millis for the QuotaObserverChore";
42 String TABLE_QUOTA_USAGE_NAME = "tableSpaceQuotaOverview";
43 String TABLE_QUOTA_USAGE_DESC = "A JSON summary of the usage of all tables with space quotas";
44 String NS_QUOTA_USAGE_NAME = "namespaceSpaceQuotaOverview";
45 String NS_QUOTA_USAGE_DESC = "A JSON summary of the usage of all namespaces with space quotas";
46
47 /**
48 * Updates the metric tracking the number of space quotas defined in the system.
49 *
50 * @param numSpaceQuotas The number of space quotas defined
51 */
52 void updateNumSpaceQuotas(long numSpaceQuotas);
53
54 /**
55 * Updates the metric tracking the number of tables the master has computed to be in
56 * violation of their space quota.
57 *
58 * @param numTablesInViolation The number of tables violating a space quota
59 */
60 void updateNumTablesInSpaceQuotaViolation(long numTablesInViolation);
61
62 /**
63 * Updates the metric tracking the number of namespaces the master has computed to be in
64 * violation of their space quota.
65 *
66 * @param numNamespacesInViolation The number of namespaces violating a space quota
67 */
68 void updateNumNamespacesInSpaceQuotaViolation(long numNamespacesInViolation);
69
70 /**
71 * Updates the metric tracking the number of region size reports the master is currently
72 * retaining in memory.
73 *
74 * @param numCurrentRegionSizeReports The number of region size reports the master is holding in
75 * memory
76 */
77 void updateNumCurrentSpaceQuotaRegionSizeReports(long numCurrentRegionSizeReports);
78
79 /**
80 * Updates the metric tracking the amount of time taken by the {@code QuotaObserverChore}
81 * which runs periodically.
82 *
83 * @param time The execution time of the chore in milliseconds
84 */
85 void incrementSpaceQuotaObserverChoreTime(long time);
86 }