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 */
018
019package org.apache.hadoop.hbase.regionserver;
020
021import org.apache.yetus.audience.InterfaceAudience;
022
023/**
024 * This interface will be implemented to allow single regions to push metrics into
025 * MetricsRegionAggregateSource that will in turn push data to the Hadoop metrics system.
026 */
027@InterfaceAudience.Private
028public interface MetricsRegionSource extends Comparable<MetricsRegionSource> {
029
030  String OPS_SAMPLE_NAME = "ops";
031  String SIZE_VALUE_NAME = "size";
032  String COMPACTIONS_COMPLETED_COUNT = "compactionsCompletedCount";
033  String COMPACTIONS_FAILED_COUNT = "compactionsFailedCount";
034  String LAST_MAJOR_COMPACTION_AGE = "lastMajorCompactionAge";
035  String COMPACTIONS_QUEUED_COUNT = "compactionsQueuedCount";
036  String MAX_COMPACTION_QUEUE_SIZE = "maxCompactionQueueSize";
037  String NUM_BYTES_COMPACTED_COUNT = "numBytesCompactedCount";
038  String NUM_FILES_COMPACTED_COUNT = "numFilesCompactedCount";
039  String FLUSHES_QUEUED_COUNT = "flushesQueuedCount";
040  String MAX_FLUSH_QUEUE_SIZE = "maxFlushQueueSize";
041  String COMPACTIONS_COMPLETED_DESC = "Number of compactions that have completed.";
042  String COMPACTIONS_FAILED_DESC = "Number of compactions that have failed.";
043  String LAST_MAJOR_COMPACTION_DESC = "Age of the last major compaction in milliseconds.";
044  String COMPACTIONS_QUEUED_DESC = "Number of compactions that are queued/running for this region";
045  String MAX_COMPACTION_QUEUE_DESC = "Max number of compactions queued for this region";
046  String FLUSHES_QUEUED_DESC = "Number flushes requested/queued for this region";
047  String MAX_FLUSH_QUEUE_DESC = "Max number of flushes queued for this region";
048  String  NUM_BYTES_COMPACTED_DESC =
049      "Sum of filesize on all files entering a finished, successful or aborted, compaction";
050  String NUM_FILES_COMPACTED_DESC =
051      "Number of files that were input for finished, successful or aborted, compactions";
052  String COPROCESSOR_EXECUTION_STATISTICS = "coprocessorExecutionStatistics";
053  String COPROCESSOR_EXECUTION_STATISTICS_DESC = "Statistics for coprocessor execution times";
054  String REPLICA_ID = "replicaid";
055  String REPLICA_ID_DESC = "The replica ID of a region. 0 is primary, otherwise is secondary";
056  String ROW_READS_ONLY_ON_MEMSTORE = "memstoreOnlyRowReadsCount";
057  String ROW_READS_ONLY_ON_MEMSTORE_DESC = "Row reads happening completely out of memstore";
058  String MIXED_ROW_READS = "mixedRowReadsCount";
059  String MIXED_ROW_READS_ON_STORE_DESC = "Row reads happening out of files and memstore on store";
060
061  /**
062   * Close the region's metrics as this region is closing.
063   */
064  void close();
065
066  /**
067   * Update related counts of puts.
068   */
069  void updatePut();
070
071  /**
072   * Update related counts of deletes.
073   */
074  void updateDelete();
075
076  /**
077   * Update time of gets
078   * @param mills time for this get operation.
079   */
080  void updateGet(long mills);
081
082  /**
083   * Update time used of resultScanner.next().
084   * */
085  void updateScanTime(long mills);
086
087  /**
088   * Update related counts of increments.
089   */
090  void updateIncrement();
091
092  /**
093   * Update related counts of appends.
094   */
095  void updateAppend();
096
097  /**
098   * Get the aggregate source to which this reports.
099   */
100  MetricsRegionAggregateSource getAggregateSource();
101
102
103}