1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.apache.hadoop.hbase.regionserver;
20
21 import java.io.Closeable;
22
23 /**
24 * This interface will be implemented to allow region server to push table metrics into
25 * MetricsRegionAggregateSource that will in turn push data to the Hadoop metrics system.
26 */
27 public interface MetricsTableSource extends Comparable<MetricsTableSource>, Closeable {
28
29 String TABLE_SIZE = "tableSize";
30 String TABLE_SIZE_DESC = "Total size of the table in the region server";
31
32 String getTableName();
33
34 /**
35 * Close the table's metrics as all the region are closing.
36 */
37 @Override
38 void close();
39
40 void registerMetrics();
41
42 /**
43 * Get the aggregate source to which this reports.
44 */
45 MetricsTableAggregateSource getAggregateSource();
46
47 /**
48 * Update the split transaction time histogram
49 * @param t time it took, in milliseconds
50 */
51 void updateSplitTime(long t);
52
53 /**
54 * Increment number of a requested splits
55 */
56 void incrSplitRequest();
57
58 /**
59 * Increment number of successful splits
60 */
61 void incrSplitSuccess();
62
63 /**
64 * Update the flush time histogram
65 * @param t time it took, in milliseconds
66 */
67 void updateFlushTime(long t);
68
69 /**
70 * Update the flush memstore size histogram
71 * @param bytes the number of bytes in the memstore
72 */
73 void updateFlushMemstoreSize(long bytes);
74
75 /**
76 * Update the flush output file size histogram
77 * @param bytes the number of bytes in the output file
78 */
79 void updateFlushOutputSize(long bytes);
80
81 /**
82 * Update the compaction time histogram, both major and minor
83 * @param isMajor whether compaction is a major compaction
84 * @param t time it took, in milliseconds
85 */
86 void updateCompactionTime(boolean isMajor, long t);
87
88 /**
89 * Update the compaction input number of files histogram
90 * @param isMajor whether compaction is a major compaction
91 * @param c number of files
92 */
93 void updateCompactionInputFileCount(boolean isMajor, long c);
94
95 /**
96 * Update the compaction total input file size histogram
97 * @param isMajor whether compaction is a major compaction
98 * @param bytes the number of bytes of the compaction input file
99 */
100 void updateCompactionInputSize(boolean isMajor, long bytes);
101
102 /**
103 * Update the compaction output number of files histogram
104 * @param isMajor whether compaction is a major compaction
105 * @param c number of files
106 */
107 void updateCompactionOutputFileCount(boolean isMajor, long c);
108
109 /**
110 * Update the compaction total output file size
111 * @param isMajor whether compaction is a major compaction
112 * @param bytes the number of bytes of the compaction input file
113 */
114 void updateCompactionOutputSize(boolean isMajor, long bytes);
115
116 }