CockroachDB Integration
Cloud Hosted Deployment
CockroachDB Standard users can use the Cloud API to configure metrics export to Prometheus. Once the export is configured, metrics will flow from all regions of your CockroachDB Standard cluster to your chosen cloud metrics sink. Follow the steps to enable and configure CRDB metrics ingestion into Kloudfuse.
Find your CockroachDB Standard cluster ID:
Visit the CockroachDB Cloud console cluster page.
Click on the name of your cluster.
Find your cluster ID in the URL of the single cluster overview page:
https://cockroachlabs.cloud/cluster/{your_cluster_id}/overview
. The ID should resemblef78b7feb-b6cf-4396-9d7f-494982d7d81e
.
Issue the following Cloud API command to enable metrics export for your CockroachDB Standard cluster:
curl --request POST \ --url https://cockroachlabs.cloud/api/v1/clusters/{cluster_id}/metricexport/prometheus \ --header "Authorization: Bearer {secret_key}"
Where:
{cluster_id}
is your CockroachDB Standard cluster ID as determined in step 1, resemblingf78b7feb-b6cf-4396-9d7f-494982d7d81e
.{secret_key}
is your CockroachDB Standard API key. See API Access for instructions on generating this key.
Depending on the size of your cluster and how many regions it spans, the configuration may take a moment. You can monitor the ongoing status of the configuration using the following Cloud API command:
curl --request GET \ --url https://cockroachlabs.cloud/api/v1/clusters/{cluster_id}/metricexport/prometheus \ --header "Authorization: Bearer {secret_key}"
Run the command periodically until the command returns a
status
ofENABLED
, at which point the configuration across all regions is complete. The response also includestargets
, a map of scrape endpoints exposing metrics to regions. For example:{ "cluster_id": "f78b7feb-b6cf-4396-9d7f-494982d7d81e", "user_message": "This integration is active.", "status": "ENABLED", "targets": { "us-east4": "https://cockroachlabs.cloud/api/v1/clusters/f78b7feb-b6cf-4396-9d7f-494982d7d81e/metricexport/prometheus/us-east4/scrape" } }
There is a separate scrape endpoint per region if you have a multi-region cluster.
You can test a scrape endpoint by using the following Cloud API command:
Where:
{cluster_id}
is your CockroachDB Standard cluster ID as determined in step 1, resemblingf78b7feb-b6cf-4396-9d7f-494982d7d81e
.{cluster_region}
is a region of your CockroachDB Standard cluster as shown in thetargets
of step 3, such asus-east4
. You can also find your cluster’s region(s) on the Cluster Overview page.{secret_key}
is your CockroachDB Standard API key. See API Access for instructions on generating this key.
Once metrics export has been enabled and the scrape endpoint(s) tested, you need to configure your metrics collector to periodically poll the scrape endpoint(s). Configure your Prometheus configuration file's (
prom-values.yaml
)scrape_configs
section as in the following example:Finally, install the prometheus server on your k8s environment with the following command
The above installation will enable CRDB metrics ingestion to Kfuse and CRDB metrics should be visible in metrics summary.