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.master;
019
020import org.apache.hadoop.hbase.metrics.BaseSource;
021import org.apache.hadoop.hbase.metrics.OperationMetrics;
022import org.apache.yetus.audience.InterfaceAudience;
023
024@InterfaceAudience.Private
025public interface MetricsAssignmentManagerSource extends BaseSource {
026
027  /**
028   * The name of the metrics
029   */
030  String METRICS_NAME = "AssignmentManager";
031
032  /**
033   * The context metrics will be under.
034   */
035  String METRICS_CONTEXT = "master";
036
037  /**
038   * The name of the metrics context that metrics will be under in jmx
039   */
040  String METRICS_JMX_CONTEXT = "Master,sub=" + METRICS_NAME;
041
042  /**
043   * Description
044   */
045  String METRICS_DESCRIPTION = "Metrics about HBase master assignment manager.";
046
047  // RIT metrics
048  String RIT_COUNT_NAME = "ritCount";
049  String RIT_COUNT_OVER_THRESHOLD_NAME = "ritCountOverThreshold";
050  String RIT_OLDEST_AGE_NAME = "ritOldestAge";
051  String RIT_DURATION_NAME = "ritDuration";
052  String DEAD_SERVER_OPEN_REGIONS = "deadServerOpenRegions";
053  String UNKNOWN_SERVER_OPEN_REGIONS = "unknownServerOpenRegions";
054
055  String RIT_COUNT_DESC = "Current number of Regions In Transition (Gauge).";
056  String RIT_COUNT_OVER_THRESHOLD_DESC =
057    "Current number of Regions In Transition over threshold time (Gauge).";
058  String RIT_OLDEST_AGE_DESC =
059    "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  // HBCK report metrics
064  String ORPHAN_REGIONS_ON_RS = "orphanRegionsOnRS";
065  String ORPHAN_REGIONS_ON_FS = "orphanRegionsOnFS";
066  String INCONSISTENT_REGIONS = "inconsistentRegions";
067
068  String ORPHAN_REGIONS_ON_RS_DESC = "Current number of Orphan Regions on RS (Gauge).";
069  String ORPHAN_REGIONS_ON_FS_DESC = "Current number of Orphan Regions on FS (Gauge).";
070  String INCONSISTENT_REGIONS_DESC = "Current number of Inconsistent Regions (Gauge).";
071
072  // CatalogJanitor Consistency report metrics
073  String HOLES = "holes";
074  String OVERLAPS = "overlaps";
075  String UNKNOWN_SERVER_REGIONS = "unknownServerRegions";
076  String EMPTY_REGION_INFO_REGIONS = "emptyRegionInfoRegions";
077
078  String HOLES_DESC = "Current number of Holes (Gauge).";
079  String OVERLAPS_DESC = "Current number of Overlaps (Gauge).";
080  String UNKNOWN_SERVER_REGIONS_DESC = "Current number of Unknown Server Regions (Gauge).";
081  String EMPTY_REGION_INFO_REGIONS_DESC =
082    "Current number of Regions with Empty Region Info (Gauge).";
083
084  String ASSIGN_METRIC_PREFIX = "assign";
085  String UNASSIGN_METRIC_PREFIX = "unassign";
086  String MOVE_METRIC_PREFIX = "move";
087  String REOPEN_METRIC_PREFIX = "reopen";
088  String OPEN_METRIC_PREFIX = "open";
089  String CLOSE_METRIC_PREFIX = "close";
090  String SPLIT_METRIC_PREFIX = "split";
091  String MERGE_METRIC_PREFIX = "merge";
092
093  String OPERATION_COUNT_NAME = "operationCount";
094
095  /**
096   * Set the number of regions in transition.
097   * @param ritCount count of the regions in transition.
098   */
099  void setRIT(int ritCount);
100
101  /**
102   * Set the count of the number of regions that have been in transition over the threshold time.
103   * @param ritCountOverThreshold number of regions in transition for longer than threshold.
104   */
105  void setRITCountOverThreshold(int ritCountOverThreshold);
106
107  /**
108   * Set the oldest region in transition.
109   * @param age age of the oldest RIT.
110   */
111  void setRITOldestAge(long age);
112
113  void updateRitDuration(long duration);
114
115  void updateDeadServerOpenRegions(int deadRegions);
116
117  void updateUnknownServerOpenRegions(int unknownRegions);
118
119  /**
120   * Set the number of orphan regions on RS.
121   * @param orphanRegionsOnRs count of the orphan regions on RS in HBCK chore report.
122   */
123  void setOrphanRegionsOnRs(int orphanRegionsOnRs);
124
125  /**
126   * Set the number of orphan regions on FS.
127   * @param orphanRegionsOnFs count of the orphan regions on FS in HBCK chore report.
128   */
129  void setOrphanRegionsOnFs(int orphanRegionsOnFs);
130
131  /**
132   * Set the number of inconsistent regions.
133   * @param inconsistentRegions count of the inconsistent regions in HBCK chore report.
134   */
135  void setInconsistentRegions(int inconsistentRegions);
136
137  /**
138   * Set the number of holes.
139   * @param holes count of the holes in CatalogJanitor Consistency report.
140   */
141  void setHoles(int holes);
142
143  /**
144   * Set the number of overlaps.
145   * @param overlaps count of the overlaps in CatalogJanitor Consistency report.
146   */
147  void setOverlaps(int overlaps);
148
149  /**
150   * Set the number of unknown server regions.
151   * @param unknownServerRegions count of the unknown server regions in CatalogJanitor Consistency
152   *                             report.
153   */
154  void setUnknownServerRegions(int unknownServerRegions);
155
156  /**
157   * Set the number of regions with empty region info.
158   * @param emptyRegionInfoRegions count of the regions with empty region info in CatalogJanitor
159   *                               Consistency report.
160   */
161  void setEmptyRegionInfoRegions(int emptyRegionInfoRegions);
162
163  /**
164   * TODO: Remove. This may not be needed now as assign and unassign counts are tracked separately
165   * Increment the count of operations (assign/unassign).
166   */
167  void incrementOperationCounter();
168
169  /**
170   * @return {@link OperationMetrics} containing common metrics for assign region operation
171   */
172  OperationMetrics getAssignMetrics();
173
174  /**
175   * @return {@link OperationMetrics} containing common metrics for unassign region operation
176   */
177  OperationMetrics getUnassignMetrics();
178
179  /**
180   * @return {@link OperationMetrics} containing common metrics for move region operation
181   */
182  OperationMetrics getMoveMetrics();
183
184  /**
185   * @return {@link OperationMetrics} containing common metrics for reopen region operation
186   */
187  OperationMetrics getReopenMetrics();
188
189  /**
190   * @return {@link OperationMetrics} containing common metrics for open region request
191   */
192  OperationMetrics getOpenMetrics();
193
194  /**
195   * @return {@link OperationMetrics} containing common metrics for close region request
196   */
197  OperationMetrics getCloseMetrics();
198
199  /**
200   * @return {@link OperationMetrics} containing common metrics for split operation
201   */
202  OperationMetrics getSplitMetrics();
203
204  /**
205   * @return {@link OperationMetrics} containing common metrics for merge operation
206   */
207  OperationMetrics getMergeMetrics();
208}