View Javadoc

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  
22  /**
23   * This interface will be implemented to allow single regions to push metrics into
24   * MetricsRegionAggregateSource that will in turn push data to the Hadoop metrics system.
25   */
26  public interface MetricsRegionSource extends Comparable<MetricsRegionSource> {
27  
28    String OPS_SAMPLE_NAME = "ops";
29    String SIZE_VALUE_NAME = "size";
30    String COMPACTIONS_COMPLETED_COUNT = "compactionsCompletedCount";
31    String NUM_BYTES_COMPACTED_COUNT = "numBytesCompactedCount";
32    String NUM_FILES_COMPACTED_COUNT = "numFilesCompactedCount";
33    String COMPACTIONS_COMPLETED_DESC = "Number of compactions that have completed.";
34    String  NUM_BYTES_COMPACTED_DESC =
35        "Sum of filesize on all files entering a finished, successful or aborted, compaction";
36    String NUM_FILES_COMPACTED_DESC =
37        "Number of files that were input for finished, successful or aborted, compactions";
38    String COPROCESSOR_EXECUTION_STATISTICS = "coprocessorExecutionStatistics";
39    String COPROCESSOR_EXECUTION_STATISTICS_DESC = "Statistics for coprocessor execution times";
40    String REPLICA_ID = "replicaid";
41    String REPLICA_ID_DESC = "The replica ID of a region. 0 is primary, otherwise is secondary";
42  
43    /**
44     * Close the region's metrics as this region is closing.
45     */
46    void close();
47  
48    /**
49     * Update related counts of puts.
50     */
51    void updatePut();
52  
53    /**
54     * Update related counts of deletes.
55     */
56    void updateDelete();
57  
58    /**
59     * Update count and sizes of gets.
60     * @param getSize size in bytes of the resulting key values for a get
61     */
62    void updateGetSize(long getSize);
63  
64    /**
65     * Update time of gets
66     * @param mills time for this get operation.
67     */
68    void updateGet(long mills);
69  
70    /**
71     * Update the count and sizes of resultScanner.next()
72     * @param scanSize Size in bytes of the resulting key values for a next()
73     */
74    void updateScanSize(long scanSize);
75  
76    /**
77     * Update time used of resultScanner.next().
78     * */
79    void updateScanTime(long mills);
80  
81    /**
82     * Update related counts of increments.
83     */
84    void updateIncrement();
85  
86    /**
87     * Update related counts of appends.
88     */
89    void updateAppend();
90  
91    /**
92     * Get the aggregate source to which this reports.
93     */
94    MetricsRegionAggregateSource getAggregateSource();
95  
96  
97  }