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