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  String DEAD_SERVER_OPEN_REGIONS = "deadServerOpenRegions";
054  String UNKNOWN_SERVER_OPEN_REGIONS = "unknownServerOpenRegions";
055
056  String RIT_COUNT_DESC = "Current number of Regions In Transition (Gauge).";
057  String RIT_COUNT_OVER_THRESHOLD_DESC =
058      "Current number of Regions In Transition over threshold time (Gauge).";
059  String RIT_OLDEST_AGE_DESC = "Timestamp in milliseconds of the oldest Region In Transition (Gauge).";
060  String RIT_DURATION_DESC =
061      "Total durations in milliseconds for all Regions in Transition (Histogram).";
062
063  String ASSIGN_METRIC_PREFIX = "assign";
064  String UNASSIGN_METRIC_PREFIX = "unassign";
065  String MOVE_METRIC_PREFIX = "move";
066  String REOPEN_METRIC_PREFIX = "reopen";
067  String OPEN_METRIC_PREFIX = "open";
068  String CLOSE_METRIC_PREFIX = "close";
069  String SPLIT_METRIC_PREFIX = "split";
070  String MERGE_METRIC_PREFIX = "merge";
071
072  String OPERATION_COUNT_NAME = "operationCount";
073
074  /**
075   * Set the number of regions in transition.
076   *
077   * @param ritCount count of the regions in transition.
078   */
079  void setRIT(int ritCount);
080
081  /**
082   * Set the count of the number of regions that have been in transition over the threshold time.
083   *
084   * @param ritCountOverThreshold number of regions in transition for longer than threshold.
085   */
086  void setRITCountOverThreshold(int ritCountOverThreshold);
087
088  /**
089   * Set the oldest region in transition.
090   *
091   * @param age age of the oldest RIT.
092   */
093  void setRITOldestAge(long age);
094
095  void updateRitDuration(long duration);
096
097  void updateDeadServerOpenRegions(int deadRegions);
098
099  void updateUnknownServerOpenRegions(int unknownRegions);
100
101  /**
102   * TODO: Remove. This may not be needed now as assign and unassign counts are tracked separately
103   * Increment the count of operations (assign/unassign).
104   */
105  void incrementOperationCounter();
106
107  /**
108   * @return {@link OperationMetrics} containing common metrics for assign region operation
109   */
110  OperationMetrics getAssignMetrics();
111
112  /**
113   * @return {@link OperationMetrics} containing common metrics for unassign region operation
114   */
115  OperationMetrics getUnassignMetrics();
116
117  /**
118   * @return {@link OperationMetrics} containing common metrics for move region operation
119   */
120  OperationMetrics getMoveMetrics();
121
122  /**
123   * @return {@link OperationMetrics} containing common metrics for reopen region operation
124   */
125  OperationMetrics getReopenMetrics();
126
127  /**
128   * @return {@link OperationMetrics} containing common metrics for open region request
129   */
130  OperationMetrics getOpenMetrics();
131
132  /**
133   * @return {@link OperationMetrics} containing common metrics for close region request
134   */
135  OperationMetrics getCloseMetrics();
136
137  /**
138   * @return {@link OperationMetrics} containing common metrics for split operation
139   */
140  OperationMetrics getSplitMetrics();
141
142  /**
143   * @return {@link OperationMetrics} containing common metrics for merge operation
144   */
145  OperationMetrics getMergeMetrics();
146}