> ## Documentation Index
> Fetch the complete documentation index at: https://risingwavelabs-wyx-add-timestamp-dedicated-page.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Export metrics

> This article describes how to use metrics API to export metrics from a RisingWave Cloud project to various monitoring systems like Prometheus, DataDog, and InfluxDB. The metrics include all major components such as `etcd`, `frontend`, `compute`, `compactor`, and `meta`.

<Tip>
  By default, a newly created service account isn't given any permissions. To export metrics, you need to grant your service account the `ProjectAdmin` role. See [RBAC](/cloud/organization-rbac/#role-permissions-and-limitations) for more details.
</Tip>

## Step 1: Generate API key

Generate the API key ID and API key secret in the Cloud Portal. See [Generate an API key](/cloud/service-account/#generate-an-api-key) for details.

## Step 2: Get Cloud\_HOST

Get the corresponding `CLOUD_HOST` for your region and Cloud provider from the table below:

| Region/CloudProvider | CLOUD\_HOST                          |
| :------------------- | :----------------------------------- |
| us-east-2/aws        | canary-useast2-mgmt.risingwave.cloud |
| us-east-1/aws        | prod-aws-usea1-mgmt.risingwave.cloud |
| us-west-2/aws        | prod-aws-uswe2-mgmt.risingwave.cloud |
| eu-west-2/aws        | prod-aws-euwe2-mgmt.risingwave.cloud |
| eu-north-1/aws       | prod-aws-euno1-mgmt.risingwave.cloud |
| ap-southeast-1/aws   | prod-aws-apse1-mgmt.risingwave.cloud |
| europe-west3/gcp     | prod-gcp-euwe3-mgmt.risingwave.cloud |
| europe-north1/gcp    | prod-gcp-euno1-mgmt.risingwave.cloud |

## Step 3: Configure monitoring systems

Choose one of the following methods to configure monitoring systems.

<Note>
  The metrics are formatted according to [Prometheus](https://prometheus.io/docs/concepts/metric%5Ftypes/) standards. If your monitoring collection mode is compatible with the Prometheus format, refer to the Prometheus section below to configure the collection.
</Note>

<Tabs>
  <Tab title="Prometheus">
    To import the metrics to Prometheus, edit the `scrape_configs` section in the prometheus.yaml file as follows:

    ```yaml theme={null}
    scrape_configs:
    - job_name: risingwave-remote
      static_configs:
      - targets:
        - {CLOUD_HOST}
      metrics_path: /api/v1/tenant/{CLUSTER_ID}/metrics
      basic_auth:
        username: {API_KEY}
        password: {API_SECRET}
      scrape_interval: 60s
      scrape_timeout: 60s
      scheme: https
    ```

    #### Notes

    * Update the `Cloud_HOST` according to the region and Cloud provider of your RisingWave cluster.
    * Update the `CLUSTER_ID` with the specific cluster ID in your RisingWave environment. For example, if your cluster URL is `risingwave-cloud.com/cluster/168/us-central1/overview/`, replace `CLUSTER_ID` with the value `168`.
  </Tab>

  <Tab title="DataDog">
    To import the metrics to DataDog, use DataDog Agent and [DataDog integration](https://app.datadoghq.com/integrations?integrationId=openmetrics). If you have not installed the DataDog agent, see [installation guide](https://app.datadoghq.com/account/settings/agent/latest?platform=overview).

    Next, edit the `openmetrics.d/conf.yaml` file at the root of your [Agent configuration directory](https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-configuration-directory) as follows, and then restart your agents.

    ```yaml theme={null}
    instances:
    - openmetrics_endpoint: http://{CLOUD_HOST}/api/v1/tenant/{CLUSTER_ID}/metrics
      namespace: risingwave
      metrics:
      - .*
      auth_type: basic
      username: {API_KEY}
      password: {API_SECRET}
    ```

    #### Notes

    * Update the `Cloud_HOST` according to the region and Cloud provider of your RisingWave cluster.
    * Update the `CLUSTER_ID` with the specific cluster ID in your RisingWave environment. For example, if your cluster URL is `risingwave-cloud.com/cluster/168/us-central1/overview/`, replace `CLUSTER_ID` with the value `168`.
    * The limit for the agent is **2000 metrics per instance**. To increase the limit, please contact [DataDog support](https://docs.datadoghq.com/help/).
  </Tab>

  <Tab title="InfluxDB">
    To import the metrics to InfluxDB, you need to configure Telegraf first. See instructions on how to [use Telegraf to scrape Prometheus metrics](https://docs.influxdata.com/influxdb/v2/write-data/developer-tools/scrape-prometheus-metrics/#use-telegraf) and the [Prometheus input plugin](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/prometheus/README.md).

    In the Telegraf configuration, you need to fill in the Prometheus input section, see [Prometheus](/cloud/export-metrics/?method=Prometheus#step-3-configure-metric-exporters) for details.
  </Tab>
</Tabs>

## Step 4: Set up dashboards

To set up dashboards based on key metrics, see [RisingWave open source user-dashboard](https://github.com/risingwavelabs/risingwave/blob/main/grafana/risingwave-user-dashboard.dashboard.py).
