001/** 002 * Copyright The Apache Software Foundation 003 * 004 * Licensed to the Apache Software Foundation (ASF) under one or more 005 * contributor license agreements. See the NOTICE file distributed with this 006 * work for additional information regarding copyright ownership. The ASF 007 * licenses this file to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 015 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 016 * License for the specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.hadoop.hbase.regionserver; 020 021import org.apache.hadoop.hbase.CompatibilitySingletonFactory; 022import org.apache.yetus.audience.InterfaceAudience; 023 024@InterfaceAudience.Private 025public class MetricsTable { 026 private final MetricsTableAggregateSource tableSourceAgg; 027 private MetricsTableWrapperAggregate wrapper; 028 029 public MetricsTable(final MetricsTableWrapperAggregate wrapper) { 030 tableSourceAgg = CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class) 031 .getTableAggregate(); 032 this.wrapper = wrapper; 033 } 034 035 public MetricsTableWrapperAggregate getTableWrapperAgg() { 036 return wrapper; 037 } 038 039 public MetricsTableAggregateSource getTableSourceAgg() { 040 return tableSourceAgg; 041 } 042 043 public void incrSplitRequest(String table) { 044 tableSourceAgg.getOrCreateTableSource(table, wrapper).incrSplitRequest(); 045 } 046 047 public void incrSplitSuccess(String table) { 048 tableSourceAgg.getOrCreateTableSource(table, wrapper).incrSplitSuccess(); 049 } 050 051 public void updateSplitTime(String table, long t) { 052 tableSourceAgg.getOrCreateTableSource(table, wrapper).updateSplitTime(t); 053 } 054 055 public void updateFlushTime(String table, long t) { 056 tableSourceAgg.getOrCreateTableSource(table, wrapper).updateFlushTime(t); 057 } 058 059 public void updateFlushMemstoreSize(String table, long bytes) { 060 tableSourceAgg.getOrCreateTableSource(table, wrapper).updateFlushMemstoreSize(bytes); 061 } 062 063 public void updateFlushOutputSize(String table, long bytes) { 064 tableSourceAgg.getOrCreateTableSource(table, wrapper).updateFlushOutputSize(bytes); 065 } 066 067 public void updateCompactionTime(String table, boolean isMajor, long t) { 068 tableSourceAgg.getOrCreateTableSource(table, wrapper).updateCompactionTime(isMajor, t); 069 } 070 071 public void updateCompactionInputFileCount(String table, boolean isMajor, long c) { 072 tableSourceAgg.getOrCreateTableSource(table, wrapper) 073 .updateCompactionInputFileCount(isMajor, c); 074 } 075 076 public void updateCompactionInputSize(String table, boolean isMajor, long bytes) { 077 tableSourceAgg.getOrCreateTableSource(table, wrapper) 078 .updateCompactionInputSize(isMajor, bytes); 079 } 080 081 public void updateCompactionOutputFileCount(String table, boolean isMajor, long c) { 082 tableSourceAgg.getOrCreateTableSource(table, wrapper) 083 .updateCompactionOutputFileCount(isMajor, c); 084 } 085 086 public void updateCompactionOutputSize(String table, boolean isMajor, long bytes) { 087 tableSourceAgg.getOrCreateTableSource(table, wrapper) 088 .updateCompactionOutputSize(isMajor, bytes); 089 } 090}