From 39709434d8a380d9efc3f3c7ba22b0fa5de7945a Mon Sep 17 00:00:00 2001 From: Weny Xu Date: Tue, 6 Aug 2024 14:48:14 +0800 Subject: [PATCH] chore: set default `otlp_endpoint` (#4508) * chore: set default `otlp_endpoint` * fix: fix ci --- config/config.md | 10 +++++----- config/datanode.example.toml | 3 +-- config/flownode.example.toml | 3 +-- config/frontend.example.toml | 3 +-- config/metasrv.example.toml | 3 +-- config/standalone.example.toml | 3 +-- src/cmd/tests/load_config_test.rs | 10 +++++----- src/common/telemetry/src/logging.rs | 2 +- 8 files changed, 16 insertions(+), 21 deletions(-) diff --git a/config/config.md b/config/config.md index b2a96860ecf7..3fe696abac3c 100644 --- a/config/config.md +++ b/config/config.md @@ -145,7 +145,7 @@ | `logging.dir` | String | `/tmp/greptimedb/logs` | The directory to store the log files. | | `logging.level` | String | `None` | The log level. Can be `info`/`debug`/`warn`/`error`. | | `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. | -| `logging.otlp_endpoint` | String | `None` | The OTLP tracing endpoint. | +| `logging.otlp_endpoint` | String | `http://localhost:4317` | The OTLP tracing endpoint. | | `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. | | `logging.tracing_sample_ratio` | -- | -- | The percentage of tracing will be sampled and exported.
Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
ratio > 1 are treated as 1. Fractions < 0 are treated as 0 | | `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- | @@ -230,7 +230,7 @@ | `logging.dir` | String | `/tmp/greptimedb/logs` | The directory to store the log files. | | `logging.level` | String | `None` | The log level. Can be `info`/`debug`/`warn`/`error`. | | `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. | -| `logging.otlp_endpoint` | String | `None` | The OTLP tracing endpoint. | +| `logging.otlp_endpoint` | String | `http://localhost:4317` | The OTLP tracing endpoint. | | `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. | | `logging.tracing_sample_ratio` | -- | -- | The percentage of tracing will be sampled and exported.
Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
ratio > 1 are treated as 1. Fractions < 0 are treated as 0 | | `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- | @@ -292,7 +292,7 @@ | `logging.dir` | String | `/tmp/greptimedb/logs` | The directory to store the log files. | | `logging.level` | String | `None` | The log level. Can be `info`/`debug`/`warn`/`error`. | | `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. | -| `logging.otlp_endpoint` | String | `None` | The OTLP tracing endpoint. | +| `logging.otlp_endpoint` | String | `http://localhost:4317` | The OTLP tracing endpoint. | | `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. | | `logging.tracing_sample_ratio` | -- | -- | The percentage of tracing will be sampled and exported.
Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
ratio > 1 are treated as 1. Fractions < 0 are treated as 0 | | `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- | @@ -432,7 +432,7 @@ | `logging.dir` | String | `/tmp/greptimedb/logs` | The directory to store the log files. | | `logging.level` | String | `None` | The log level. Can be `info`/`debug`/`warn`/`error`. | | `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. | -| `logging.otlp_endpoint` | String | `None` | The OTLP tracing endpoint. | +| `logging.otlp_endpoint` | String | `http://localhost:4317` | The OTLP tracing endpoint. | | `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. | | `logging.tracing_sample_ratio` | -- | -- | The percentage of tracing will be sampled and exported.
Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
ratio > 1 are treated as 1. Fractions < 0 are treated as 0 | | `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- | @@ -477,7 +477,7 @@ | `logging.dir` | String | `/tmp/greptimedb/logs` | The directory to store the log files. | | `logging.level` | String | `None` | The log level. Can be `info`/`debug`/`warn`/`error`. | | `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. | -| `logging.otlp_endpoint` | String | `None` | The OTLP tracing endpoint. | +| `logging.otlp_endpoint` | String | `http://localhost:4317` | The OTLP tracing endpoint. | | `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. | | `logging.tracing_sample_ratio` | -- | -- | The percentage of tracing will be sampled and exported.
Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
ratio > 1 are treated as 1. Fractions < 0 are treated as 0 | | `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- | diff --git a/config/datanode.example.toml b/config/datanode.example.toml index 97e4fae1d503..7754542c6238 100644 --- a/config/datanode.example.toml +++ b/config/datanode.example.toml @@ -493,8 +493,7 @@ level = "info" enable_otlp_tracing = false ## The OTLP tracing endpoint. -## +toml2docs:none-default -otlp_endpoint = "" +otlp_endpoint = "http://localhost:4317" ## Whether to append logs to stdout. append_stdout = true diff --git a/config/flownode.example.toml b/config/flownode.example.toml index 0f9ddea45740..443edb0303f5 100644 --- a/config/flownode.example.toml +++ b/config/flownode.example.toml @@ -70,8 +70,7 @@ level = "info" enable_otlp_tracing = false ## The OTLP tracing endpoint. -## +toml2docs:none-default -otlp_endpoint = "" +otlp_endpoint = "http://localhost:4317" ## Whether to append logs to stdout. append_stdout = true diff --git a/config/frontend.example.toml b/config/frontend.example.toml index 8f6a1c859ee4..d59719c8c1d2 100644 --- a/config/frontend.example.toml +++ b/config/frontend.example.toml @@ -177,8 +177,7 @@ level = "info" enable_otlp_tracing = false ## The OTLP tracing endpoint. -## +toml2docs:none-default -otlp_endpoint = "" +otlp_endpoint = "http://localhost:4317" ## Whether to append logs to stdout. append_stdout = true diff --git a/config/metasrv.example.toml b/config/metasrv.example.toml index 494e89a1c2f2..7a71d4a8cbcb 100644 --- a/config/metasrv.example.toml +++ b/config/metasrv.example.toml @@ -136,8 +136,7 @@ level = "info" enable_otlp_tracing = false ## The OTLP tracing endpoint. -## +toml2docs:none-default -otlp_endpoint = "" +otlp_endpoint = "http://localhost:4317" ## Whether to append logs to stdout. append_stdout = true diff --git a/config/standalone.example.toml b/config/standalone.example.toml index 36a46e9ed9d0..73775b9fc1c4 100644 --- a/config/standalone.example.toml +++ b/config/standalone.example.toml @@ -522,8 +522,7 @@ level = "info" enable_otlp_tracing = false ## The OTLP tracing endpoint. -## +toml2docs:none-default -otlp_endpoint = "" +otlp_endpoint = "http://localhost:4317" ## Whether to append logs to stdout. append_stdout = true diff --git a/src/cmd/tests/load_config_test.rs b/src/cmd/tests/load_config_test.rs index a6a632805951..8545b708cf6f 100644 --- a/src/cmd/tests/load_config_test.rs +++ b/src/cmd/tests/load_config_test.rs @@ -22,7 +22,7 @@ use common_grpc::channel_manager::{ DEFAULT_MAX_GRPC_RECV_MESSAGE_SIZE, DEFAULT_MAX_GRPC_SEND_MESSAGE_SIZE, }; use common_runtime::global::RuntimeOptions; -use common_telemetry::logging::LoggingOptions; +use common_telemetry::logging::{LoggingOptions, DEFAULT_OTLP_ENDPOINT}; use common_wal::config::raft_engine::RaftEngineConfig; use common_wal::config::DatanodeWalConfig; use datanode::config::{DatanodeOptions, RegionEngineConfig, StorageConfig}; @@ -88,7 +88,7 @@ fn test_load_datanode_example_config() { ], logging: LoggingOptions { level: Some("info".to_string()), - otlp_endpoint: Some("".to_string()), + otlp_endpoint: Some(DEFAULT_OTLP_ENDPOINT.to_string()), tracing_sample_ratio: Some(Default::default()), ..Default::default() }, @@ -136,7 +136,7 @@ fn test_load_frontend_example_config() { }), logging: LoggingOptions { level: Some("info".to_string()), - otlp_endpoint: Some("".to_string()), + otlp_endpoint: Some(DEFAULT_OTLP_ENDPOINT.to_string()), tracing_sample_ratio: Some(Default::default()), ..Default::default() }, @@ -174,7 +174,7 @@ fn test_load_metasrv_example_config() { logging: LoggingOptions { dir: "/tmp/greptimedb/logs".to_string(), level: Some("info".to_string()), - otlp_endpoint: Some("".to_string()), + otlp_endpoint: Some(DEFAULT_OTLP_ENDPOINT.to_string()), tracing_sample_ratio: Some(Default::default()), ..Default::default() }, @@ -228,7 +228,7 @@ fn test_load_standalone_example_config() { }, logging: LoggingOptions { level: Some("info".to_string()), - otlp_endpoint: Some("".to_string()), + otlp_endpoint: Some(DEFAULT_OTLP_ENDPOINT.to_string()), tracing_sample_ratio: Some(Default::default()), ..Default::default() }, diff --git a/src/common/telemetry/src/logging.rs b/src/common/telemetry/src/logging.rs index 4088c5236ca8..0a60e35a0bdf 100644 --- a/src/common/telemetry/src/logging.rs +++ b/src/common/telemetry/src/logging.rs @@ -33,7 +33,7 @@ use tracing_subscriber::{filter, EnvFilter, Registry}; use crate::tracing_sampler::{create_sampler, TracingSampleOptions}; -const DEFAULT_OTLP_ENDPOINT: &str = "http://localhost:4317"; +pub const DEFAULT_OTLP_ENDPOINT: &str = "http://localhost:4317"; #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(default)]