This topic describes the monitoring metrics related to the number of objects within an OceanBase Database tenant, including the number of tables created by the current user as well as the number of partition leaders and partition replicas constrained by global indexes. You can specify a statistical period to query the number of objects of a tenant in a single zone or on a single OBServer node.
primary_leaders
Definition
The number of partition leaders of the tenant within the statistical period.
Description
| Metric category | Metric name | Unit |
|---|---|---|
| primary_leaders | primary_leaders_cnt | N/A |
Calculation expression
sum(primary_leaders_cnt{@LABELS}) by (@GBLABELS)
SQL statements for metric collection
If you use OceanBase Database V4.0.0.0 or later, execute the following statement:
SELECT tenant_id, svr_ip, svr_port, count(*) as cnt FROM CDB_OB_TABLE_LOCATIONS WHERE ROLE = 'leader' AND TABLE_ID > 500000 GROUP BY TENANT_ID, SVR_IP, SVR_PORT
partition_replicas
Definition
The number of partition replicas of the tenant within the statistical period.
Description
| Metric category | Metric name | Unit |
|---|---|---|
| partition_replicas | partition_replicas_cnt | N/A |
Calculation expression
sum(partition_replicas_cnt{@LABELS}) by (@GBLABELS)
SQL statements for metric collection
If you use OceanBase Database V4.0.0.0 or later, execute the following statement:
SELECT tenant_id, SVR_IP, SVR_PORT, count(*) as cnt FROM CDB_OB_TABLE_LOCATIONS WHERE TABLE_ID > 500000 GROUP BY TENANT_ID, SVR_IP, SVR_PORT
log_stream_leaders
Definition
The number of log stream leaders of the tenant within the statistical period.
Description
| Metric category | Metric name | Unit |
|---|---|---|
| log_stream_leaders | log_stream_leaders_cnt | N/A |
Calculation expression
sum(log_stream_leaders_cnt{@LABELS}) by (@GBLABELS)
SQL statements for metric collection
If you use OceanBase Database V4.0.0.0 or later, execute the following statement:
SELECT tenant_id, SVR_IP, SVR_PORT, count(*) as cnt FROM CDB_OB_LS_LOCATIONS WHERE ROLE = 'leader' GROUP BY TENANT_ID, SVR_IP, SVR_PORT