Skip to main content
Version: 0.11

Export Metrics

By monitoring metrics, you can assess the state of the database, maintain the deployment without crisis, and diagnose problems when they occur.

For detailed metrics of GreptimeDB, please refer to the Metrics Detail section.

Start GreptimeDB

Please refer to the documentation to learn how to start GreptimeDB.

Export metrics to Prometheus

GreptimeDB supports exporting metrics to Prometheus. Before configuring export of metrics, you need to setup Prometheus by following their official documentation.

To scrape metrics from GreptimeDB, write a Prometheus configuration file and save it as prometheus.yml:

global:
scrape_interval: 15s

scrape_configs:
- job_name: 'greptimedb'
static_configs:
# Assuming that GreptimeDB is running locally.
# The default HTTP port of 4000.
- targets: ['localhost:4000']

Start Prometheus using the configuration file. For example, bind-mount the configuration file when starting Prometheus using Docker:

docker run \
-p 9090:9090 \
-v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus
NOTE

To avoid accidently exit the Docker container, you may want to run it in the "detached" mode: add the -d flag to the docker run command.

Save metrics to GreptimeDB itself

You can also save metrics to GreptimeDB itself for convenient querying and analysis using SQL statements. This section provides some configuration examples. For more details about configuration, please refer to the Monitor metrics options.

Standalone

In standalone mode, you can simply use self_import to export metrics. The configuration looks like this:

[export_metrics]
enable=true
# The interval of writing metrics.
write_interval = "30s"
[export_metrics.self_import]
db = "information_schema"

The db option specifies the database where metrics are saved. You can change it to a different database.

Distributed cluster

Configuration files need to be written for each component in the cluster.

Frontend

you can simply use self_import to export metrics.

[export_metrics]
enable=true
# The interval of writing metrics.
write_interval = "30s"
[export_metrics.self_import]
db = "information_schema"

The db option specifies the database where metrics are saved. You can change it to a different database.

Datanode and Metasrv

To export metrics for Datanode and Metasrv, you can use the remote_write configuration:

[export_metrics]
enable=true
write_interval = "30s"
[export_metrics.remote_write]
url = "http://127.0.0.1:4000/v1/prometheus/write?db=system"

GreptimeDB is compatible with the Prometheus Remote-Write protocol. For more information, please refer to the Prometheus Remote-Write documentation.

Metrics Detail

You can check the output of curl http://<host>:<port>/metrics by getting the latest metrics of GreptimeDB. We will add more documents of the metrics sooner.

Frontend

KeyType
greptime_table_operator_ingest_rowscounter
greptime_servers_errorcounter
greptime_servers_http_requests_totalcounter
greptime_servers_postgres_connection_countgauge
greptime_servers_mysql_connection_countgauge
greptime_query_merge_scan_regionssummary
greptime_servers_http_sql_elapsedsummary
greptime_query_optimize_physicalplan_elapsedsummary
greptime_frontend_handle_sql_elapsedsummary
greptime_http_track_metricssummary
greptime_query_create_physicalplan_elapsedsummary
greptime_servers_mysql_query_elapsedsummary
greptime_servers_http_requests_elapsedsummary
greptime_query_execute_plan_elapsedsummary
greptime_catalog_kv_get_remotesummary
greptime_grpc_region_requestsummary
greptime_query_merge_scan_poll_elapsedsummary
greptime_catalog_kv_getsummary
greptime_table_operator_create_tablesummary

Datanode

KeyType
greptime_opendal_bytes_totalcounter
greptime_servers_http_requests_totalcounter
greptime_opendal_requests_totalcounter
greptime_catalog_catalog_countgauge
greptime_catalog_schema_countgauge
greptime_opendal_requests_duration_secondssummary
greptime_http_track_metricssummary
greptime_servers_http_requests_elapsedsummary

Meta

KeyType
greptime_meta_create_schemacounter
greptime_servers_http_requests_totalcounter
greptime_meta_create_catalogcounter
greptime_meta_heartbeat_connection_numgauge
greptime_meta_txn_requestsummary
greptime_meta_kv_requestsummary
greptime_meta_create_schemasummary
greptime_meta_create_catalogsummary
greptime_meta_handler_executesummary
greptime_servers_http_requests_elapsedsummary
greptime_http_track_metricssummary
greptime_meta_procedure_create_tablesummary
greptime_grpc_region_requestsummary