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.client.metrics; 019 020import java.util.concurrent.atomic.AtomicLong; 021import org.apache.yetus.audience.InterfaceAudience; 022 023/** 024 * Provides metrics related to scan operations (both server side and client side metrics). 025 * <p> 026 * The data can be passed to mapreduce framework or other systems. We use atomic longs so that one 027 * thread can increment, while another atomically resets to zero after the values are reported to 028 * hadoop's counters. 029 * <p> 030 * Some of these metrics are general for any client operation such as put However, there is no need 031 * for this. So they are defined under scan operation for now. 032 */ 033@InterfaceAudience.Public 034public class ScanMetrics extends ServerSideScanMetrics { 035 036 // AtomicLongs to hold the metrics values. These are all updated through ClientScanner and 037 // ScannerCallable. They are atomic longs so that atomic getAndSet can be used to reset the 038 // values after progress is passed to hadoop's counters. 039 040 public static final String RPC_CALLS_METRIC_NAME = "RPC_CALLS"; 041 public static final String REMOTE_RPC_CALLS_METRIC_NAME = "REMOTE_RPC_CALLS"; 042 public static final String MILLIS_BETWEEN_NEXTS_METRIC_NAME = "MILLIS_BETWEEN_NEXTS"; 043 public static final String NOT_SERVING_REGION_EXCEPTION_METRIC_NAME = 044 "NOT_SERVING_REGION_EXCEPTION"; 045 public static final String BYTES_IN_RESULTS_METRIC_NAME = "BYTES_IN_RESULTS"; 046 public static final String BYTES_IN_REMOTE_RESULTS_METRIC_NAME = "BYTES_IN_REMOTE_RESULTS"; 047 public static final String REGIONS_SCANNED_METRIC_NAME = "REGIONS_SCANNED"; 048 public static final String RPC_RETRIES_METRIC_NAME = "RPC_RETRIES"; 049 public static final String REMOTE_RPC_RETRIES_METRIC_NAME = "REMOTE_RPC_RETRIES"; 050 051 /** 052 * number of RPC calls 053 */ 054 public final AtomicLong countOfRPCcalls = createCounter(RPC_CALLS_METRIC_NAME); 055 056 /** 057 * number of remote RPC calls 058 */ 059 public final AtomicLong countOfRemoteRPCcalls = createCounter(REMOTE_RPC_CALLS_METRIC_NAME); 060 061 /** 062 * sum of milliseconds between sequential next calls 063 */ 064 public final AtomicLong sumOfMillisSecBetweenNexts = 065 createCounter(MILLIS_BETWEEN_NEXTS_METRIC_NAME); 066 067 /** 068 * number of NotServingRegionException caught 069 */ 070 public final AtomicLong countOfNSRE = createCounter(NOT_SERVING_REGION_EXCEPTION_METRIC_NAME); 071 072 /** 073 * number of bytes in Result objects from region servers 074 */ 075 public final AtomicLong countOfBytesInResults = createCounter(BYTES_IN_RESULTS_METRIC_NAME); 076 077 /** 078 * number of bytes in Result objects from remote region servers 079 */ 080 public final AtomicLong countOfBytesInRemoteResults = 081 createCounter(BYTES_IN_REMOTE_RESULTS_METRIC_NAME); 082 083 /** 084 * number of regions 085 */ 086 public final AtomicLong countOfRegions = createCounter(REGIONS_SCANNED_METRIC_NAME); 087 088 /** 089 * number of RPC retries 090 */ 091 public final AtomicLong countOfRPCRetries = createCounter(RPC_RETRIES_METRIC_NAME); 092 093 /** 094 * number of remote RPC retries 095 */ 096 public final AtomicLong countOfRemoteRPCRetries = createCounter(REMOTE_RPC_RETRIES_METRIC_NAME); 097 098 /** 099 * constructor 100 */ 101 public ScanMetrics() { 102 } 103}