---
title: "OBKV-HBase 监控指标 - OceanBase 数据库 V4.4.2 | OceanBase 文档中心"
description: OBKV-HBase 监控指标 本文介绍了 OBKV-HBase 相关的服务端和客户端监控指标，包含指标说明和使用方法。 服务端监控指标 可以通过以下视图查询 OBKV-HBase 相关的服务端监控指标： 视图 功能描述 GV$SYSSTAT 查询 OBKV-HBase 的 QPS/RT/ROWS 相关指标 GV$O…
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

文档反馈![](https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*P8CuR4UJ_FkAAAAAAAAAAAAADiGDAQ/original) OceanBase 数据库KV 型 - V 4.4.2 LTS

# OBKV-HBase 监控指标

更新时间：2026-07-23 19:56:22

[编辑](https://github.com/oceanbase/oceanbase-kv/edit/V4.4.2/zh-CN/200.obkv-hbase/300.obkv-hbase-manage/200.obkv-hbase-monitor-items.md)  

本文介绍了 OBKV-HBase 相关的服务端和客户端监控指标，包含指标说明和使用方法。

## 服务端监控指标

可以通过以下视图查询 OBKV-HBase 相关的服务端监控指标：

| 视图 | 功能描述 |
| --- | --- |
| [GV$SYSSTAT](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000003977915) | 查询 OBKV-HBase 的 QPS/RT/ROWS 相关指标 |
| [GV$OB_SQL_AUDIT](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000003977915) | 查询 OBKV-HBase 的慢请求定位 |
| [GV$OB_QUERY_RESPONSE_TIME_HISTOGRAM](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000003977915) | 查询 OBKV-HBase 的 P99 等性能指标 |

具体如下：

### QPS/RT/ROWS 相关指标

QPS/RT/ROWS 相关指标通过 `GV$SYSSTAT` 视图查询。

#### 查询所有监控指标

```shell
MySQL [oceanbase]> SELECT DISTINCT class,stat_id,name, value_type FROM GV$SYSSTAT WHERE name LIKE "hbase%";

```

返回结果字段样例如下（返回结果包含所有 HBase 监控指标，完整列表请参考下方参数说明表格）：

```shell
+-------+---------+------------------------------+------------+
| class | stat_id | name                         | value_type |
+-------+---------+------------------------------+------------+
|  4096 |  191001 | hbase scan count             | ADD_VALUE  |
+-------+---------+------------------------------+------------+

```

#### （推荐）按租户查询特定监控指标

查询示例如下：

```shell
# 查询 checkAndMutate 的指标
MySQL [oceanbase]> SELECT * FROM oceanbase.GV$SYSSTAT
    WHERE name LIKE '%hbase check_mutate%'
    AND con_id = (SELECT tenant_id FROM oceanbase.DBA_OB_TENANTS WHERE tenant_name = 'your_tenant_name'); -- 指定租户名称

```

支持的 `name` 参数列表及说明如下：

| Name | 描述 |
| --- | --- |
| hbase scan count | Scan 操作的次数 |
| hbase scan time | Scan 操作执行总耗时 |
| hbase scan row count | Scan 操作扫描的 Cell 数 |
| hbase put count | Put 操作的次数 |
| hbase put time | Put 操作执行总耗时 |
| hbase put row count | Put 操作的 Cell 数 |
| hbase delete count | delete 操作的次数 |
| hbase delete time | delete 操作执行总耗时 |
| hbase delete row count | delete 操作的 Cell 数 |
| hbase append count | append 操作的次数 |
| hbase append time | append 操作执行总耗时 |
| hbase append row count | append 操作的 Cell 数 |
| hbase increment count | increment 操作的次数 |
| hbase increment time | increment 操作执行总耗时 |
| hbase increment row count | increment 操作的 Cell 数 |
| hbase check_put count | checkAndPut 操作的次数 |
| hbase check_put time | checkAndPut 操作执行总耗时 |
| hbase check_put row count | checkAndPut 操作的 Cell 数 |
| hbase check_delete count | checkAndDelete 操作的次数 |
| hbase check_delete time | checkAndDelete 操作执行总耗时 |
| hbase check_delete row count | checkAndDelete 操作的 Cell 数 |
| hbase check_mutate | checkAndMutate 操作的次数，需要同时搭配 OBKV-Table V2.3.0 和 OBKV-HBase V1.5.0/V2.5.0 及以上客户端使用 |
| hbase scan | scan 操作的次数，需要同时搭配 OBKV-Table V2.3.0 和 OBKV-HBase V1.5.0/V2.5.0 及以上客户端使用 |
| hbase get | get 操作的次数，需要同时搭配 OBKV-Table V2.3.0 和 OBKV-HBase V1.5.0/V2.5.0 及以上客户端使用 |
| hbase batch put | batch put 操作的次数，需要同时搭配 OBKV-Table V2.3.0 和 OBKV-HBase V1.5.0/V2.5.0 及以上客户端使用 |
| hbase batch delete | batch delete 操作的次数，需要同时搭配 OBKV-Table V2.3.0 和 OBKV-HBase V1.5.0/V2.5.0 及以上客户端使用 |
| hbase batch get | batch get 操作的次数，需要同时搭配 OBKV-Table V2.3.0 和 OBKV-HBase V1.5.0/V2.5.0 及以上客户端使用 |
| obkv failed operation | OBKV 失败操作的次数，需要同时搭配 OBKV-Table V2.3.0 和 OBKV-HBase V1.5.0/V2.5.0 及以上客户端使用 |

其他监控指标的详细信息，请参见 [GV$SYSSTAT](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000003978968)。

### 定位慢 HBase 请求

SQL Audit 是 OceanBase 数据库中一个比较重要的诊断工具，其中记录了每个请求缓存命中率，Memtable/Sstable 等扫描行数以及执行时间等，可以方便的帮助定位慢请求的瓶颈点。OBKV-HBase 适配了 SQL Audit 能力，用户可以用如下查询语句来过滤 OBKV-HBase 相关的诊断记录：

```shell
MySQL [oceanbase]> SELECT * FROM v$OB_SQL_AUDIT WHERE query_sql LIKE "table api: hbase%" \G;

```

返回结果示例如下：

```shell
*************************** 1. row ***************************
                         SVR_IP: 11.xxx.xxx.xxx
                       SVR_PORT: 54302
                     REQUEST_ID: 13841
                    SQL_EXEC_ID: 0
                       TRACE_ID: Y1EB2D1EB6D984-0000000000000002-0-0
                            SID: 0
                      CLIENT_IP: 30.xxx.xxx.xxx
                    CLIENT_PORT: 60205
                      TENANT_ID: 1
                    TENANT_NAME: sys
            EFFECTIVE_TENANT_ID: 1
                        USER_ID: 200001
                      USER_NAME: root
                     USER_GROUP: 0
                 USER_CLIENT_IP: 30.xxx.xxx.xxx
                          DB_ID: 500001
                        DB_NAME: test
                         SQL_ID: TABLEAPI0x1103vv00000000CB87E8C9
                      QUERY_SQL: table api: hbase_put,
request: {credential:0193808080000101C19A0CA1C21E00FABAF9E6C0B589AEDB01, table_name:"htable1$family", table_id:500014, tablet_id:{id:200055}, entity_type:2, batch_operation:{is_readonly:false, is_same_type:true, is_same_properties_names:true, operatiton_count:1, table_operations:[{operation_type:4, entity:"{rowkey_names:[]rowkey:[{"VARCHAR":"testKey0", collation:"utf8mb4_general_ci", coercibility:"EXPLICIT"}, {"VARCHAR":"column", collation:"utf8mb4_general_ci", coercibility:"EXPLICIT"}, {"BIGINT":-9223372036854775807}], properties:{V:{"VARCHAR":"putValue", collation:"utf8mb4_general_ci", coercibility:"EXPLICIT"}}}"}]}, consistency_level:0, option_flag:0, returning_affected_entity:false, returning_affected_rows:true, batch_operation_as_atomic:false}

```

其他慢请求定位的详细信息，请参见 [GV$OB_SQL_AUDIT](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000003981236)。

### P99 等性能指标

OBKV-HBase 将各个操作的执行耗时统计在了直方图中，用户可以通过 `V$OB_QUERY_RESPONSE_TIME_HISTOGRAM` 视图，结合 Prometheus 统计各个操作的 P95、P99 等性能指标。

查询示例如下：

```shell
# 查询 checkAndMutate 的指标
MySQL [oceanbase]> SELECT * FROM oceanbase.GV$OB_QUERY_RESPONSE_TIME_HISTOGRAM
    WHERE sql_type LIKE '%HBASE CHECK AND MUTATE%'; -- 指定操作类型

```

支持的 `sql_type` 及其他详细信息，请参见 [GV$OB_QUERY_RESPONSE_TIME_HISTOGRAM](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000003977915)。

## 客户端监控指标

这部分主要介绍如何使用 OBKV-HBase MetricsExporter 以及 jconsole 查看客户端操作监控指标。

### 使用 MetricsExporter 获取对应操作监控指标

MetricsExporter 包含下列指标：

| 指标项 | 说明 |
| --- | --- |
| FailRate | 对应接口的平均失败率 |
| FailCount | 对应接口的失败次数 |
| TotalRuntime | 对应接口的总执行时间 |
| AverageSingleOpCount | 对应接口涉及的操作数量，对批操作则为批操作 List 的长度 |
| Count | 对应接口的调用次数 |
| AverageOps | 对应接口的平均OPS |
| OneMinuteAverageOps | 对应接口1分钟内平均OPS |
| FiveMinuteAverageOps | 对应接口5分钟内平均OPS |
| FifteenMinuteAverageOps | 对应接口15分钟内平均OPS |
| AverageLatency | 对应接口的平均RT |
| MaxLatency | 对应接口的最大RT |
| MinLatency | 对应接口的最小RT |
| MedianLatency | 对应接口的中位数RT |
| P75thPercentile | 对应接口的 P75 RT |
| P95thPercentile | 对应接口的 P95 RT |
| P98thPercentile | 对应接口的 P98 RT |
| P99thPercentile | 对应接口的 P99 RT |
| P999thPercentile | 对应接口的 P999 RT |

#### 使用方法

```shell
# 示例代码
Configuration conf = ObHTableTestUtil.newConfiguration();
// important!! enable metrics
conf.set(CLIENT_SIDE_METRICS_ENABLED_KEY, "true");
Connection connection = ConnectionFactory.createConnection(conf);
Table hTable = connection.getTable(TableName.valueOf("test_metrics"));
OHMetrics metrics = ((OHTable) hTable).getMetrics();
// GET_LIST metrics
MetricsExporter exporter = metrics.acquireMetrics(OHOperationType.GET_LIST);
System.out.println("AverageOps: " + exporter.getAverageOps());
System.out.println("99thPercentile: " + exporter.get99thPercentile());
System.out.println("AverageSingleOpCount: " + exporter.getAverageSingleOpCount());

```

### 使用 JMX 查看客户端监控指标

可以通过以下两种方式查看客户端监控指标：

- 使用 MBeanServer 查看
 - 使用 jconsole 查看

#### 使用 MBeanServer 查看

使用 MBeanServer 查看客户端监控指标的示例代码如下：

```shell
# 示例代码
import javax.management.*;
import java.lang.management.ManagementFactory;

MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
/**
 * acquire the ObjectName of a specific attribute in JMX
 *
 * @param opType OHOperationType
 * @param metricsName metrics name
 * @param attributeName attribute name (latencyHistogram, failedOpCounter, totalSingleOpCount, totalRuntime)
 * @return ObjectName
 */
public ObjectName getObjectName(OHOperationType opType, String metricsName,
                                String attributeName) {
    try {
        // the format of JMX name: domain:name=metricName
        // example: com.alipay.oceanbase.hbase.util.OHMetrics.PUT.latencyHistogram.metricsName
        String name = String.format("%s.%s.%s.%s",
                OHMetrics.class.getName(),
                opType.name(),
                attributeName,
                metricsName);

        String objectNameStr = String.format("%s:name=%s",
            JMX_DOMAIN, name);
        return new ObjectName(objectNameStr);
    } catch (MalformedObjectNameException e) {
        throw new RuntimeException("Failed to create ObjectName", e);
    }
}

/**
 * acquire latency attribute
 * Timer attributes: Count, MeanRate, OneMinuteRate, FiveMinuteRate, FifteenMinuteRate
 * Min, Max, Mean, StdDev, 50thPercentile, 75thPercentile, 95thPercentile, 98thPercentile, 99thPercentile, 999thPercentile
 */
public Object getTimerAttribute(OHOperationType opType, String metricsName, String attributeName) {
    try {
        ObjectName objectName = getObjectName(opType, metricsName, "latencyHistogram");
        return mBeanServer.getAttribute(objectName, attributeName);
    } catch (Exception e) {
        throw new RuntimeException("Failed to get Timer attribute: " + attributeName, e);
    }
}

/**
 * acquire failed operations attribute
 * Meter attributes: Count, MeanRate, OneMinuteRate, FiveMinuteRate, FifteenMinuteRate
 */
public Object getMeterAttribute(OHOperationType opType, String metricsName, String attributeName) {
    try {
        ObjectName objectName = getObjectName(opType, metricsName, "failedOpCounter");
        return mBeanServer.getAttribute(objectName, attributeName);
    } catch (Exception e) {
        throw new RuntimeException("Failed to get Meter attribute: " + attributeName, e);
    }
}

/**
 * acquire Counter attribute
 * Counter attributes: Count
 */
public Object getCounterAttribute(OHOperationType opType, String metricsName,
                                 String counterName, String attributeName) {
    try {
        ObjectName objectName = getObjectName(opType, metricsName, counterName);
        return mBeanServer.getAttribute(objectName, attributeName);
    } catch (Exception e) {
        throw new RuntimeException("Failed to get Counter attribute: " + attributeName, e);
    }
}

Configuration config = ObHTableTestUtil.newConfiguration();
// important!! enable metrics
config.set(CLIENT_SIDE_METRICS_ENABLED_KEY, "true");
Connection connection = ConnectionFactory.createConnection(config);
Table hTable = connection.getTable(TableName.valueOf("test_multi_cf"));
String metricsName;
if (hTable instanceof OHTable) {
    OHMetrics metrics = ((OHTable) hTable).getMetrics();
    if (metrics != null) {
        metricsName = metrics.getMetricsName();
    }
}
// PUT metrics
// latency histogram
Long totalOpCount = (Long) getTimerAttribute(OHOperationType.PUT, metricsName, "Count");
Double meanOps = (Double) getTimerAttribute(OHOperationType.PUT, metricsName, "MeanRate");
Double oneMinuteRateOps = (Double) getTimerAttribute(OHOperationType.PUT, metricsName, "OneMinuteRate");
Double meanLatency = (Double) getTimerAttribute(OHOperationType.PUT, metricsName, "Mean");
Double minLatency = (Double) getTimerAttribute(OHOperationType.PUT, metricsName, "Min");
Double maxLatency = (Double) getTimerAttribute(OHOperationType.PUT, metricsName, "Max");
Double P99thPercentile = (Double) getTimerAttribute(OHOperationType.PUT, metricsName, "99thPercentile");

// failure operations
Long failedOpCount = (Long) getMeterAttribute(OHOperationType.PUT, metricsName, "Count");
Double meanFailRate = (Double) getMeterAttribute(OHOperationType.PUT, metricsName, "MeanRate");
Double oneMinuteFailRate = (Double) getMeterAttribute(OHOperationType.PUT, metricsName, "OneMinuteRate");

// Counter
Double totalSingleOpCount = (Long) getCounterAttribute(OHOperationType.PUT, metricsName, "totalSingleOpCount", "Count");
Double totalRuntime = (Long) getCounterAttribute(OHOperationType.PUT, metricsName, "totalRuntime", "Count");

```

#### 使用 jconsole 查看

在 Hadoop Configuration 中将 `CLIENT_SIDE_METRICS_ENABLED_KEY` 设置为 `true`。启动 OBKV-HBase 客户端进程，在终端执行 `ps -ef | grep idea` 查看进程 PID。在终端执行 `jconsole $PID` 打开 JMX 界面。在 MBean 下可以看到 `com.oceanbase.hbase.metrics` 文件夹，内部是所有接口操作的监控项。

![jconsole](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/observer/kv/V4.4.2/%E5%AE%A2%E6%88%B7%E7%AB%AF%E7%9B%91%E6%8E%A7jconsole.png)

 上一篇 下一篇 ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
