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 =
055    "Number of failed ops due to a DATAINCONSISTENCY exception.";
056  String EXCEPTION_INVALIDACL = "INVALIDACL Exception";
057  String EXCEPTION_INVALIDACL_DESC = "Number of failed ops due to an INVALIDACL exception";
058  String EXCEPTION_NOAUTH = "NOAUTH Exception";
059  String EXCEPTION_NOAUTH_DESC = "Number of failed ops due to a NOAUTH exception.";
060  String EXCEPTION_OPERATIONTIMEOUT = "OPERATIONTIMEOUT Exception";
061  String EXCEPTION_OPERATIONTIMEOUT_DESC =
062    "Number of failed ops due to an OPERATIONTIMEOUT exception.";
063  String EXCEPTION_RUNTIMEINCONSISTENCY = "RUNTIMEINCONSISTENCY Exception";
064  String EXCEPTION_RUNTIMEINCONSISTENCY_DESC =
065    "Number of failed ops due to a RUNTIMEINCONSISTENCY exception.";
066  String EXCEPTION_SESSIONEXPIRED = "SESSIONEXPIRED Exception";
067  String EXCEPTION_SESSIONEXPIRED_DESC = "Number of failed ops due to a SESSIONEXPIRED exception.";
068  String EXCEPTION_SYSTEMERROR = "SYSTEMERROR Exception";
069  String EXCEPTION_SYSTEMERROR_DESC = "Number of failed ops due to a SYSTEMERROR exception.";
070  String TOTAL_FAILED_ZK_CALLS = "TotalFailedZKCalls";
071  String TOTAL_FAILED_ZK_CALLS_DESC = "Total number of failed ZooKeeper API Calls";
072
073  String READ_OPERATION_LATENCY_NAME = "ReadOperationLatency";
074  String READ_OPERATION_LATENCY_DESC = "Latency histogram for read operations.";
075  String WRITE_OPERATION_LATENCY_NAME = "WriteOperationLatency";
076  String WRITE_OPERATION_LATENCY_DESC = "Latency histogram for write operations.";
077  String SYNC_OPERATION_LATENCY_NAME = "SyncOperationLatency";
078  String SYNC_OPERATION_LATENCY_DESC = "Latency histogram for sync operations.";
079
080  /**
081   * Increment the count of failed ops due to AUTHFAILED Exception.
082   */
083  void incrementAuthFailedCount();
084
085  /**
086   * Increment the count of failed ops due to a CONNECTIONLOSS Exception.
087   */
088  void incrementConnectionLossCount();
089
090  /**
091   * Increment the count of failed ops due to a DATAINCONSISTENCY Exception.
092   */
093  void incrementDataInconsistencyCount();
094
095  /**
096   * Increment the count of failed ops due to INVALIDACL Exception.
097   */
098  void incrementInvalidACLCount();
099
100  /**
101   * Increment the count of failed ops due to NOAUTH Exception.
102   */
103  void incrementNoAuthCount();
104
105  /**
106   * Increment the count of failed ops due to an OPERATIONTIMEOUT Exception.
107   */
108  void incrementOperationTimeoutCount();
109
110  /**
111   * Increment the count of failed ops due to RUNTIMEINCONSISTENCY Exception.
112   */
113  void incrementRuntimeInconsistencyCount();
114
115  /**
116   * Increment the count of failed ops due to a SESSIONEXPIRED Exception.
117   */
118  void incrementSessionExpiredCount();
119
120  /**
121   * Increment the count of failed ops due to a SYSTEMERROR Exception.
122   */
123  void incrementSystemErrorCount();
124
125  /**
126   * Record the latency incurred for read operations.
127   */
128  void recordReadOperationLatency(long latency);
129
130  /**
131   * Record the latency incurred for write operations.
132   */
133  void recordWriteOperationLatency(long latency);
134
135  /**
136   * Record the latency incurred for sync operations.
137   */
138  void recordSyncOperationLatency(long latency);
139
140  /**
141   * Record the total number of failed ZooKeeper API calls.
142   */
143  void incrementTotalFailedZKCalls();
144}