Skip to content

Commit 7a192cd

Browse files
committed
added
1 parent 00f9fc1 commit 7a192cd

File tree

3 files changed

+110
-0
lines changed

3 files changed

+110
-0
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
title: Tracking Metrics with Prometheus
3+
---
4+
5+
[Prometheus](https://prometheus.io/) offers a robust solution for real-time monitoring, empowering you to track critical metrics and maintain system stability effectively. This topic guides you through the steps to integrate Prometheus with Databend Cloud and provides an overview of the available metrics.
6+
7+
## Integrating with Prometheus
8+
9+
Follow these steps to set up a Prometheus instance with Docker and integrate it with Databend Cloud:
10+
11+
### Step 1: Enable Tenant Metrics
12+
13+
To start tracking metrics, ensure that metrics are enabled for your Databend Cloud tenant. To enable this feature, submit a support ticket in Databend Cloud by navigating to **Support** > **Create New Ticket** and requesting metrics activation for your tenant.
14+
15+
### Step 2: Prepare a SQL User
16+
17+
Create a dedicated SQL user in Databend Cloud for Prometheus to access metrics. For example, you can create a SQL user named `metrics` with the password `metrics_password` using the following SQL statement:
18+
19+
```sql
20+
CREATE USER metrics IDENTIFIED BY 'metrics_password';
21+
```
22+
23+
### Step 3: Start Prometheus Using Docker
24+
25+
1. On your local machine, create a **prometheus.yml** file to configure Prometheus for scraping metrics from Databend Cloud. Use the following template:
26+
27+
```yaml title='prometheus.yml'
28+
scrape_configs:
29+
- job_name: databend-cloud
30+
scheme: https
31+
metrics_path: /metrics
32+
basic_auth:
33+
username: <USERNAME>
34+
password: <PASSWORD>
35+
scrape_interval: 10s
36+
scrape_timeout: 3s
37+
static_configs:
38+
- targets:
39+
- <TENANT_ENDPOINT>
40+
labels:
41+
tenant: <TENANT_ID>
42+
platform: <PLATFORM>
43+
region: <REGION>
44+
```
45+
46+
| Placeholder | Description | Example |
47+
|---------------------|--------------------------------------------------|--------------------------------------------------------|
48+
| `<USERNAME>` | The username for the SQL user. | `metrics` |
49+
| `<PASSWORD>` | The secure password for the SQL user. | `metrics_password` |
50+
| `<TENANT_ENDPOINT>` | The endpoint URL for your Databend Cloud tenant. | `tnxxxxxxx--wh1.gw.aws-us-east-2.default.databend.com` |
51+
| `<TENANT_ID>` | Your tenant's unique identifier. | `tnxxxxxxx` |
52+
| `<PLATFORM>` | The cloud platform hosting the tenant. | `aws` |
53+
| `<REGION>` | The region where the tenant is hosted. | `us-east-2` |
54+
55+
2. Start Prometheus with the following command (replace `</path/to/prometheus.yml>` with the full path to your **prometheus.yml** file):
56+
57+
```bash
58+
docker run -d \
59+
--name prometheus \
60+
-p 9090:9090 \
61+
-v </path/to/prometheus.yml>:/etc/prometheus/prometheus.yml \
62+
prom/prometheus
63+
```
64+
65+
3. Open Prometheus in your browser at http://localhost:9090, navigate to **Status** > **Target health**, and confirm that the `databend-cloud` target is listed with a status of `UP`.
66+
67+
![alt text](../../../../../static/img/documents/warehouses/metrics-1.png)
68+
69+
You're all set! You can now query your tenant metrics directly from Prometheus. For example, try querying `databend_cloud_warehouse_status`:
70+
71+
![alt text](../../../../../static/img/documents/warehouses/metrics-2.png)
72+
73+
## Available Metrics List
74+
75+
Please note that all metrics are prefixed with `databend_cloud_`.
76+
77+
### Query Metrics
78+
79+
The following is a list of query metrics available in Databend Cloud:
80+
81+
| Name | Type | Labels | Description |
82+
|----------------------|---------|------------------|-------------------------------------|
83+
| query_count | Counter | tenant,warehouse | Query counts made by clients |
84+
| query_errors | Counter | tenant,warehouse | Query error counts made by clients |
85+
| query_request_bytes | Counter | tenant,warehouse | Query request bytes from client |
86+
| query_response_bytes | Counter | tenant,warehouse | Query response bytes sent to client |
87+
88+
### Storage Metrics
89+
90+
The following is a list of storage metrics available in Databend Cloud:
91+
92+
| Name | Type | Labels | Description |
93+
|-------------------------------|-------|--------|-------------------------------------------------------|
94+
| storage_total_size | Guage | tenant | Total size for backend object storage |
95+
| storage_staged_size | Guage | tenant | Total size for staged files on backend object storage |
96+
| storage_table_compressed_size | Guage | tenant | Total size for current tables backend object storage |
97+
98+
### Warehouse Metrics
99+
100+
The following is a list of warehouse metrics available in Databend Cloud:
101+
102+
| Name | Type | Labels | Description |
103+
|----------------------------------|---------|------------------------------|-----------------------------------------------------|
104+
| warehouse_status | Guage | tenant,warehouse,size,status | Flag for warehouse status (Suspended,Running, etc.) |
105+
| warehouse_session_queued_queries | Guage | tenant,warehouse | Queries waiting in queue currently |
106+
| warehouse_session_connections | Guage | tenant,warehouse | Session Count currently |
107+
| warehouse_storage_requests_count | Counter | tenant,warehouse,scheme,op | Requests count to backend storage |
108+
| warehouse_storage_requests_bytes | Counter | tenant,warehouse,scheme,op | Requests bytes from backend storage |
109+
| warehouse_data_scan_rows | Counter | tenant,warehouse | Data rows scanned from backend storage |
110+
| warehouse_data_write_rows | Counter | tenant,warehouse | Data rows written to backend storage |
333 KB
Loading
629 KB
Loading

0 commit comments

Comments
 (0)