Prometheus

Store and query Prometheus metrics with service Prometheus endpoints.

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

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