Guides

Prometheus

Store and query Prometheus metrics with RawTree's native Prometheus endpoints.

Prometheus

RawTree 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 RawTree platform, select Apps, and install Prometheus. Installation enables the endpoints for that cluster. It does not start or resume the cluster, so the cluster must also be available before ingestion or queries can succeed.

Remote write

Configure Prometheus to send samples to RawTree:

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. RawTree stores Prometheus data in managed prometheus_samples, prometheus_series, and prometheus_metric_metadata tables.

Query API

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

https://api.rawtree.com/prometheus

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

EndpointPurpose
POST /api/v1/writePrometheus remote write
GET, POST /api/v1/queryInstant query
GET, POST /api/v1/query_rangeRange query
GET, POST /api/v1/labelsLabel names
GET, POST /api/v1/label/{label_name}/valuesLabel values
GET, POST /api/v1/seriesSeries metadata
GET /api/v1/metadataMetric metadata
GET /api/v1/status/buildinfoCompatibility information

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

Verify the connection

After Prometheus has written samples, run an instant query:

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".