metricexport endpoint
To configure and manage metrics export for your CockroachDB Standard cluster, use the metricexport endpoint appropriate for your desired cloud metrics sink:
| Cloud metrics sink | Metrics export endpoint |
|---|---|
| Amazon CloudWatch | https://cockroachlabs.cloud/api/v1/clusters/{your\_cluster\_id}/metricexport/cloudwatch |
| Datadog | https://cockroachlabs.cloud/api/v1/clusters/{your\_cluster\_id}/metricexport/datadog |
| Prometheus | https://cockroachlabs.cloud/api/v1/clusters/{your\_cluster\_id}/metricexport/prometheus |
metricexport endpoints requires a valid CockroachDB Cloud assigned one of the following :
metricexport endpoints, and require the listed service account permissions:
| Method | Required permissions | Description |
|---|---|---|
GET | ADMIN, EDIT, or READ | Returns the current status of the metrics export configuration. |
POST | ADMIN or EDIT | Enables metrics export, or updates an existing metrics export configuration. |
DELETE | ADMIN | Disables metrics export, halting all metrics export to Amazon CloudWatch, Datadog, or Prometheus. |
Enable metrics export
- Amazon CloudWatch
- Datadog
- Prometheus
This feature is in and subject to change. To share feedback and/or issues, contact Support.
Enabling metrics export will send around 90 metrics per to Amazon CloudWatch. Review the Amazon CloudWatch documentation to gauge how this adds to your Amazon CloudWatch spend.
- Create the desired target Amazon CloudWatch log group by following the Create a log group in CloudWatch instructions. If you already have a log group created, you may skip this step. When your CockroachDB Standard cluster emits metrics to Amazon CloudWatch, they are written to this log group.
-
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. It should resemblef78b7feb-b6cf-4396-9d7f-494982d7d81e.
-
Determine your cluster’s cloud provider account ID. This command uses the third-party JSON parsing tool
jqto isolate just the neededaws_account_idfield:Where:{your_cluster_id}is the cluster ID of your CockroachDB Standard cluster as determined in step 2.{secret_key}is your CockroachDB Standard API key. See for more details.
-
Create a cross-account IAM role in your AWS account:
- In the AWS console, visit the IAM page.
- Select Roles and click Create role.
- For Trusted entity type, select AWS account.
- Choose Another AWS account.
- For Account ID, provide the CockroachDB Standard cloud provider account ID from step 3.
- Select the option to Require external ID, and for the value of External ID, provide the cluster ID of your CockroachDB Standard cluster as determined in step 2.
- Finish creating the IAM role with a suitable name. These instructions will use the role name
CockroachCloudMetricsExportRole. You do not need to add any permissions.
You will need the Amazon Resource Name (ARN) for your cross-account IAM role later in this procedure.
-
Select the new role, and create a new policy for this role. These instructions will use the policy name
CockroachCloudMetricsExportPolicy. -
Select the new policy, and paste the following into the Permissions tab, with the JSON option selected:
Where:
-
{your_aws_acct_id}is the AWS Account ID of the AWS account where you created theCockroachCloudMetricsExportRolerole, not the cloud provider account ID of your CockroachDB Standard cluster from step 3. You can find your AWS Account ID on the AWS IAM page. -
{log_group_name}is the target Amazon CloudWatch log group you created in step 1. This defines the set of permissions that the CockroachDB Standard metrics export feature requires to be able to write metrics to CloudWatch.
-
-
Copy the Amazon Resource Name (ARN) of the
CockroachCloudMetricsExportRolerole found under Summary, which is needed for the next step. -
Issue the following command to enable metrics export for your CockroachDB Standard cluster:
Where:
-
{cluster_id}is your CockroachDB Standard cluster ID as determined in step 2. -
{secret_key}is your CockroachDB Standard API key. See for instructions on generating this key. -
{aws_region}is your AWS region, likeus-east-1. -
{role_arn}is the ARN for theCockroachCloudMetricsExportRolerole you copied in step 7. If you used a different role name there, be sure to use your role name in place ofCockroachCloudMetricsExportRolein the above command. -
{log_group_name}is the target Amazon CloudWatch log group you created in step 1. This must be the same group name you provided in step 6. Specifying an AWS region (to{aws_region}) that you do not have a cluster in, or a region that only partially covers your cluster will result in missing metrics.
-
-
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:
Run the command periodically until the command returns a status of
ENABLED, at which point the configuration is complete, and metrics will begin appearing in CloudWatch under the log group you created in step 1. Since the configuration is applied to the cluster in a rolling fashion, you may see some metrics appear even before theGETcommand returns anENABLEDstatus. - Once metrics export has been enabled, you can access metrics from your CockroachDB Standard cluster directly in Amazon CloudWatch.
Monitor the status of a metrics export configuration
- Amazon CloudWatch
- Datadog
- Prometheus
To check the status of an existing Amazon CloudWatch metrics export configuration, use the following Cloud API command:Where:
{cluster_id}is the cluster ID of your CockroachDB Standard cluster, which can be found in the URL of your Cloud Console for the specific cluster you wish to configure, resemblingf78b7feb-b6cf-4396-9d7f-494982d7d81e.{secret_key}is your CockroachDB Standard API key. See for instructions on generating this key.
Update an existing metrics export configuration
To update an existing CockroachDB Standard metrics export configuration, make any necessary changes to your cloud provider configuration (e.g., Amazon CloudWatch, Datadog, or Prometheus), then issue the samePOST Cloud API command as shown in the Enable metrics export instructions for your cloud provider with the desired updated configuration. Follow the Monitor the status of a metrics export configuration instructions to ensure the update completes successfully.
Disable metrics export
- Amazon CloudWatch
- Datadog
- Prometheus
To disable an existing Amazon CloudWatch metrics export configuration, and stop sending metrics to CloudWatch, use the following Cloud API command:Where:
{cluster_id}is the cluster ID of your CockroachDB Standard cluster, which can be found in the URL of your Cloud Console for the specific cluster you wish to configure, resemblingf78b7feb-b6cf-4396-9d7f-494982d7d81e.{secret_key}is your CockroachDB Standard API key. See for instructions on generating this key.
Limitations
- Metrics export to Amazon CloudWatch is available only on CockroachDB Standard clusters which are hosted on AWS. If your CockroachDB Standard cluster is hosted on GCP, you can or instead.
- Amazon CloudWatch does not currently support histograms. Any histogram-type metrics emitted from your CockroachDB Standard cluster are dropped by CloudWatch. See Prometheus metric type conversion for more information, and Logging dropped Prometheus metrics for instructions on tracking dropped histogram metrics in CloudWatch.
Troubleshooting
Amazon CloudWatch
Be sure you are providing your own AWS Account ID as shown on the AWS IAM page to step 6, not the AWS cloud provider account ID as returned from step 3. If you are using an existing AWS role, or are otherwise using a role name different from the example name used in this tutorial, be sure to use your own role name in step 8 in place ofCockroachCloudMetricsExportRole.
Your CockroachDB Standard cluster must be running on AWS (not GCP) to make use of metrics export to Amazon CloudWatch. If your CockroachDB Standard cluster is hosted on GCP, you can or instead.

