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 log roll has been requested total";
064  String LOW_REPLICA_ROLL_REQUESTED = "lowReplicaRollRequest";
065  String LOW_REPLICA_ROLL_REQUESTED_DESC =
066      "How many times a log roll was requested due to too few DN's in the write pipeline.";
067  String WRITTEN_BYTES = "writtenBytes";
068  String WRITTEN_BYTES_DESC = "Size (in bytes) of the data written to the WAL.";
069
070  /**
071   * Add the append size.
072   */
073  void incrementAppendSize(long size);
074
075  /**
076   * Add the time it took to append.
077   */
078  void incrementAppendTime(long time);
079
080  /**
081   * Increment the count of wal appends
082   */
083  void incrementAppendCount();
084
085  /**
086   * Increment the number of appends that were slow
087   */
088  void incrementSlowAppendCount();
089
090  /**
091   * Add the time it took to sync the wal.
092   */
093  void incrementSyncTime(long time);
094
095  void incrementLogRollRequested();
096
097  void incrementLowReplicationLogRoll();
098
099  long getSlowAppendCount();
100
101  void incrementWrittenBytes(long val);
102
103  long getWrittenBytes();
104}