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 11, 2024
1 parent 9e33e97 commit b6c5e14
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 18 deletions.
11 changes: 7 additions & 4 deletions config/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
| `logging.slow_query` | -- | -- | The slow query log options. |
| `logging.slow_query.enable` | Bool | `false` | Whether to enable slow query log. |
| `logging.slow_query.threshold` | String | `None` | The threshold of slow query. |
| `logging.slow_query.threshold` | String | Unset | The threshold of slow query. |
| `export_metrics` | -- | -- | The datanode can export its metrics and send to Prometheus compatible service (e.g. send to `greptimedb` itself) from remote-write API.<br/>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. |
Expand Down Expand Up @@ -253,7 +253,7 @@
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
| `logging.slow_query` | -- | -- | The slow query log options. |
| `logging.slow_query.enable` | Bool | `false` | Whether to enable slow query log. |
| `logging.slow_query.threshold` | String | `None` | The threshold of slow query. |
| `logging.slow_query.threshold` | String | Unset | The threshold of slow query. |
| `export_metrics` | -- | -- | The datanode can export its metrics and send to Prometheus compatible service (e.g. send to `greptimedb` itself) from remote-write API.<br/>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. |
Expand Down Expand Up @@ -321,7 +321,7 @@
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
| `logging.slow_query` | -- | -- | The slow query log options. |
| `logging.slow_query.enable` | Bool | `false` | Whether to enable slow query log. |
| `logging.slow_query.threshold` | String | `None` | The threshold of slow query. |
| `logging.slow_query.threshold` | String | Unset | The threshold of slow query. |
| `export_metrics` | -- | -- | The datanode can export its metrics and send to Prometheus compatible service (e.g. send to `greptimedb` itself) from remote-write API.<br/>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. |
Expand Down Expand Up @@ -473,6 +473,9 @@
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
| `logging.tracing_sample_ratio` | -- | -- | The percentage of tracing will be sampled and exported.<br/>Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.<br/>ratio > 1 are treated as 1. Fractions < 0 are treated as 0 |
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
| `logging.slow_query` | -- | -- | The slow query log options. |
| `logging.slow_query.enable` | Bool | `false` | Whether to enable slow query log. |
| `logging.slow_query.threshold` | String | Unset | The threshold of slow query. |
| `export_metrics` | -- | -- | The datanode can export its metrics and send to Prometheus compatible service (e.g. send to `greptimedb` itself) from remote-write API.<br/>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. |
Expand Down Expand Up @@ -521,6 +524,6 @@
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
| `logging.slow_query` | -- | -- | The slow query log options. |
| `logging.slow_query.enable` | Bool | `false` | Whether to enable slow query log. |
| `logging.slow_query.threshold` | String | `None` | The threshold of slow query. |
| `logging.slow_query.threshold` | String | Unset | The threshold of slow query. |
| `tracing` | -- | -- | The tracing options. Only effect when compiled with `tokio-console` feature. |
| `tracing.tokio_console_addr` | String | Unset | The tokio console address. |
9 changes: 9 additions & 0 deletions config/datanode.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,15 @@ log_format = "text"
[logging.tracing_sample_ratio]
default_ratio = 1.0

## The slow query log options.
[logging.slow_query]
## Whether to enable slow query log.
enable = false

## The threshold of slow query.
## @toml2docs:none-default
threshold = "10s"

## 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]
Expand Down
2 changes: 1 addition & 1 deletion config/flownode.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ default_ratio = 1.0
enable = false

## The threshold of slow query.
## +toml2docs:none-default
## @toml2docs:none-default
threshold = "10s"

## The tracing options. Only effect when compiled with `tokio-console` feature.
Expand Down
2 changes: 1 addition & 1 deletion config/frontend.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ default_ratio = 1.0
enable = false

## The threshold of slow query.
## +toml2docs:none-default
## @toml2docs:none-default
threshold = "10s"

## The datanode can export its metrics and send to Prometheus compatible service (e.g. send to `greptimedb` itself) from remote-write API.
Expand Down
2 changes: 1 addition & 1 deletion config/metasrv.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ default_ratio = 1.0
enable = false

## The threshold of slow query.
## +toml2docs:none-default
## @toml2docs:none-default
threshold = "10s"

## The datanode can export its metrics and send to Prometheus compatible service (e.g. send to `greptimedb` itself) from remote-write API.
Expand Down
2 changes: 1 addition & 1 deletion config/standalone.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ default_ratio = 1.0
enable = false

## The threshold of slow query.
## +toml2docs:none-default
## @toml2docs:none-default
threshold = "10s"

## The datanode can export its metrics and send to Prometheus compatible service (e.g. send to `greptimedb` itself) from remote-write API.
Expand Down
12 changes: 2 additions & 10 deletions src/common/telemetry/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub struct LoggingOptions {
}

/// The slow query log options.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
#[serde(default)]
pub struct SlowQueryLoggingOptions {
/// Whether to enable slow query log.
Expand All @@ -82,15 +82,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 +332,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 b6c5e14

Please sign in to comment.