prometheus_scrape_targets
Creates, updates, deletes, gets or lists a prometheus_scrape_targets resource.
Overview
| Name | prometheus_scrape_targets |
| Type | Resource |
| Id | clickhouse.organizations.prometheus_scrape_targets |
Fields
The following fields are returned by SELECT queries:
- list
| Name | Datatype | Description |
|---|---|---|
labels | object | |
targets | array | Host (and port) of the ClickHouse Cloud API. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | organization_id | filtered_metrics | Disclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Returns one Prometheus scrape target per service in the organization that the caller is authorized to view, in HTTP service discovery (http_sd) format. Services the caller lacks view access to, and services in a terminated, terminating, or (soft-)deleted state, are omitted — the response can have fewer groups than the organization has services. Point a Prometheus http_sd_configs job at this endpoint to discover and scrape all services automatically; targets are refreshed on every discovery poll, so created and deleted services are picked up without reconfiguration. Targets scrape with filtered_metrics=true by default; pass ?filtered_metrics=false to this endpoint to discover unfiltered targets.<br /><br />Sample Prometheus scrape config:<br /><br />yaml<br />scrape_configs:<br /> - job_name: clickhouse-cloud<br /> http_sd_configs:<br /> - url: https://api.clickhouse.cloud/v1/organizations/<organizationId>/prometheus/discovery<br /> refresh_interval: 60s<br /> basic_auth:<br /> username: <key-id><br /> password: <key-secret><br /> basic_auth:<br /> username: <key-id><br /> password: <key-secret><br /><br /><br />The basic_auth block must be set both under http_sd_configs (used to authenticate discovery polls against this endpoint) and on the scrape job itself (used to authenticate the actual per-service scrapes) — omitting either one is the most common misconfiguration. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
organization_id | string | ClickHouse Cloud organization ID. Resolved from the CLICKHOUSE_ORG_ID environment variable when it is set (x-stackQL-envVar); otherwise it must be supplied on every query as WHERE organization_id = <uuid>. A WHERE value always takes precedence over the environment. (x-stackQL-envVar: CLICKHOUSE_ORG_ID) |
filtered_metrics | string (boolean) | Whether discovered targets carry filtered_metrics=true or =false as a scrape param. Accepts true or false; defaults to true — the opposite default from the per-service prometheus endpoint. (example: true) |
SELECT examples
- list
Disclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Returns one Prometheus scrape target per service in the organization that the caller is authorized to view, in HTTP service discovery (http_sd) format. Services the caller lacks view access to, and services in a terminated, terminating, or (soft-)deleted state, are omitted — the response can have fewer groups than the organization has services. Point a Prometheus http_sd_configs job at this endpoint to discover and scrape all services automatically; targets are refreshed on every discovery poll, so created and deleted services are picked up without reconfiguration. Targets scrape with filtered_metrics=true by default; pass ?filtered_metrics=false to this endpoint to discover unfiltered targets.<br /><br />Sample Prometheus scrape config:<br /><br />yaml<br />scrape_configs:<br /> - job_name: clickhouse-cloud<br /> http_sd_configs:<br /> - url: https://api.clickhouse.cloud/v1/organizations/<organizationId>/prometheus/discovery<br /> refresh_interval: 60s<br /> basic_auth:<br /> username: <key-id><br /> password: <key-secret><br /> basic_auth:<br /> username: <key-id><br /> password: <key-secret><br /><br /><br />The basic_auth block must be set both under http_sd_configs (used to authenticate discovery polls against this endpoint) and on the scrape job itself (used to authenticate the actual per-service scrapes) — omitting either one is the most common misconfiguration.
SELECT
labels,
targets
FROM clickhouse.organizations.prometheus_scrape_targets
WHERE organization_id = '{{ organization_id }}' -- required unless CLICKHOUSE_ORG_ID is set
AND filtered_metrics = '{{ filtered_metrics }}'
;