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.master;
020
021import org.apache.hadoop.hbase.metrics.BaseSource;
022import org.apache.hadoop.hbase.metrics.OperationMetrics;
023import org.apache.yetus.audience.InterfaceAudience;
024
025@InterfaceAudience.Private
026public interface MetricsAssignmentManagerSource extends BaseSource {
027
028  /**
029   * The name of the metrics
030   */
031  String METRICS_NAME = "AssignmentManager";
032
033  /**
034   * The context metrics will be under.
035   */
036  String METRICS_CONTEXT = "master";
037
038  /**
039   * The name of the metrics context that metrics will be under in jmx
040   */
041  String METRICS_JMX_CONTEXT = "Master,sub=" + METRICS_NAME;
042
043  /**
044   * Description
045   */
046  String METRICS_DESCRIPTION = "Metrics about HBase master assignment manager.";
047
048  // RIT metrics
049  String RIT_COUNT_NAME = "ritCount";
050  String RIT_COUNT_OVER_THRESHOLD_NAME = "ritCountOverThreshold";
051  String RIT_OLDEST_AGE_NAME = "ritOldestAge";
052  String RIT_DURATION_NAME = "ritDuration";
053
054  String RIT_COUNT_DESC = "Current number of Regions In Transition (Gauge).";
055  String RIT_COUNT_OVER_THRESHOLD_DESC =
056      "Current number of Regions In Transition over threshold time (Gauge).";
057  String RIT_OLDEST_AGE_DESC = "Timestamp in milliseconds of the oldest Region In Transition (Gauge).";
058  String RIT_DURATION_DESC =
059      "Total durations in milliseconds for all Regions in Transition (Histogram).";
060
061  String ASSIGN_METRIC_PREFIX = "assign";
062  String UNASSIGN_METRIC_PREFIX = "unassign";
063  String SPLIT_METRIC_PREFIX = "split";
064  String MERGE_METRIC_PREFIX = "merge";
065
066  String OPERATION_COUNT_NAME = "operationCount";
067
068  /**
069   * Set the number of regions in transition.
070   *
071   * @param ritCount count of the regions in transition.
072   */
073  void setRIT(int ritCount);
074
075  /**
076   * Set the count of the number of regions that have been in transition over the threshold time.
077   *
078   * @param ritCountOverThreshold number of regions in transition for longer than threshold.
079   */
080  void setRITCountOverThreshold(int ritCountOverThreshold);
081
082  /**
083   * Set the oldest region in transition.
084   *
085   * @param age age of the oldest RIT.
086   */
087  void setRITOldestAge(long age);
088
089  void updateRitDuration(long duration);
090
091  /**
092   * TODO: Remove. This may not be needed now as assign and unassign counts are tracked separately
093   * Increment the count of operations (assign/unassign).
094   */
095  void incrementOperationCounter();
096
097  /**
098   * @return {@link OperationMetrics} containing common metrics for assign operation
099   */
100  OperationMetrics getAssignMetrics();
101
102  /**
103   * @return {@link OperationMetrics} containing common metrics for unassign operation
104   */
105  OperationMetrics getUnassignMetrics();
106
107  /**
108   * @return {@link OperationMetrics} containing common metrics for split operation
109   */
110  OperationMetrics getSplitMetrics();
111
112  /**
113   * @return {@link OperationMetrics} containing common metrics for merge operation
114   */
115  OperationMetrics getMergeMetrics();
116}