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.zookeeper;
019
020import org.apache.hadoop.hbase.metrics.BaseSource;
021import org.apache.yetus.audience.InterfaceAudience;
022
023/**
024 * Interface of the source that will export metrics about the ZooKeeper.
025 */
026@InterfaceAudience.Private
027public interface MetricsZooKeeperSource extends BaseSource {
028
029  /**
030   * The name of the metrics
031   */
032  String METRICS_NAME = "ZOOKEEPER";
033
034  /**
035   * The name of the metrics context that metrics will be under.
036   */
037  String METRICS_CONTEXT = "zookeeper";
038
039  /**
040   * Description
041   */
042  String METRICS_DESCRIPTION = "Metrics about ZooKeeper";
043
044  /**
045   * The name of the metrics context that metrics will be under in jmx.
046   */
047  String METRICS_JMX_CONTEXT = "ZooKeeper,sub=" + METRICS_NAME;
048
049  String EXCEPTION_AUTHFAILED = "AUTHFAILED Exception";
050  String EXCEPTION_AUTHFAILED_DESC = "Number of failed ops due to an AUTHFAILED exception,";
051  String EXCEPTION_CONNECTIONLOSS = "CONNECTIONLOSS Exception";
052  String EXCEPTION_CONNECTIONLOSS_DESC = "Number of failed ops due to a CONNECTIONLOSS exception.";
053  String EXCEPTION_DATAINCONSISTENCY = "DATAINCONSISTENCY Exception";
054  String EXCEPTION_DATAINCONSISTENCY_DESC = "Number of failed ops due to a DATAINCONSISTENCY exception.";
055  String EXCEPTION_INVALIDACL = "INVALIDACL Exception";
056  String EXCEPTION_INVALIDACL_DESC = "Number of failed ops due to an INVALIDACL exception";
057  String EXCEPTION_NOAUTH = "NOAUTH Exception";
058  String EXCEPTION_NOAUTH_DESC = "Number of failed ops due to a NOAUTH exception.";
059  String EXCEPTION_OPERATIONTIMEOUT = "OPERATIONTIMEOUT Exception";
060  String EXCEPTION_OPERATIONTIMEOUT_DESC = "Number of failed ops due to an OPERATIONTIMEOUT exception.";
061  String EXCEPTION_RUNTIMEINCONSISTENCY = "RUNTIMEINCONSISTENCY Exception";
062  String EXCEPTION_RUNTIMEINCONSISTENCY_DESC = "Number of failed ops due to a RUNTIMEINCONSISTENCY exception.";
063  String EXCEPTION_SESSIONEXPIRED = "SESSIONEXPIRED Exception";
064  String EXCEPTION_SESSIONEXPIRED_DESC = "Number of failed ops due to a SESSIONEXPIRED exception.";
065  String EXCEPTION_SYSTEMERROR = "SYSTEMERROR Exception";
066  String EXCEPTION_SYSTEMERROR_DESC = "Number of failed ops due to a SYSTEMERROR exception.";
067  String TOTAL_FAILED_ZK_CALLS = "TotalFailedZKCalls";
068  String TOTAL_FAILED_ZK_CALLS_DESC = "Total number of failed ZooKeeper API Calls";
069
070  String READ_OPERATION_LATENCY_NAME = "ReadOperationLatency";
071  String READ_OPERATION_LATENCY_DESC = "Latency histogram for read operations.";
072  String WRITE_OPERATION_LATENCY_NAME = "WriteOperationLatency";
073  String WRITE_OPERATION_LATENCY_DESC = "Latency histogram for write operations.";
074  String SYNC_OPERATION_LATENCY_NAME = "SyncOperationLatency";
075  String SYNC_OPERATION_LATENCY_DESC = "Latency histogram for sync operations.";
076
077  /**
078   * Increment the count of failed ops due to AUTHFAILED Exception.
079   */
080  void incrementAuthFailedCount();
081
082  /**
083   * Increment the count of failed ops due to a CONNECTIONLOSS Exception.
084   */
085  void incrementConnectionLossCount();
086
087  /**
088   * Increment the count of failed ops due to a DATAINCONSISTENCY Exception.
089   */
090  void incrementDataInconsistencyCount();
091
092  /**
093   * Increment the count of failed ops due to INVALIDACL Exception.
094   */
095  void incrementInvalidACLCount();
096
097  /**
098   * Increment the count of failed ops due to NOAUTH Exception.
099   */
100  void incrementNoAuthCount();
101
102  /**
103   * Increment the count of failed ops due to an OPERATIONTIMEOUT Exception.
104   */
105  void incrementOperationTimeoutCount();
106
107  /**
108   * Increment the count of failed ops due to RUNTIMEINCONSISTENCY Exception.
109   */
110  void incrementRuntimeInconsistencyCount();
111
112  /**
113   * Increment the count of failed ops due to a SESSIONEXPIRED Exception.
114   */
115  void incrementSessionExpiredCount();
116
117  /**
118   * Increment the count of failed ops due to a SYSTEMERROR Exception.
119   */
120  void incrementSystemErrorCount();
121
122  /**
123   * Record the latency incurred for read operations.
124   */
125  void recordReadOperationLatency(long latency);
126
127  /**
128   * Record the latency incurred for write operations.
129   */
130  void recordWriteOperationLatency(long latency);
131
132  /**
133   * Record the latency incurred for sync operations.
134   */
135  void recordSyncOperationLatency(long latency);
136
137  /**
138   * Record the total number of failed ZooKeeper API calls.
139   */
140  void incrementTotalFailedZKCalls();
141}