Monitoring

Monitoring is a crucial part of database administration. 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:

  1. global:
  2. scrape_interval: 15s
  3. scrape_configs:
  4. - job_name: 'greptimedb'
  5. static_configs:
  6. # Assuming that GreptimeDB is running locally.
  7. # The default HTTP port of 4000.
  8. - targets: ['localhost:4000']

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

  1. docker run \
  2. -p 9090:9090 \
  3. -v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml \
  4. prom/prometheus

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:

  1. [export_metrics]
  2. enable=true
  3. # The interval of writing metrics.
  4. write_interval = "30s"
  5. [export_metrics.self_import]
  6. 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.

  1. [export_metrics]
  2. enable=true
  3. # The interval of writing metrics.
  4. write_interval = "30s"
  5. [export_metrics.self_import]
  6. 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:

  1. [export_metrics]
  2. enable=true
  3. write_interval = "30s"
  4. [export_metrics.remote_write]
  5. 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