001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to you under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.hadoop.hbase.regionserver; 018 019import org.apache.hadoop.hbase.CompatibilitySingletonFactory; 020import org.apache.hadoop.hbase.TableName; 021import org.apache.yetus.audience.InterfaceAudience; 022 023/** 024 * Captures operation metrics by table. Separates metrics collection for table metrics away from 025 * {@link MetricsRegionServer} for encapsulation and ease of testing. 026 */ 027@InterfaceAudience.Private 028public class RegionServerTableMetrics { 029 030 private final MetricsTableLatencies latencies; 031 032 public RegionServerTableMetrics() { 033 latencies = CompatibilitySingletonFactory.getInstance(MetricsTableLatencies.class); 034 } 035 036 public void updatePut(TableName table, long time) { 037 latencies.updatePut(table.getNameAsString(), time); 038 } 039 040 public void updatePutBatch(TableName table, long time) { 041 latencies.updatePutBatch(table.getNameAsString(), time); 042 } 043 044 public void updateGet(TableName table, long time) { 045 latencies.updateGet(table.getNameAsString(), time); 046 } 047 048 public void updateIncrement(TableName table, long time) { 049 latencies.updateIncrement(table.getNameAsString(), time); 050 } 051 052 public void updateAppend(TableName table, long time) { 053 latencies.updateAppend(table.getNameAsString(), time); 054 } 055 056 public void updateDelete(TableName table, long time) { 057 latencies.updateDelete(table.getNameAsString(), time); 058 } 059 060 public void updateDeleteBatch(TableName table, long time) { 061 latencies.updateDeleteBatch(table.getNameAsString(), time); 062 } 063 064 public void updateScanTime(TableName table, long time) { 065 latencies.updateScanTime(table.getNameAsString(), time); 066 } 067 068 public void updateScanSize(TableName table, long size) { 069 latencies.updateScanSize(table.getNameAsString(), size); 070 } 071}