Skip to content

Commit ea0205e

Browse files
authored
Merge pull request #3116 from ClickHouse/extend-prom-docs
Add filtered metrics request param to prom endpoint
2 parents 0189915 + 5c823bb commit ea0205e

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

docs/en/integrations/prometheus.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,19 @@ To get started, [generate an API key](/en/cloud/manage/openapi).
1616

1717
### API Reference
1818

19-
|Method|Path|
20-
|---|---|
21-
|GET|https://api.clickhouse.cloud/v1/organizations/:organizationId/services/:serviceId/prometheus|
19+
| Method | Path | Description |
20+
| ------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------ |
21+
| GET | `https://api.clickhouse.cloud/v1/organizations/:organizationId/services/:serviceId/prometheus?filtered_metrics=[true | false]` | Returns metrics for a specific service |
22+
| GET | `https://api.clickhouse.cloud/v1/organizations/:organizationId/prometheus?filtered_metrics=[true | false]` | Returns metrics for all services in an organization |
2223

2324
**Request Parameters**
2425

25-
|Name|Type|
26-
|---|---|
27-
|Organization ID|uuid|
28-
|Service ID|uuid|
26+
| Name | Location | Type |
27+
| ---------------- | ------------------ |------------------ |
28+
| Organization ID | Endpoint address | uuid |
29+
| Service ID | Endpoint address | uuid (optional) |
30+
| filtered_metrics | Query param | boolean (optional) |
31+
2932

3033
### Authentication
3134

@@ -38,8 +41,13 @@ Example request
3841
export KEY_SECRET=<key_secret>
3942
export KEY_ID=<key_id>
4043
export ORG_ID=<org_id>
44+
45+
# For all services in $ORG_ID
46+
curl --silent --user $KEY_ID:$KEY_SECRET https://api.clickhouse.cloud/v1/organizations/$ORG_ID/prometheus?filtered_metrics=true
47+
48+
# For a single service only
4149
export SERVICE_ID=<service_id>
42-
curl --silent --user $KEY_ID:$KEY_SECRET https://api.clickhouse.cloud/v1/organizations/$ORG_ID/services/$SERVICE_ID/prometheus
50+
curl --silent --user $KEY_ID:$KEY_SECRET https://api.clickhouse.cloud/v1/organizations/$ORG_ID/services/$SERVICE_ID/prometheus?filtered_metrics=true
4351
```
4452

4553
### Sample Response
@@ -110,14 +118,16 @@ scrape_configs:
110118
static_configs:
111119
- targets: ["api.clickhouse.cloud"]
112120
scheme: https
113-
metrics_path: "/v1/organizations/<ORG_ID>/services/<SERVICE_ID>/prometheus"
121+
params:
122+
filtered_metrics: ["true"]
123+
metrics_path: "/v1/organizations/<ORG_ID>/prometheus"
114124
basic_auth:
115125
username: <KEY_ID>
116126
password: <KEY_SECRET>
117127
honor_labels: true
118128
```
119129
120-
Note the `honor_labels` configuration parameter needs to be set to `true` for the instance label to be properly populated.
130+
Note the `honor_labels` configuration parameter needs to be set to `true` for the instance label to be properly populated. Additionally, `filtered_metrics` is set to `true` in the above example, but should be configured based on user preference.
121131

122132
## Integrating with Grafana
123133

@@ -175,8 +185,8 @@ The following shows an example configuration for Alloy with a `prometheus.scrape
175185
prometheus.scrape "clickhouse_cloud" {
176186
// Collect metrics from the default listen address.
177187
targets = [{
178-
__address__ = "https://api.clickhouse.cloud/v1/organizations/:organizationId/services/:serviceId/Promethues",
179-
// e.g. https://api.clickhouse.cloud/v1/organizations/97a33bdb-4db3-4067-b14f-ce40f621aae1/services/f7fefb6e-41a5-48fa-9f5f-deaaa442d5d8/prometheus
188+
__address__ = "https://api.clickhouse.cloud/v1/organizations/:organizationId/prometheus?filtered_metrics=true",
189+
// e.g. https://api.clickhouse.cloud/v1/organizations/97a33bdb-4db3-4067-b14f-ce40f621aae1/prometheus?filtered_metrics=true
180190
}]
181191
182192
honor_labels = true
@@ -211,8 +221,8 @@ Self-managed users of Grafana can find the instructions for installing the Alloy
211221
prometheus.scrape "clickhouse_cloud" {
212222
// Collect metrics from the default listen address.
213223
targets = [{
214-
__address__ = "https://api.clickhouse.cloud/v1/organizations/:organizationId/services/:serviceId/Promethues",
215-
// e.g. https://api.clickhouse.cloud/v1/organizations/97a33bdb-4db3-4067-b14f-ce40f621aae1/services/f7fefb6e-41a5-48fa-9f5f-deaaa442d5d8/prometheus
224+
__address__ = "https://api.clickhouse.cloud/v1/organizations/:organizationId/prometheus?filtered_metrics=true",
225+
// e.g. https://api.clickhouse.cloud/v1/organizations/97a33bdb-4db3-4067-b14f-ce40f621aae1/prometheus?filtered_metrics=true
216226
}]
217227
218228
honor_labels = true
@@ -246,7 +256,7 @@ You can use the Datadog [Agent](https://docs.datadoghq.com/agent/?tab=Linux) and
246256
init_config:
247257
248258
instances:
249-
- openmetrics_endpoint: 'https://api.clickhouse.cloud/v1/organizations/97a33bdb-4db3-4067-b14f-ce40f621aae1/services/f7fefb6e-41a5-48fa-9f5f-deaaa442d5d8/prometheus'
259+
- openmetrics_endpoint: 'https://api.clickhouse.cloud/v1/organizations/97a33bdb-4db3-4067-b14f-ce40f621aae1/prometheus?filtered_metrics=true'
250260
namespace: 'clickhouse'
251261
metrics:
252262
- '^ClickHouse.*'

0 commit comments

Comments
 (0)