Scrape Astra DB Serverless metrics in exposition format
|
This Astra DB Serverless feature is currently in public preview. Development is ongoing, and the features and functionality are subject to change. Astra DB Serverless, and the use of such, is subject to the DataStax Preview Terms. |
You can use compatible third-party observability tools and services to scrape Astra DB Serverless metrics in Prometheus exposition format. You can use any tool or service that is compatible with Prometheus exposition format, such as Prometheus, Amazon CloudWatch, Datadog, Victoria Metrics, and more. The following steps use Prometheus for example purposes.
Whereas exporting metrics is push-based, this approach is pull-based. Your security policies might require you to use a pull-based configuration for metrics ingestion.
Prerequisites
Scraping metrics is a premium feature that requires a paid subscription plan.
Get credentials and IDs
-
Create an application token with a role that has Manage Metrics permission.
If you plan to scrape multiple databases, you can customize each token’s scope. For example, you can create separate tokens for each database, or you can create one token with the Organization Administrator role.
-
Get the database ID for each Astra DB Serverless database that you want to scrape.
-
If your Astra organization has PCU groups, and you want to scape PCU group metrics, get the
uuidfor each PCU group that you want to scrape.To get a list of PCU groups in your Astra organization, use
POST /v2/pcus/actions/get:curl -sS -L -X POST "https://api.astra.datastax.com/v2/pcus/actions/get" \ --header "Authorization: Bearer APPLICATION_TOKEN" \ --header "Content-Type: application/json" \ --data '{}'The provided
APPLICATION_TOKENmust have the Organization Administrator or Billing Administrator role.
Configure Prometheus to scrape metrics
-
In your Prometheus configuration YAML file, in the
scrape_configssection, add a job for each database that you want to scrape:scrape_configs: - job_name: "prometheus-FIRST_DATABASE_ID" scrape_interval: 30s metrics_path: /v1/databases/FIRST_DATABASE_ID/metrics scheme: "https" authorization: type: "Astra-Token" credentials: "APPLICATION_TOKEN" static_configs: - targets: ["metrics.astra.datastax.com"] - job_name: "prometheus-SECOND_DATABASE_ID" scrape_interval: 30s metrics_path: /v1/databases/SECOND_DATABASE_ID/metrics scheme: "https" authorization: type: "Astra-Token" credentials: "APPLICATION_TOKEN" static_configs: - targets: ["metrics.astra.datastax.com"] -
For databases in PCU groups, add a job for each PCU group that you want to scape:
scrape_configs: - job_name: "prometheus-PCU_GROUP_ID" scrape_interval: 30s metrics_path: /v1/pcugroup/PCU_GROUP_ID/metrics scheme: "https" authorization: type: "Astra-Token" credentials: "APPLICATION_TOKEN" static_configs: - targets: ["metrics.astra.datastax.com"] -
Set the global or job scrape interval to
30s. This is the recommended interval to avoid dropping histogram buckets and stay in sync with the Astra Portal dashboard.# Set an interval for all jobs in the global section. global: scrape_interval: 30s # Set intervals for individual jobs in the scrape_configs section. scrape_configs: - job_name: "prometheus-DATABASE_ID" scrape_interval: 30s -
If required, configure your observability service to receive the Astra DB metrics from your Prometheus endpoint.