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.wal;
019
020import org.apache.hadoop.hbase.TableName;
021import org.apache.hadoop.hbase.metrics.BaseSource;
022import org.apache.yetus.audience.InterfaceAudience;
023
024/**
025 * Interface of the source that will export metrics about the region server's WAL.
026 */
027@InterfaceAudience.Private
028public interface MetricsWALSource extends BaseSource {
029
030  /**
031   * The name of the metrics
032   */
033  String METRICS_NAME = "WAL";
034
035  /**
036   * The name of the metrics context that metrics will be under.
037   */
038  String METRICS_CONTEXT = "regionserver";
039
040  /**
041   * Description
042   */
043  String METRICS_DESCRIPTION = "Metrics about HBase RegionServer WAL";
044
045  /**
046   * The name of the metrics context that metrics will be under in jmx
047   */
048  String METRICS_JMX_CONTEXT = "RegionServer,sub=" + METRICS_NAME;
049
050  String APPEND_TIME = "appendTime";
051  String APPEND_TIME_DESC = "Time an append to the log took.";
052  String APPEND_COUNT = "appendCount";
053  String APPEND_COUNT_DESC = "Number of appends to the write ahead log.";
054  String APPEND_SIZE = "appendSize";
055  String APPEND_SIZE_DESC = "Size (in bytes) of the data appended to the WAL.";
056  String SLOW_APPEND_COUNT = "slowAppendCount";
057  String SLOW_APPEND_COUNT_DESC = "Number of appends that were slow.";
058  String SYNC_TIME = "syncTime";
059  String SYNC_TIME_DESC = "The time it took to sync the WAL to HDFS.";
060  String ROLL_REQUESTED = "rollRequest";
061  String ROLL_REQUESTED_DESC = "How many times a roll has been requested total";
062  String ERROR_ROLL_REQUESTED = "errorRollRequest";
063  String ERROR_ROLL_REQUESTED_DESC =
064    "How many times a roll was requested due to I/O or other errors.";
065  String LOW_REPLICA_ROLL_REQUESTED = "lowReplicaRollRequest";
066  String LOW_REPLICA_ROLL_REQUESTED_DESC =
067    "How many times a roll was requested due to too few datanodes in the write pipeline.";
068  String SLOW_SYNC_ROLL_REQUESTED = "slowSyncRollRequest";
069  String SLOW_SYNC_ROLL_REQUESTED_DESC =
070    "How many times a roll was requested due to sync too slow on the write pipeline.";
071  String SIZE_ROLL_REQUESTED = "sizeRollRequest";
072  String SIZE_ROLL_REQUESTED_DESC =
073    "How many times a roll was requested due to file size roll threshold.";
074  String WRITTEN_BYTES = "writtenBytes";
075  String WRITTEN_BYTES_DESC = "Size (in bytes) of the data written to the WAL.";
076  String SUCCESSFUL_LOG_ROLLS = "successfulLogRolls";
077  String SUCCESSFUL_LOG_ROLLS_DESC = "Number of successful log rolls requests";
078
079  /**
080   * Add the append size.
081   */
082  void incrementAppendSize(TableName tableName, long size);
083
084  /**
085   * Add the time it took to append.
086   */
087  void incrementAppendTime(long time);
088
089  /**
090   * Increment the count of wal appends
091   */
092  void incrementAppendCount(TableName tableName);
093
094  /**
095   * Increment the number of appends that were slow
096   */
097  void incrementSlowAppendCount();
098
099  /**
100   * Add the time it took to sync the wal.
101   */
102  void incrementSyncTime(long time);
103
104  void incrementLogRollRequested();
105
106  void incrementErrorLogRoll();
107
108  void incrementLowReplicationLogRoll();
109
110  long getSlowAppendCount();
111
112  void incrementSlowSyncLogRoll();
113
114  void incrementSizeLogRoll();
115
116  void incrementWrittenBytes(long val);
117
118  /**
119   * Increment the number of successful log roll requests.
120   */
121  void incrementSuccessfulLogRolls();
122
123  long getSuccessfulLogRolls();
124}