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 incrSplitSuccess(String table) {
047    tableSourceAgg.getOrCreateTableSource(table, wrapper).incrSplitSuccess();
048  }
049
050  public void updateSplitTime(String table, long t) {
051    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateSplitTime(t);
052  }
053
054  public void updateFlushTime(String table, long t) {
055    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateFlushTime(t);
056  }
057
058  public void updateFlushMemstoreSize(String table, long bytes) {
059    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateFlushMemstoreSize(bytes);
060  }
061
062  public void updateFlushOutputSize(String table, long bytes) {
063    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateFlushOutputSize(bytes);
064  }
065
066  public void updateCompactionTime(String table, boolean isMajor, long t) {
067    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateCompactionTime(isMajor, t);
068  }
069
070  public void updateCompactionInputFileCount(String table, boolean isMajor, long c) {
071    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateCompactionInputFileCount(isMajor,
072      c);
073  }
074
075  public void updateCompactionInputSize(String table, boolean isMajor, long bytes) {
076    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateCompactionInputSize(isMajor, bytes);
077  }
078
079  public void updateCompactionOutputFileCount(String table, boolean isMajor, long c) {
080    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateCompactionOutputFileCount(isMajor,
081      c);
082  }
083
084  public void updateCompactionOutputSize(String table, boolean isMajor, long bytes) {
085    tableSourceAgg.getOrCreateTableSource(table, wrapper).updateCompactionOutputSize(isMajor,
086      bytes);
087  }
088}