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 org.apache.hadoop.hbase.CompatibilitySingletonFactory;
021import org.apache.yetus.audience.InterfaceAudience;
022
023@InterfaceAudience.Private
024public class MetricsTable {
025  private final MetricsTableAggregateSource tableSourceAgg;
026  private MetricsTableWrapperAggregate wrapper;
027
028  public MetricsTable(final MetricsTableWrapperAggregate wrapper) {
029    tableSourceAgg = CompatibilitySingletonFactory
030      .getInstance(MetricsRegionServerSourceFactory.class).getTableAggregate();
031    this.wrapper = wrapper;
032  }
033
034  public MetricsTableWrapperAggregate getTableWrapperAgg() {
035    return wrapper;
036  }
037
038  public MetricsTableAggregateSource getTableSourceAgg() {
039    return tableSourceAgg;
040  }
041
042  public void incrSplitRequest(String table) {
043    tableSourceAgg.getOrCreateTableSource(table, wrapper).incrSplitRequest();
044  }
045
046  public void updateFlushTime(String table, long t) {
047    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateFlushTime(t);
048  }
049
050  public void updateFlushMemstoreSize(String table, long bytes) {
051    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateFlushMemstoreSize(bytes);
052  }
053
054  public void updateFlushOutputSize(String table, long bytes) {
055    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateFlushOutputSize(bytes);
056  }
057
058  public void updateCompactionTime(String table, boolean isMajor, long t) {
059    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateCompactionTime(isMajor, t);
060  }
061
062  public void updateCompactionInputFileCount(String table, boolean isMajor, long c) {
063    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateCompactionInputFileCount(isMajor,
064      c);
065  }
066
067  public void updateCompactionInputSize(String table, boolean isMajor, long bytes) {
068    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateCompactionInputSize(isMajor, bytes);
069  }
070
071  public void updateCompactionOutputFileCount(String table, boolean isMajor, long c) {
072    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateCompactionOutputFileCount(isMajor,
073      c);
074  }
075
076  public void updateCompactionOutputSize(String table, boolean isMajor, long bytes) {
077    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateCompactionOutputSize(isMajor,
078      bytes);
079  }
080}