ClickHouse
Connect
Connect ClickHouse from the terminal. Pass --help for the flags ClickHouse accepts, plus --no-browser for headless environments.
polylane cloud connect --provider clickhouseAn API key ID and secret from your ClickHouse Cloud organization settings.
Connect one ClickHouse Cloud organization with an API key. An API key belongs to exactly one organization, so one key connects one organization, and you can connect each organization to a workspace once. Polylane encrypts the key before it stores it, and the agent never sees it.
- In ClickHouse Cloud, open your organization's API Keys.
- Click New API key and choose the Developer role. This role is read-only.
- Copy the key ID and the key secret. ClickHouse Cloud shows the secret only once.
- Paste the two values into Polylane.
- Polylane checks the key and starts the first sync.
Connect ClickHouse from a CI job or any other environment without a browser.
You can connect ClickHouse Cloud without a browser. A CI job can call the same endpoint that the console calls. One authenticated POST creates the connection and starts the first sync.
Prerequisites
- A Polylane API key with the
cloud_accounts:writeandcloud_accounts:readscopes. See API keys and OAuth. - Your workspace ID, which starts with
ws_. Read it fromGET /v1/workspaceswith the same key. - A ClickHouse Cloud API key ID and secret from your organization's API Keys, with the Developer role.
Create the connection
curl -X POST https://api.polylane.com/v1/cloud_accounts \
-H "x-api-key: $POLYLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "clickhouse",
"workspaceId": "ws_0abc123",
"keyId": "<key-id>",
"keySecret": "<key-secret>"
}'
One call connects one organization: the organization that owns the key.
The response lists the connected accounts, and the first sync is already running. This example shows only the two fields that the next steps read:
{
"success": true,
"result": {
"provider": "clickhouse",
"accounts": [{ "id": "acc_34gky74ibc92h8t2efn8csrh", "status": "syncing" }],
"failures": []
}
}
An account that is already connected goes into failures, not accounts. A repeated call never makes a second connection.
Wait for the first sync
Poll each returned account by its id until status is ready. The status is new at registration and syncing while resources arrive:
until [ "$(curl -s "https://api.polylane.com/v1/cloud_accounts/$WORKSPACE_ID/$ACCOUNT_ID" \
-H "x-api-key: $POLYLANE_API_KEY" | jq -r '.result.status')" = "ready" ]; do
sleep 15
done
Give the loop a deadline, so that a failed connection fails the job and does not stop it indefinitely. When the account is ready, its resources are in the topology and Polylane has started its first check.
Disconnect from the API
Deleting the connection stops every sync and check and deletes the credentials that Polylane held. The call needs the cloud_accounts:delete scope:
curl -X DELETE "https://api.polylane.com/v1/cloud_accounts/$WORKSPACE_ID/$ACCOUNT_ID" \
-H "x-api-key: $POLYLANE_API_KEY"
Then delete the ClickHouse Cloud API key, as the Disconnecting section tells.
How it works
Infrastructure graph
Polylane syncs the organization every 15 minutes. Each service becomes a node, with its state, tier, region, cloud provider, ClickHouse version, replica sizing and connection endpoints. A secondary service in a data warehouse links to the primary service of that warehouse.
Polylane uses the connection hostnames for cross-cloud links. An application that reaches a service through an environment variable links to that service on the topology.
Checks
By default, Polylane counts the unhealthy services every 30 minutes. A service that is degraded, failed, stopped or partially running is unhealthy. Idle and waking services are normal for idle-scaled services, so they stay healthy. The usual count is zero for most organizations, and Polylane compares each count with the history of the account to find an issue.
Metrics
The ClickHouse Cloud control plane gives metrics only as a live snapshot, with no history. Thus services show no metric charts. During an investigation, agents read the current CPU, memory, connection, query and replica values from the Prometheus endpoint of the control plane. To see a trend, an agent takes two readings a few minutes apart.
Investigations
Agents list services with their state and sizing, and read other ClickHouse Cloud API endpoints, such as backups, settings and usage cost. The control plane has no SQL access, so agents do not query the data in your databases.
Writes
The ClickHouse Cloud API tool can send write requests. A Developer key is read-only, so ClickHouse Cloud refuses these writes. If you connect a key with more access, the connection still starts in read-only mode: Polylane refuses each write until a workspace admin turns read-only mode off. After that, each write needs safety review and your approval before it runs.
Troubleshooting
"ClickHouse Cloud does not recognize this API key" error
- You must give the key ID and the key secret. One value alone cannot authenticate.
- Make sure that the key is not deleted or disabled in the API key settings of ClickHouse Cloud.
- A key with an expiry date stops working when it expires. Create a new key and rotate it in Polylane.
"This ClickHouse Cloud API key cannot read your organization" error
- Create a new API key with the Developer role in your organization settings.
Missing resources
- The first sync can take a few minutes.
- Click Sync in the account header to start a sync immediately.
Rate limits
- ClickHouse Cloud allows 10 API requests in 10 seconds for each key. Use a key only for Polylane, so that other tools do not use the same budget.
Disconnecting
Disconnecting stops every sync and check, and deletes the key that Polylane stored. The key stays valid in ClickHouse Cloud. Delete it in your ClickHouse Cloud organization settings.
Disconnect
Disconnecting stops every sync and check and deletes the credentials Polylane held. Everything Polylane set up in ClickHouse is removed as well; nothing is left behind.
polylane cloud disconnect <id>Tools
3Operations agents can perform in threads.
Supported resources
1Resource types that show up in your infrastructure graph.