Skip to content

Commit

Permalink
ci: fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
zyy17 committed Sep 10, 2024
1 parent 73df150 commit 1cda170
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/common/telemetry/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -82,15 +81,6 @@ pub struct SlowQueryLoggingOptions {
pub threshold: Option<Duration>,
}

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 {
Expand Down Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions src/servers/tests/http/http_handler_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"] {
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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"] {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -400,6 +406,7 @@ def test(n) -> vector[i64]:
State(ApiState {
sql_handler,
script_handler: Some(script_handler),
slow_query_threshold: None,
}),
exec,
)
Expand Down Expand Up @@ -468,6 +475,7 @@ def test(n, **params) -> vector[i64]:
State(ApiState {
sql_handler,
script_handler: Some(script_handler),
slow_query_threshold: None,
}),
exec,
)
Expand Down

0 comments on commit 1cda170

Please sign in to comment.