From 01076069a3f340181f2746d3c12ec80c1ee3f80c Mon Sep 17 00:00:00 2001 From: zyy17 Date: Fri, 16 May 2025 04:16:13 +0800 Subject: [PATCH] chore: modify default `slow_query.threshold` from 5s to 30s (#6107) chore: modify slow_query.threshold from 5s to 30s --- config/config.md | 8 ++++---- config/frontend.example.toml | 6 +----- src/common/telemetry/src/logging.rs | 2 +- tests-integration/tests/http.rs | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/config/config.md b/config/config.md index ff296b91ce..fe318c91b9 100644 --- a/config/config.md +++ b/config/config.md @@ -291,10 +291,10 @@ | `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- | | `slow_query` | -- | -- | The slow query log options. | | `slow_query.enable` | Bool | `true` | Whether to enable slow query log. | -| `slow_query.record_type` | String | Unset | The record type of slow queries. It can be `system_table` or `log`.
If `system_table` is selected, the slow queries will be recorded in a system table `greptime_private.slow_queries`.
If `log` is selected, the slow queries will be logged in a log file `greptimedb-slow-queries.*`. | -| `slow_query.threshold` | String | Unset | The threshold of slow query. It can be human readable time string, for example: `10s`, `100ms`, `1s`. | -| `slow_query.sample_ratio` | Float | Unset | The sampling ratio of slow query log. The value should be in the range of (0, 1]. For example, `0.1` means 10% of the slow queries will be logged and `1.0` means all slow queries will be logged. | -| `slow_query.ttl` | String | Unset | The TTL of the `slow_queries` system table. Default is `30d` when `record_type` is `system_table`. | +| `slow_query.record_type` | String | `system_table` | The record type of slow queries. It can be `system_table` or `log`.
If `system_table` is selected, the slow queries will be recorded in a system table `greptime_private.slow_queries`.
If `log` is selected, the slow queries will be logged in a log file `greptimedb-slow-queries.*`. | +| `slow_query.threshold` | String | `30s` | The threshold of slow query. It can be human readable time string, for example: `10s`, `100ms`, `1s`. | +| `slow_query.sample_ratio` | Float | `1.0` | The sampling ratio of slow query log. The value should be in the range of (0, 1]. For example, `0.1` means 10% of the slow queries will be logged and `1.0` means all slow queries will be logged. | +| `slow_query.ttl` | String | `30d` | The TTL of the `slow_queries` system table. Default is `30d` when `record_type` is `system_table`. | | `export_metrics` | -- | -- | The datanode can export its metrics and send to Prometheus compatible service (e.g. send to `greptimedb` itself) from remote-write API.
This is only used for `greptimedb` to export its own metrics internally. It's different from prometheus scrape. | | `export_metrics.enable` | Bool | `false` | whether enable export metrics. | | `export_metrics.write_interval` | String | `30s` | The interval of export metrics. | diff --git a/config/frontend.example.toml b/config/frontend.example.toml index 2a9ee2bc8c..6d9f9e08ea 100644 --- a/config/frontend.example.toml +++ b/config/frontend.example.toml @@ -230,19 +230,15 @@ enable = true ## The record type of slow queries. It can be `system_table` or `log`. ## If `system_table` is selected, the slow queries will be recorded in a system table `greptime_private.slow_queries`. ## If `log` is selected, the slow queries will be logged in a log file `greptimedb-slow-queries.*`. -## @toml2docs:none-default record_type = "system_table" ## The threshold of slow query. It can be human readable time string, for example: `10s`, `100ms`, `1s`. -## @toml2docs:none-default -threshold = "5s" +threshold = "30s" ## The sampling ratio of slow query log. The value should be in the range of (0, 1]. For example, `0.1` means 10% of the slow queries will be logged and `1.0` means all slow queries will be logged. -## @toml2docs:none-default sample_ratio = 1.0 ## The TTL of the `slow_queries` system table. Default is `30d` when `record_type` is `system_table`. -## @toml2docs:none-default ttl = "30d" ## The datanode can export its metrics and send to Prometheus compatible service (e.g. send to `greptimedb` itself) from remote-write API. diff --git a/src/common/telemetry/src/logging.rs b/src/common/telemetry/src/logging.rs index 6ac4f343d6..26239f44f4 100644 --- a/src/common/telemetry/src/logging.rs +++ b/src/common/telemetry/src/logging.rs @@ -96,7 +96,7 @@ impl Default for SlowQueryOptions { Self { enable: true, record_type: SlowQueriesRecordType::SystemTable, - threshold: Some(Duration::from_secs(5)), + threshold: Some(Duration::from_secs(30)), sample_ratio: Some(1.0), ttl: Some("30d".to_string()), } diff --git a/tests-integration/tests/http.rs b/tests-integration/tests/http.rs index fd37a7971a..901b662ed8 100644 --- a/tests-integration/tests/http.rs +++ b/tests-integration/tests/http.rs @@ -1151,7 +1151,7 @@ write_interval = "30s" [slow_query] enable = true record_type = "system_table" -threshold = "5s" +threshold = "30s" sample_ratio = 1.0 ttl = "30d" "#,