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