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
057  /**
058   * Close the region's metrics as this region is closing.
059   */
060  void close();
061
062  /**
063   * Update related counts of puts.
064   */
065  void updatePut();
066
067  /**
068   * Update related counts of deletes.
069   */
070  void updateDelete();
071
072  /**
073   * Update time of gets
074   * @param mills time for this get operation.
075   */
076  void updateGet(long mills);
077
078  /**
079   * Update time used of resultScanner.next().
080   * */
081  void updateScanTime(long mills);
082
083  /**
084   * Update related counts of increments.
085   */
086  void updateIncrement();
087
088  /**
089   * Update related counts of appends.
090   */
091  void updateAppend();
092
093  /**
094   * Get the aggregate source to which this reports.
095   */
096  MetricsRegionAggregateSource getAggregateSource();
097
098
099}