Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TiDB monitoring: add table storage info status api #6110

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions tidb-monitoring-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ aliases: ['/docs/dev/tidb-monitoring-api/']

You can use the following two types of interfaces to monitor the TiDB cluster state:

- [The state interface](#use-the-state-interface): this interface uses the HTTP interface to get the component information.
- [The state interface](#running-status): this interface uses the HTTP interface to get the component information.
- [Storage information](#storage-information): it uses the HTTP interface to get the storage information from data tables.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [Storage information](#storage-information): it uses the HTTP interface to get the storage information from data tables.
- [Storage information](#storage-information): this interface uses the HTTP interface to get the storage information of data tables.

- [The metrics interface](#use-the-metrics-interface): this interface uses Prometheus to record the detailed information of the various operations in components and views these metrics using Grafana.

## Use the state interface
Expand All @@ -20,7 +21,9 @@ The state interface monitors the basic information of a specific component in th
- TiDB API address: `http://${host}:${port}`
- Default port: `10080`

The following example uses `http://${host}:${port}/status` to get the current state of the TiDB server and to determine whether the server is alive. The result is returned in JSON format.
### Running status

The following example uses `http://${host}:${port}/status` to get the current state of the TiDB server and to determine whether the server is alive. The result is returned in **JSON** format.

```bash
curl http://127.0.0.1:10080/status
Expand All @@ -31,6 +34,48 @@ curl http://127.0.0.1:10080/status
}
```

#### Storage information

The following example uses `http://${host}:${port}/schema_storage/${db}/${table}` to get the storage information from the specific data tables. The result is returned in **JSON** format.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following example uses `http://${host}:${port}/schema_storage/${db}/${table}` to get the storage information from the specific data tables. The result is returned in **JSON** format.
The following example uses `http://${host}:${port}/schema_storage/${db}/${table}` to get the storage information of the specific data table. The result is returned in **JSON** format.


{{< copyable "shell-regular" >}}

```bash
curl http://127.0.0.1:10080/schema_storage/mysql/stats_histograms
```

```
{
"table_schema": "mysql",
"table_name": "stats_histograms",
"table_rows": 0,
"avg_row_length": 0,
"data_length": 0,
"max_data_length": 0,
"index_length": 0,
"data_free": 0
}
```

```bash
curl http://127.0.0.1:10080/schema_storage/test
```

```
[
{
"table_schema": "test",
"table_name": "test",
"table_rows": 0,
"avg_row_length": 0,
"data_length": 0,
"max_data_length": 0,
"index_length": 0,
"data_free": 0
}
]
```

### PD server

- PD API address: `http://${host}:${port}/pd/api/v1/${api_name}`
Expand Down