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.regionserver; 019 020import java.io.Closeable; 021 022import org.apache.yetus.audience.InterfaceAudience; 023 024/** 025 * This interface will be implemented to allow region server to push table metrics into 026 * MetricsRegionAggregateSource that will in turn push data to the Hadoop metrics system. 027 */ 028@InterfaceAudience.Private 029public interface MetricsTableSource extends Comparable<MetricsTableSource>, Closeable { 030 031 String TABLE_SIZE = "tableSize"; 032 String TABLE_SIZE_DESC = "Total size of the table in the region server"; 033 034 String getTableName(); 035 036 /** 037 * Close the table's metrics as all the region are closing. 038 */ 039 @Override 040 void close(); 041 042 void registerMetrics(); 043 044 /** 045 * Get the aggregate source to which this reports. 046 */ 047 MetricsTableAggregateSource getAggregateSource(); 048 049 /** 050 * Update the split transaction time histogram 051 * @param t time it took, in milliseconds 052 */ 053 void updateSplitTime(long t); 054 055 /** 056 * Increment number of a requested splits 057 */ 058 void incrSplitRequest(); 059 060 /** 061 * Increment number of successful splits 062 */ 063 void incrSplitSuccess(); 064 065 /** 066 * Update the flush time histogram 067 * @param t time it took, in milliseconds 068 */ 069 void updateFlushTime(long t); 070 071 /** 072 * Update the flush memstore size histogram 073 * @param bytes the number of bytes in the memstore 074 */ 075 void updateFlushMemstoreSize(long bytes); 076 077 /** 078 * Update the flush output file size histogram 079 * @param bytes the number of bytes in the output file 080 */ 081 void updateFlushOutputSize(long bytes); 082 083 /** 084 * Update the compaction time histogram, both major and minor 085 * @param isMajor whether compaction is a major compaction 086 * @param t time it took, in milliseconds 087 */ 088 void updateCompactionTime(boolean isMajor, long t); 089 090 /** 091 * Update the compaction input number of files histogram 092 * @param isMajor whether compaction is a major compaction 093 * @param c number of files 094 */ 095 void updateCompactionInputFileCount(boolean isMajor, long c); 096 097 /** 098 * Update the compaction total input file size histogram 099 * @param isMajor whether compaction is a major compaction 100 * @param bytes the number of bytes of the compaction input file 101 */ 102 void updateCompactionInputSize(boolean isMajor, long bytes); 103 104 /** 105 * Update the compaction output number of files histogram 106 * @param isMajor whether compaction is a major compaction 107 * @param c number of files 108 */ 109 void updateCompactionOutputFileCount(boolean isMajor, long c); 110 111 /** 112 * Update the compaction total output file size 113 * @param isMajor whether compaction is a major compaction 114 * @param bytes the number of bytes of the compaction input file 115 */ 116 void updateCompactionOutputSize(boolean isMajor, long bytes); 117 118}