From 1cda170f28a6c4e8c379452a8ec826f153f3d26a Mon Sep 17 00:00:00 2001 From: zyy17 Date: Tue, 10 Sep 2024 21:43:55 +0800 Subject: [PATCH] ci: fix errors --- src/common/telemetry/src/logging.rs | 13 ++----------- src/servers/tests/http/http_handler_test.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/common/telemetry/src/logging.rs b/src/common/telemetry/src/logging.rs index 05c7af2f81ed..9d089a78afc9 100644 --- a/src/common/telemetry/src/logging.rs +++ b/src/common/telemetry/src/logging.rs @@ -71,8 +71,7 @@ pub struct LoggingOptions { } /// The slow query log options. -#[derive(Clone, Debug, Serialize, Deserialize)] -#[serde(default)] +#[derive(Clone, Debug, Serialize, Deserialize, Default)] pub struct SlowQueryLoggingOptions { /// Whether to enable slow query log. pub enable: bool, @@ -82,15 +81,6 @@ pub struct SlowQueryLoggingOptions { pub threshold: Option, } -impl Default for SlowQueryLoggingOptions { - fn default() -> Self { - Self { - enable: false, - threshold: None, - } - } -} - #[derive(Clone, Debug, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum LogFormat { @@ -341,6 +331,7 @@ pub fn init_global_logging( .with(stdout_logging_layer) .with(file_logging_layer) .with(err_file_logging_layer) + .with(slow_query_logging_layer); }; // consume the `tracing_opts` to avoid "unused" warnings. diff --git a/src/servers/tests/http/http_handler_test.rs b/src/servers/tests/http/http_handler_test.rs index d31352072bfb..c6613be63479 100644 --- a/src/servers/tests/http/http_handler_test.rs +++ b/src/servers/tests/http/http_handler_test.rs @@ -45,6 +45,7 @@ async fn test_sql_not_provided() { let api_state = ApiState { sql_handler, script_handler: None, + slow_query_threshold: None, }; for format in ["greptimedb_v1", "influxdb_v1", "csv", "table"] { @@ -79,6 +80,7 @@ async fn test_sql_output_rows() { let api_state = ApiState { sql_handler, script_handler: None, + slow_query_threshold: None, }; let query_sql = "select sum(uint32s) from numbers limit 20"; @@ -185,6 +187,7 @@ async fn test_dashboard_sql_limit() { let api_state = ApiState { sql_handler, script_handler: None, + slow_query_threshold: None, }; for format in ["greptimedb_v1", "csv", "table"] { let query = create_query(format, "select * from numbers", Some(1000)); @@ -231,6 +234,7 @@ async fn test_sql_form() { let api_state = ApiState { sql_handler, script_handler: None, + slow_query_threshold: None, }; for format in ["greptimedb_v1", "influxdb_v1", "csv", "table"] { @@ -352,6 +356,7 @@ async fn insert_script( State(ApiState { sql_handler: sql_handler.clone(), script_handler: Some(script_handler.clone()), + slow_query_threshold: None, }), invalid_query, body, @@ -369,6 +374,7 @@ async fn insert_script( State(ApiState { sql_handler: sql_handler.clone(), script_handler: Some(script_handler.clone()), + slow_query_threshold: None, }), exec, body, @@ -400,6 +406,7 @@ def test(n) -> vector[i64]: State(ApiState { sql_handler, script_handler: Some(script_handler), + slow_query_threshold: None, }), exec, ) @@ -468,6 +475,7 @@ def test(n, **params) -> vector[i64]: State(ApiState { sql_handler, script_handler: Some(script_handler), + slow_query_threshold: None, }), exec, )