From 52a7fbb981f5c3354c7a40e6e4828f6dcdf0ad32 Mon Sep 17 00:00:00 2001 From: zyy17 Date: Tue, 5 Nov 2024 18:34:53 +0800 Subject: [PATCH] refactor: add slow query logging options --- charts/greptimedb-cluster/Chart.yaml | 2 +- charts/greptimedb-cluster/README.md | 8 ++++++-- charts/greptimedb-cluster/templates/cluster.yaml | 6 ++++++ charts/greptimedb-cluster/values.yaml | 11 +++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/charts/greptimedb-cluster/Chart.yaml b/charts/greptimedb-cluster/Chart.yaml index 1123451..748f343 100644 --- a/charts/greptimedb-cluster/Chart.yaml +++ b/charts/greptimedb-cluster/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: greptimedb-cluster description: A Helm chart for deploying GreptimeDB cluster in Kubernetes. type: application -version: 0.2.25 +version: 0.2.26 appVersion: 0.9.5 home: https://github.com/GreptimeTeam/greptimedb sources: diff --git a/charts/greptimedb-cluster/README.md b/charts/greptimedb-cluster/README.md index bd15547..706e358 100644 --- a/charts/greptimedb-cluster/README.md +++ b/charts/greptimedb-cluster/README.md @@ -2,7 +2,7 @@ A Helm chart for deploying GreptimeDB cluster in Kubernetes. -![Version: 0.2.25](https://img.shields.io/badge/Version-0.2.25-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.9.5](https://img.shields.io/badge/AppVersion-0.9.5-informational?style=flat-square) +![Version: 0.2.26](https://img.shields.io/badge/Version-0.2.26-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.9.5](https://img.shields.io/badge/AppVersion-0.9.5-informational?style=flat-square) ## Source Code @@ -213,12 +213,16 @@ helm uninstall mycluster -n default | initializer.registry | string | `"docker.io"` | Initializer image registry | | initializer.repository | string | `"greptime/greptimedb-initializer"` | Initializer image repository | | initializer.tag | string | `"v0.1.2"` | Initializer image tag | -| logging | object | `{"format":"text","level":"info","logsDir":"/data/greptimedb/logs","onlyLogToStdout":false,"persistentWithData":false}` | Global logging configuration | +| logging | object | `{"format":"text","level":"info","logsDir":"/data/greptimedb/logs","onlyLogToStdout":false,"persistentWithData":false,"slowQuery":{"enabled":false,"sampleRatio":"1.0","threshold":"10s"}}` | Global logging configuration | | logging.format | string | `"text"` | The log format for greptimedb, only support "json" and "text" | | logging.level | string | `"info"` | The log level for greptimedb, only support "debug", "info", "warn", "debug" | | logging.logsDir | string | `"/data/greptimedb/logs"` | The logs directory for greptimedb | | logging.onlyLogToStdout | bool | `false` | Whether to log to stdout only | | logging.persistentWithData | bool | `false` | indicates whether to persist the log with the datanode data storage. It **ONLY** works for the datanode component. | +| logging.slowQuery | object | `{"enabled":false,"sampleRatio":"1.0","threshold":"10s"}` | The slow query log configuration. | +| logging.slowQuery.enabled | bool | `false` | Enable slow query log. | +| logging.slowQuery.sampleRatio | string | `"1.0"` | Sample ratio of slow query log. | +| logging.slowQuery.threshold | string | `"10s"` | The threshold of slow query log in seconds. | | meta | object | `{"configData":"","configFile":"","enableRegionFailover":false,"etcdEndpoints":"etcd.etcd-cluster.svc.cluster.local:2379","logging":{},"podTemplate":{"affinity":{},"annotations":{},"labels":{},"main":{"args":[],"command":[],"env":[],"image":"","livenessProbe":{},"readinessProbe":{},"resources":{"limits":{},"requests":{}},"volumeMounts":[]},"nodeSelector":{},"serviceAccount":{"annotations":{},"create":false},"tolerations":[],"volumes":[]},"replicas":1,"storeKeyPrefix":""}` | Meta configure | | meta.configData | string | `""` | Extra raw toml config data of meta. Skip if the `configFile` is used. | | meta.configFile | string | `""` | Extra toml file of meta. | diff --git a/charts/greptimedb-cluster/templates/cluster.yaml b/charts/greptimedb-cluster/templates/cluster.yaml index 2a6d8d1..02d457f 100644 --- a/charts/greptimedb-cluster/templates/cluster.yaml +++ b/charts/greptimedb-cluster/templates/cluster.yaml @@ -485,4 +485,10 @@ spec: {{- if .Values.logging.persistentWithData }} persistentWithData: {{ .Values.logging.persistentWithData }} {{- end }} + {{- if .Values.logging.slowQuery.enabled }} + slowQuery: + enabled: {{ .Values.logging.slowQuery.enabled }} + threshold: {{ .Values.logging.slowQuery.threshold }} + sampleRatio: {{ .Values.logging.slowQuery.sampleRatio | quote }} + {{- end }} {{- end }} diff --git a/charts/greptimedb-cluster/values.yaml b/charts/greptimedb-cluster/values.yaml index aa3b8ba..7f7b393 100644 --- a/charts/greptimedb-cluster/values.yaml +++ b/charts/greptimedb-cluster/values.yaml @@ -773,6 +773,17 @@ logging: # -- indicates whether to persist the log with the datanode data storage. It **ONLY** works for the datanode component. persistentWithData: false + # -- The slow query log configuration. + slowQuery: + # -- Enable slow query log. + enabled: false + + # -- The threshold of slow query log in seconds. + threshold: "10s" + + # -- Sample ratio of slow query log. + sampleRatio: "1.0" + # -- Deploy grafana for monitoring. grafana: # -- Enable grafana deployment. It needs to enable monitoring `monitoring.enabled: true` first.