View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.apache.hadoop.hbase.regionserver;
20  
21  import org.apache.hadoop.hbase.classification.InterfaceAudience;
22  import org.apache.hadoop.hbase.metrics.BaseSource;
23  
24  /**
25  * This interface will be implemented by a MetricsSource that will export metrics from
26  * multiple users into the hadoop metrics system.
27  */
28  @InterfaceAudience.Private
29  public interface MetricsUserAggregateSource extends BaseSource {
30  
31    /**
32     * The name of the metrics
33     */
34    static final String METRICS_NAME = "Users";
35  
36    /**
37     * The name of the metrics context that metrics will be under.
38     */
39    static final String METRICS_CONTEXT = "regionserver";
40  
41    /**
42     * Description
43     */
44    static final String METRICS_DESCRIPTION = "Metrics about users connected to the regionserver";
45  
46    /**
47     * The name of the metrics context that metrics will be under in jmx
48     */
49    static final String METRICS_JMX_CONTEXT = "RegionServer,sub=" + METRICS_NAME;
50  
51    static final String NUM_USERS = "numUsers";
52    static final String NUMBER_OF_USERS_DESC = "Number of users in the metrics system";
53  
54    /**
55     * Returns a MetricsUserSource if already exists, or creates and registers one for this user
56     * @param user the user name
57     * @return a metrics user source
58     */
59    MetricsUserSource getOrCreateMetricsUser(String user);
60  }