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.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  /**
032   * The name of the metrics
033   */
034  String METRICS_NAME = "WAL";
035
036  /**
037   * The name of the metrics context that metrics will be under.
038   */
039  String METRICS_CONTEXT = "regionserver";
040
041  /**
042   * Description
043   */
044  String METRICS_DESCRIPTION = "Metrics about HBase RegionServer WAL";
045
046  /**
047   * The name of the metrics context that metrics will be under in jmx
048   */
049  String METRICS_JMX_CONTEXT = "RegionServer,sub=" + METRICS_NAME;
050
051
052  String APPEND_TIME = "appendTime";
053  String APPEND_TIME_DESC = "Time an append to the log took.";
054  String APPEND_COUNT = "appendCount";
055  String APPEND_COUNT_DESC = "Number of appends to the write ahead log.";
056  String APPEND_SIZE = "appendSize";
057  String APPEND_SIZE_DESC = "Size (in bytes) of the data appended to the WAL.";
058  String SLOW_APPEND_COUNT = "slowAppendCount";
059  String SLOW_APPEND_COUNT_DESC = "Number of appends that were slow.";
060  String SYNC_TIME = "syncTime";
061  String SYNC_TIME_DESC = "The time it took to sync the WAL to HDFS.";
062  String ROLL_REQUESTED = "rollRequest";
063  String ROLL_REQUESTED_DESC = "How many times a roll has been requested total";
064  String ERROR_ROLL_REQUESTED = "errorRollRequest";
065  String ERROR_ROLL_REQUESTED_DESC =
066      "How many times a roll was requested due to I/O or other errors.";
067  String LOW_REPLICA_ROLL_REQUESTED = "lowReplicaRollRequest";
068  String LOW_REPLICA_ROLL_REQUESTED_DESC =
069      "How many times a roll was requested due to too few datanodes in the write pipeline.";
070  String SLOW_SYNC_ROLL_REQUESTED = "slowSyncRollRequest";
071  String SLOW_SYNC_ROLL_REQUESTED_DESC =
072      "How many times a roll was requested due to sync too slow on the write pipeline.";
073  String SIZE_ROLL_REQUESTED = "sizeRollRequest";
074  String SIZE_ROLL_REQUESTED_DESC =
075      "How many times a roll was requested due to file size roll threshold.";
076  String WRITTEN_BYTES = "writtenBytes";
077  String WRITTEN_BYTES_DESC = "Size (in bytes) of the data written to the WAL.";
078
079  /**
080   * Add the append size.
081   */
082  void incrementAppendSize(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();
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  long getWrittenBytes();
119}