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