Skip to content
On this page

Prometheus

GreptimeDB supports both of Prometheus's remote Read and Write endpoints:

  • /v1/prometheus/write for remote write
  • /v1/prometheus/read for remote read

Of course, there is a /metrics endpoint to produce GreptimeDB's internal metrics in the same format as Prometheus.

Create a database

sql
CREATE DATABASE prometheus

Configuration

Please follow the settings in Prometheus configuration (prometheus.yml):

  • remote_write
  • remote_read

The configured URLs must be accessible by your running Prometheus servers. For example:

yaml
remote_write:
- url: http://localhost:4000/v1/prometheus/write?db=prometheus

remote_read:
- url: http://localhost:4000/v1/prometheus/read?db=prometheus

Prometheus Metrics in GreptimeDB

When the metrics are written into GreptimeDB by remote write endpoint, they will be transformed as follows:

Sample MetricsIn GreptimeDBGreptimeDB Data Types
NameTable (Auto-created) NameString
ValueColumn (greptime_value)Double
TimestampColumn (greptime_timestamp)Timestamp
LabelColumnString

A primary key with all label columns will be created automatically. When a new label is added, it will be added into primary key automatically too.

Example: Prometheus metrics in GreptimeDB Table

text
prometheus_remote_storage_samples_total{instance="localhost:9090", job="prometheus",
remote_name="648f0c", url="http://localhost:4000/v1/prometheus/write"} 500

This example will be transformed as a row in the table prometheus_remote_storage_samples_total

ColumnValueColumn Data Type
instancelocalhost:9090String
jobprometheusString
remote_name648f0cString
urlhttp://localhost:4000/v1/prometheus/writeString
greptime_value500Double
greptime_timestampThe sample's unix timestampTimestamp