> ## Documentation Index
> Fetch the complete documentation index at: https://docs.risingwave.com/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`, `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-1/aws        | prod-aws-euwe1-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 |

<Note>
  If your region is not listed above, contact [RisingWave Cloud support](https://www.risingwave.com/contact-us/) to confirm the correct `CLOUD_HOST` for your deployment. The authoritative source of region-to-host mappings is the workspace definitions maintained by the RisingWave Cloud team.
</Note>

## 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
      relabel_configs:
      - target_label: namespace
        regex: {NS_ID}
      - target_label: risingwave_name
        regex: risingwave
      - target_label: risingwave_component
        source_labels:
        - component
      static_configs:
      - targets:
        - {CLOUD_HOST}
      metrics_path: /api/v2/tenants/{NS_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 `NS_ID` with the specific UUID of your RisingWave project. To find the UUID, hover over the tag next to your project name.
  </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/v2/tenants/{NS_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 `NS_ID` with the specific UUID of your RisingWave project. To find the UUID, hover over the tag next to your project name.
    * 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 with **Grafana** and **Prometheus**, please follow the [Grafana dashboard build instructions](https://github.com/risingwavelabs/risingwave/blob/main/grafana/README.md) to build a set of dashboards with multiple namespace support.

<Note>
  We recommend using `risingwave_dev_dashboard` for comprehensive monitoring. `risingwave_dashboard` is also available but the dev dashboard is better organized and provides more detailed metrics.
</Note>

For other systems, or to generate them programmatically, please refer to [the script for generating the Grafana dev dashboard](https://github.com/risingwavelabs/risingwave/blob/main/grafana/risingwave-dev-dashboard.dashboard.py) and build your own.
