Monitoring

GreptimeDB 暴露了 Prometheus 指标, 用户可以使用 Prometheus 来采集指标。

Promethues Configuration

编写 Prometheus 配置文件,并保存为prometheus.yml:

  1. global:
  2. scrape_interval: 15s
  3. scrape_configs:
  4. - job_name: 'greptimedb'
  5. static_configs:
  6. - targets: ['localhost:4000']

Start GreptimeDB and Prometheus

Binary

使用二进制安装 GreptimeDB 和 Prometheus

  1. 根据文档 安装 GreptimeDB

  2. 进入 Prometheus 官方文档 下载二进制,并执行以下命令:

  1. ./prometheus --config.file=prometheus.yml

在浏览器输入localhost:9090访问 Prometheus。

Docker

使用 Docker 安装 GreptimeDB 和 Prometheus

  1. 根据文档 安装 GreptimeDB

  2. 运行 Prometheus:

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

Kubernetes

  1. 安装 kube-prometheus-stack chart:
  1. helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
  2. helm repo update
  3. helm install prometheus prometheus-community/kube-prometheus-stack
  1. 使用 gtctl 安装 GreptimeDB cluster:
  1. gtctl cluster create mycluster -n default \
  2. --set cluster.prometheusMonitor.enabled=true \
  3. --set cluster.prometheusMonitor.path="/metrics" \
  4. --set cluster.prometheusMonitor.port="http" \
  5. --set cluster.prometheusMonitor.interval="30s" \
  6. --set cluster.prometheusMonitor.honorLabels=true \
  7. --set cluster.prometheusMonitor.labelsSelector.release="prometheus"

Metrics Detail

可以通过执行curl http://<host>:<port>/metrics的输出来获取 GreptimeDB 的最新指标。

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