# Prometheus (/docs/integrations/prometheus)



Prometheus [#prometheus]

The Prometheus app is a service integration in RawTree Cloud and RawTree BYOC,
where enabled. It translates protocol requests into writes and queries against RawTree.

The Prometheus app implements Prometheus remote write for ingestion and a Prometheus-compatible HTTP API for queries. Authenticate both with a cluster API key.

Before using these endpoints, open the cluster in the service dashboard.
Select **Apps** and install **Prometheus**.
Installation enables the endpoints for that cluster.
The app does not start or resume the cluster.
Make sure the cluster is available before you ingest or query data.

Remote write [#remote-write]

Configure Prometheus to send samples to RawTree:

```yaml
remote_write:
  - url: https://api.rawtree.com/prometheus/api/v1/write
    authorization:
      credentials_file: /etc/prometheus/secrets/rawtree-api-key
```

Store only the API key in `/etc/prometheus/secrets/rawtree-api-key`, and restrict the file so only the Prometheus process can read it.

The API key's default database is used unless you add `?database=<name>` to the URL. The app stores Prometheus data in managed `prometheus_samples`, `prometheus_series`, and `prometheus_metric_metadata` tables.

Query API [#query-api]

Use this base URL for a Prometheus-compatible data source:

```text
https://api.rawtree.com/prometheus
```

Send the cluster API key as a bearer token. The supported endpoints are:

| Endpoint                                      | Purpose                   |
| --------------------------------------------- | ------------------------- |
| `POST /api/v1/write`                          | Prometheus remote write   |
| `GET, POST /api/v1/query`                     | Instant query             |
| `GET, POST /api/v1/query_range`               | Range query               |
| `GET, POST /api/v1/labels`                    | Label names               |
| `GET, POST /api/v1/label/{label_name}/values` | Label values              |
| `GET, POST /api/v1/series`                    | Series metadata           |
| `GET /api/v1/metadata`                        | Metric metadata           |
| `GET /api/v1/status/buildinfo`                | Compatibility information |

For a non-default database, add `database=<name>` to the request query string or send `x-rawtree-database: <name>`.

Verify the connection [#verify-the-connection]

After Prometheus has written samples, run an instant query:

```bash
curl --get "https://api.rawtree.com/prometheus/api/v1/query" \
  -H "Authorization: Bearer $(cat /etc/prometheus/secrets/rawtree-api-key)" \
  --data-urlencode 'query=up'
```

A successful response uses the standard Prometheus envelope with `"status":"success"`.
