feat: update opentelemetry family (#6762)

* feat: update opentelemetry family

Signed-off-by: Ning Sun <sunning@greptime.com>

* doc: update doc samples

Signed-off-by: Ning Sun <sunning@greptime.com>

* chore: toml format

Signed-off-by: Ning Sun <sunning@greptime.com>

* chore: update default otel enpoint

Signed-off-by: Ning Sun <sunning@greptime.com>

---------

Signed-off-by: Ning Sun <sunning@greptime.com>
This commit is contained in:
Ning Sun
2025-08-19 17:23:50 +08:00
committed by GitHub
parent 8fc3a9a9d7
commit 5a4036cc66
10 changed files with 122 additions and 352 deletions

372
Cargo.lock generated
View File

@@ -814,33 +814,6 @@ dependencies = [
"tower-service",
]
[[package]]
name = "axum"
version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f"
dependencies = [
"async-trait",
"axum-core 0.4.5",
"bytes",
"futures-util",
"http 1.3.1",
"http-body 1.0.1",
"http-body-util",
"itoa",
"matchit 0.7.3",
"memchr",
"mime",
"percent-encoding",
"pin-project-lite",
"rustversion",
"serde",
"sync_wrapper 1.0.2",
"tower 0.5.2",
"tower-layer",
"tower-service",
]
[[package]]
name = "axum"
version = "0.8.4"
@@ -893,26 +866,6 @@ dependencies = [
"tower-service",
]
[[package]]
name = "axum-core"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199"
dependencies = [
"async-trait",
"bytes",
"futures-util",
"http 1.3.1",
"http-body 1.0.1",
"http-body-util",
"mime",
"pin-project-lite",
"rustversion",
"sync_wrapper 1.0.2",
"tower-layer",
"tower-service",
]
[[package]]
name = "axum-core"
version = "0.5.2"
@@ -1847,7 +1800,7 @@ dependencies = [
"operator",
"query",
"rand 0.9.1",
"reqwest 0.12.21",
"reqwest",
"serde",
"serde_json",
"servers",
@@ -1986,7 +1939,7 @@ dependencies = [
"query",
"rand 0.9.1",
"regex",
"reqwest 0.12.21",
"reqwest",
"rexpect",
"serde",
"serde_json",
@@ -2264,7 +2217,7 @@ dependencies = [
"common-test-util",
"common-version",
"hyper 0.14.32",
"reqwest 0.12.21",
"reqwest",
"serde",
"tempfile",
"tokio",
@@ -2607,10 +2560,10 @@ dependencies = [
"humantime-serde",
"lazy_static",
"once_cell",
"opentelemetry 0.21.0",
"opentelemetry",
"opentelemetry-otlp",
"opentelemetry-semantic-conventions",
"opentelemetry_sdk 0.21.2",
"opentelemetry_sdk",
"parking_lot 0.12.4",
"prometheus",
"serde",
@@ -2618,7 +2571,7 @@ dependencies = [
"tokio",
"tracing",
"tracing-appender",
"tracing-log 0.1.4",
"tracing-log",
"tracing-opentelemetry",
"tracing-subscriber",
]
@@ -3373,7 +3326,7 @@ dependencies = [
"recursive",
"sqlparser 0.55.0",
"tokio",
"web-time 1.1.0",
"web-time",
]
[[package]]
@@ -3931,7 +3884,7 @@ dependencies = [
"prometheus",
"prost 0.13.5",
"query",
"reqwest 0.12.21",
"reqwest",
"serde",
"serde_json",
"servers",
@@ -4211,7 +4164,7 @@ dependencies = [
"tokio-util",
"tracing",
"variadics",
"web-time 1.1.0",
"web-time",
]
[[package]]
@@ -4513,7 +4466,7 @@ dependencies = [
"tokio",
"tokio-stream",
"tonic 0.13.1",
"tonic-build 0.13.1",
"tonic-build",
"tower 0.5.2",
"tower-service",
]
@@ -4920,7 +4873,7 @@ dependencies = [
"log-store",
"meta-client",
"num_cpus",
"opentelemetry-proto 0.27.0",
"opentelemetry-proto",
"operator",
"otel-arrow-rust",
"partition",
@@ -5328,7 +5281,7 @@ dependencies = [
"strum 0.25.0",
"strum_macros 0.25.3",
"tonic 0.13.1",
"tonic-build 0.13.1",
"tonic-build",
]
[[package]]
@@ -7076,12 +7029,12 @@ dependencies = [
[[package]]
name = "loki-proto"
version = "0.1.0"
source = "git+https://github.com/GreptimeTeam/loki-proto.git?rev=1434ecf23a2654025d86188fb5205e7a74b225d3#1434ecf23a2654025d86188fb5205e7a74b225d3"
source = "git+https://github.com/GreptimeTeam/loki-proto.git?rev=3b7cd33234358b18ece977bf689dc6fb760f29ab#3b7cd33234358b18ece977bf689dc6fb760f29ab"
dependencies = [
"prost 0.13.5",
"prost-types 0.13.5",
"tonic 0.12.3",
"tonic-build 0.12.3",
"tonic 0.13.1",
"tonic-build",
]
[[package]]
@@ -8362,7 +8315,7 @@ dependencies = [
"moka",
"opendal",
"prometheus",
"reqwest 0.12.21",
"reqwest",
"serde",
"snafu 0.8.6",
"tokio",
@@ -8390,7 +8343,7 @@ dependencies = [
"url",
"walkdir",
"wasm-bindgen-futures",
"web-time 1.1.0",
"web-time",
]
[[package]]
@@ -8501,7 +8454,7 @@ dependencies = [
"prometheus",
"quick-xml 0.37.5",
"reqsign",
"reqwest 0.12.21",
"reqwest",
"serde",
"serde_json",
"sha2",
@@ -8545,143 +8498,89 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
[[package]]
name = "opentelemetry"
version = "0.21.0"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a"
dependencies = [
"futures-core",
"futures-sink",
"indexmap 2.10.0",
"js-sys",
"once_cell",
"pin-project-lite",
"thiserror 1.0.69",
"urlencoding",
]
[[package]]
name = "opentelemetry"
version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab70038c28ed37b97d8ed414b6429d343a8bbf44c9f79ec854f3a643029ba6d7"
checksum = "aaf416e4cb72756655126f7dd7bb0af49c674f4c1b9903e80c009e0c37e552e6"
dependencies = [
"futures-core",
"futures-sink",
"js-sys",
"pin-project-lite",
"thiserror 1.0.69",
"thiserror 2.0.12",
"tracing",
]
[[package]]
name = "opentelemetry-http"
version = "0.10.0"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f51189ce8be654f9b5f7e70e49967ed894e84a06fc35c6c042e64ac1fc5399e"
checksum = "50f6639e842a97dbea8886e3439710ae463120091e2e064518ba8e716e6ac36d"
dependencies = [
"async-trait",
"bytes",
"http 0.2.12",
"opentelemetry 0.21.0",
"reqwest 0.11.27",
"http 1.3.1",
"opentelemetry",
"reqwest",
]
[[package]]
name = "opentelemetry-otlp"
version = "0.14.0"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f24cda83b20ed2433c68241f918d0f6fdec8b1d43b7a9590ab4420c5095ca930"
checksum = "dbee664a43e07615731afc539ca60c6d9f1a9425e25ca09c57bc36c87c55852b"
dependencies = [
"async-trait",
"futures-core",
"http 0.2.12",
"opentelemetry 0.21.0",
"http 1.3.1",
"opentelemetry",
"opentelemetry-http",
"opentelemetry-proto 0.4.0",
"opentelemetry-semantic-conventions",
"opentelemetry_sdk 0.21.2",
"prost 0.11.9",
"reqwest 0.11.27",
"thiserror 1.0.69",
"opentelemetry-proto",
"opentelemetry_sdk",
"prost 0.13.5",
"reqwest",
"thiserror 2.0.12",
"tokio",
"tonic 0.9.2",
"tonic 0.13.1",
"tracing",
]
[[package]]
name = "opentelemetry-proto"
version = "0.4.0"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2e155ce5cc812ea3d1dffbd1539aed653de4bf4882d60e6e04dcf0901d674e1"
dependencies = [
"opentelemetry 0.21.0",
"opentelemetry_sdk 0.21.2",
"prost 0.11.9",
"tonic 0.9.2",
]
[[package]]
name = "opentelemetry-proto"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6e05acbfada5ec79023c85368af14abd0b307c015e9064d249b2a950ef459a6"
checksum = "2e046fd7660710fe5a05e8748e70d9058dc15c94ba914e7c4faa7c728f0e8ddc"
dependencies = [
"base64 0.22.1",
"hex",
"opentelemetry 0.27.1",
"opentelemetry_sdk 0.27.1",
"opentelemetry",
"opentelemetry_sdk",
"prost 0.13.5",
"serde",
"tonic 0.12.3",
"tonic 0.13.1",
]
[[package]]
name = "opentelemetry-semantic-conventions"
version = "0.13.0"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5774f1ef1f982ef2a447f6ee04ec383981a3ab99c8e77a1a7b30182e65bbc84"
dependencies = [
"opentelemetry 0.21.0",
]
checksum = "83d059a296a47436748557a353c5e6c5705b9470ef6c95cfc52c21a8814ddac2"
[[package]]
name = "opentelemetry_sdk"
version = "0.21.2"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f16aec8a98a457a52664d69e0091bac3a0abd18ead9b641cb00202ba4e0efe4"
checksum = "11f644aa9e5e31d11896e024305d7e3c98a88884d9f8919dbf37a9991bc47a4b"
dependencies = [
"async-trait",
"crossbeam-channel",
"futures-channel",
"futures-executor",
"futures-util",
"glob",
"once_cell",
"opentelemetry 0.21.0",
"ordered-float 4.6.0",
"opentelemetry",
"percent-encoding",
"rand 0.8.5",
"thiserror 1.0.69",
"rand 0.9.1",
"serde_json",
"thiserror 2.0.12",
"tokio",
"tokio-stream",
]
[[package]]
name = "opentelemetry_sdk"
version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "231e9d6ceef9b0b2546ddf52335785ce41252bc7474ee8ba05bfad277be13ab8"
dependencies = [
"async-trait",
"futures-channel",
"futures-executor",
"futures-util",
"glob",
"opentelemetry 0.27.1",
"percent-encoding",
"rand 0.8.5",
"serde_json",
"thiserror 1.0.69",
]
[[package]]
name = "operator"
version = "0.17.0"
@@ -8879,7 +8778,7 @@ dependencies = [
"snafu 0.8.6",
"tokio",
"tonic 0.13.1",
"tonic-build 0.13.1",
"tonic-build",
]
[[package]]
@@ -8899,7 +8798,7 @@ name = "otlp-model"
version = "0.1.0"
source = "git+https://github.com/GreptimeTeam/otel-arrow?rev=2d64b7c0fa95642028a8205b36fe9ea0b023ec59#2d64b7c0fa95642028a8205b36fe9ea0b023ec59"
dependencies = [
"tonic-build 0.13.1",
"tonic-build",
]
[[package]]
@@ -10283,7 +10182,7 @@ dependencies = [
"thiserror 2.0.12",
"tokio",
"tracing",
"web-time 1.1.0",
"web-time",
]
[[package]]
@@ -10304,7 +10203,7 @@ dependencies = [
"thiserror 2.0.12",
"tinyvec",
"tracing",
"web-time 1.1.0",
"web-time",
]
[[package]]
@@ -10680,7 +10579,7 @@ dependencies = [
"percent-encoding",
"quick-xml 0.37.5",
"rand 0.8.5",
"reqwest 0.12.21",
"reqwest",
"rsa",
"rust-ini 0.21.1",
"serde",
@@ -10690,42 +10589,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "reqwest"
version = "0.11.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62"
dependencies = [
"base64 0.21.7",
"bytes",
"encoding_rs",
"futures-core",
"futures-util",
"h2 0.3.26",
"http 0.2.12",
"http-body 0.4.6",
"hyper 0.14.32",
"ipnet",
"js-sys",
"log",
"mime",
"once_cell",
"percent-encoding",
"pin-project-lite",
"serde",
"serde_json",
"serde_urlencoded",
"sync_wrapper 0.1.2",
"system-configuration",
"tokio",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"winreg",
]
[[package]]
name = "reqwest"
version = "0.12.21"
@@ -10734,6 +10597,7 @@ checksum = "4c8cea6b35bcceb099f30173754403d2eba0a5dc18cea3630fccd88251909288"
dependencies = [
"base64 0.22.1",
"bytes",
"futures-channel",
"futures-core",
"futures-util",
"http 1.3.1",
@@ -11179,7 +11043,7 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79"
dependencies = [
"web-time 1.1.0",
"web-time",
"zeroize",
]
@@ -11708,7 +11572,7 @@ dependencies = [
"once_cell",
"openmetrics-parser",
"opensrv-mysql",
"opentelemetry-proto 0.27.0",
"opentelemetry-proto",
"otel-arrow-rust",
"parking_lot 0.12.4",
"permutation",
@@ -11724,7 +11588,7 @@ dependencies = [
"quoted-string",
"rand 0.9.1",
"regex",
"reqwest 0.12.21",
"reqwest",
"rust-embed",
"rustls",
"rustls-pemfile",
@@ -12174,7 +12038,7 @@ dependencies = [
"local-ip-address",
"mysql",
"num_cpus",
"reqwest 0.12.21",
"reqwest",
"serde",
"serde_json",
"sha2",
@@ -12796,27 +12660,6 @@ dependencies = [
"nom 7.1.3",
]
[[package]]
name = "system-configuration"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
dependencies = [
"bitflags 1.3.2",
"core-foundation 0.9.4",
"system-configuration-sys",
]
[[package]]
name = "system-configuration-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "table"
version = "0.17.0"
@@ -13115,7 +12958,7 @@ dependencies = [
"paste",
"rand 0.9.1",
"rand_chacha 0.9.0",
"reqwest 0.12.21",
"reqwest",
"schemars 0.8.22",
"serde",
"serde_json",
@@ -13184,7 +13027,7 @@ dependencies = [
"moka",
"mysql_async",
"object-store",
"opentelemetry-proto 0.27.0",
"opentelemetry-proto",
"operator",
"otel-arrow-rust",
"partition",
@@ -13651,36 +13494,6 @@ dependencies = [
"tracing",
]
[[package]]
name = "tonic"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52"
dependencies = [
"async-stream",
"async-trait",
"axum 0.7.9",
"base64 0.22.1",
"bytes",
"h2 0.4.11",
"http 1.3.1",
"http-body 1.0.1",
"http-body-util",
"hyper 1.6.0",
"hyper-timeout 0.5.2",
"hyper-util",
"percent-encoding",
"pin-project",
"prost 0.13.5",
"socket2 0.5.10",
"tokio",
"tokio-stream",
"tower 0.4.13",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "tonic"
version = "0.13.1"
@@ -13713,20 +13526,6 @@ dependencies = [
"zstd 0.13.3",
]
[[package]]
name = "tonic-build"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9557ce109ea773b399c9b9e5dca39294110b74f1f342cb347a80d1fce8c26a11"
dependencies = [
"prettyplease",
"proc-macro2",
"prost-build 0.13.5",
"prost-types 0.13.5",
"quote",
"syn 2.0.104",
]
[[package]]
name = "tonic-build"
version = "0.13.1"
@@ -13901,17 +13700,6 @@ dependencies = [
"valuable",
]
[[package]]
name = "tracing-log"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2"
dependencies = [
"log",
"once_cell",
"tracing-core",
]
[[package]]
name = "tracing-log"
version = "0.2.0"
@@ -13925,20 +13713,20 @@ dependencies = [
[[package]]
name = "tracing-opentelemetry"
version = "0.22.0"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c67ac25c5407e7b961fafc6f7e9aa5958fd297aada2d20fa2ae1737357e55596"
checksum = "ddcf5959f39507d0d04d6413119c04f33b623f4f951ebcbdddddfad2d0623a9c"
dependencies = [
"js-sys",
"once_cell",
"opentelemetry 0.21.0",
"opentelemetry_sdk 0.21.2",
"opentelemetry",
"opentelemetry_sdk",
"smallvec",
"tracing",
"tracing-core",
"tracing-log 0.2.0",
"tracing-log",
"tracing-subscriber",
"web-time 0.2.4",
"web-time",
]
[[package]]
@@ -13968,7 +13756,7 @@ dependencies = [
"thread_local",
"tracing",
"tracing-core",
"tracing-log 0.2.0",
"tracing-log",
"tracing-serde",
]
@@ -14636,16 +14424,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "web-time"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "web-time"
version = "1.1.0"
@@ -15148,16 +14926,6 @@ dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [
"cfg-if",
"windows-sys 0.48.0",
]
[[package]]
name = "wit-bindgen-rt"
version = "0.39.0"

View File

@@ -153,7 +153,7 @@ itertools = "0.14"
jsonb = { git = "https://github.com/databendlabs/jsonb.git", rev = "8c8d2fc294a39f3ff08909d60f718639cfba3875", default-features = false }
lazy_static = "1.4"
local-ip-address = "0.6"
loki-proto = { git = "https://github.com/GreptimeTeam/loki-proto.git", rev = "1434ecf23a2654025d86188fb5205e7a74b225d3" }
loki-proto = { git = "https://github.com/GreptimeTeam/loki-proto.git", rev = "3b7cd33234358b18ece977bf689dc6fb760f29ab" }
meter-core = { git = "https://github.com/GreptimeTeam/greptime-meter.git", rev = "5618e779cf2bb4755b499c630fba4c35e91898cb" }
mockall = "0.13"
moka = "0.12"
@@ -163,7 +163,7 @@ notify = "8.0"
num_cpus = "1.16"
object_store_opendal = { git = "https://github.com/apache/opendal", rev = "0ba8574b6d08d209056704d28a9a114beb3c1022" }
once_cell = "1.18"
opentelemetry-proto = { version = "0.27", features = [
opentelemetry-proto = { version = "0.30", features = [
"gen-tonic",
"metrics",
"trace",

View File

@@ -187,7 +187,7 @@
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
| `logging.otlp_endpoint` | String | `http://localhost:4318` | The OTLP tracing endpoint. |
| `logging.otlp_endpoint` | String | `http://localhost:4318/v1/traces` | The OTLP tracing endpoint. |
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
@@ -295,7 +295,7 @@
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
| `logging.otlp_endpoint` | String | `http://localhost:4318` | The OTLP tracing endpoint. |
| `logging.otlp_endpoint` | String | `http://localhost:4318/v1/traces` | The OTLP tracing endpoint. |
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
@@ -391,7 +391,7 @@
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
| `logging.otlp_endpoint` | String | `http://localhost:4318` | The OTLP tracing endpoint. |
| `logging.otlp_endpoint` | String | `http://localhost:4318/v1/traces` | The OTLP tracing endpoint. |
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
@@ -559,7 +559,7 @@
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
| `logging.otlp_endpoint` | String | `http://localhost:4318` | The OTLP tracing endpoint. |
| `logging.otlp_endpoint` | String | `http://localhost:4318/v1/traces` | The OTLP tracing endpoint. |
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
@@ -628,7 +628,7 @@
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
| `logging.otlp_endpoint` | String | `http://localhost:4318` | The OTLP tracing endpoint. |
| `logging.otlp_endpoint` | String | `http://localhost:4318/v1/traces` | The OTLP tracing endpoint. |
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |

View File

@@ -632,7 +632,7 @@ level = "info"
enable_otlp_tracing = false
## The OTLP tracing endpoint.
otlp_endpoint = "http://localhost:4318"
otlp_endpoint = "http://localhost:4318/v1/traces"
## Whether to append logs to stdout.
append_stdout = true

View File

@@ -120,7 +120,7 @@ level = "info"
enable_otlp_tracing = false
## The OTLP tracing endpoint.
otlp_endpoint = "http://localhost:4318"
otlp_endpoint = "http://localhost:4318/v1/traces"
## Whether to append logs to stdout.
append_stdout = true

View File

@@ -223,7 +223,7 @@ level = "info"
enable_otlp_tracing = false
## The OTLP tracing endpoint.
otlp_endpoint = "http://localhost:4318"
otlp_endpoint = "http://localhost:4318/v1/traces"
## Whether to append logs to stdout.
append_stdout = true

View File

@@ -269,7 +269,7 @@ level = "info"
enable_otlp_tracing = false
## The OTLP tracing endpoint.
otlp_endpoint = "http://localhost:4318"
otlp_endpoint = "http://localhost:4318/v1/traces"
## Whether to append logs to stdout.
append_stdout = true

View File

@@ -724,7 +724,7 @@ level = "info"
enable_otlp_tracing = false
## The OTLP tracing endpoint.
otlp_endpoint = "http://localhost:4318"
otlp_endpoint = "http://localhost:4318/v1/traces"
## Whether to append logs to stdout.
append_stdout = true

View File

@@ -21,12 +21,12 @@ greptime-proto.workspace = true
humantime-serde.workspace = true
lazy_static.workspace = true
once_cell.workspace = true
opentelemetry = { version = "0.21.0", default-features = false, features = [
opentelemetry = { version = "0.30.0", default-features = false, features = [
"trace",
] }
opentelemetry-otlp = { version = "0.14.0", features = ["tokio", "http-proto", "reqwest-client"] }
opentelemetry-semantic-conventions = "0.13.0"
opentelemetry_sdk = { version = "0.21.0", features = ["rt-tokio"] }
opentelemetry-otlp = { version = "0.30.0", features = ["trace", "grpc-tonic", "http-proto"] }
opentelemetry-semantic-conventions = { version = "0.30.0", features = ["semconv_experimental"] }
opentelemetry_sdk = { version = "0.30.0", features = ["rt-tokio", "trace"] }
parking_lot.workspace = true
prometheus.workspace = true
serde.workspace = true
@@ -34,6 +34,6 @@ serde_json.workspace = true
tokio.workspace = true
tracing = "0.1"
tracing-appender.workspace = true
tracing-log = "0.1"
tracing-opentelemetry = "0.22.0"
tracing-log = "0.2"
tracing-opentelemetry = "0.31.0"
tracing-subscriber.workspace = true

View File

@@ -20,8 +20,9 @@ use std::time::Duration;
use common_base::serde::empty_string_as_default;
use once_cell::sync::{Lazy, OnceCell};
use opentelemetry::trace::TracerProvider;
use opentelemetry::{global, KeyValue};
use opentelemetry_otlp::{Protocol, SpanExporterBuilder, WithExportConfig};
use opentelemetry_otlp::{Protocol, SpanExporter, WithExportConfig};
use opentelemetry_sdk::propagation::TraceContextPropagator;
use opentelemetry_sdk::trace::Sampler;
use opentelemetry_semantic_conventions::resource;
@@ -41,7 +42,7 @@ use crate::tracing_sampler::{create_sampler, TracingSampleOptions};
pub const DEFAULT_OTLP_GRPC_ENDPOINT: &str = "http://localhost:4317";
/// The default endpoint when use HTTP exporter protocol.
pub const DEFAULT_OTLP_HTTP_ENDPOINT: &str = "http://localhost:4318";
pub const DEFAULT_OTLP_HTTP_ENDPOINT: &str = "http://localhost:4318/v1/traces";
/// The default logs directory.
pub const DEFAULT_LOGGING_DIR: &str = "logs";
@@ -73,7 +74,7 @@ pub struct LoggingOptions {
/// Whether to enable tracing with OTLP. Default is false.
pub enable_otlp_tracing: bool,
/// The endpoint of OTLP. Default is "http://localhost:4318".
/// The endpoint of OTLP.
pub otlp_endpoint: Option<String>,
/// The tracing sample ratio.
@@ -404,24 +405,24 @@ pub fn init_global_logging(
.map(Sampler::ParentBased)
.unwrap_or(Sampler::ParentBased(Box::new(Sampler::AlwaysOn)));
let trace_config = opentelemetry_sdk::trace::config()
let provider = opentelemetry_sdk::trace::SdkTracerProvider::builder()
.with_batch_exporter(build_otlp_exporter(opts))
.with_sampler(sampler)
.with_resource(opentelemetry_sdk::Resource::new(vec![
KeyValue::new(resource::SERVICE_NAME, app_name.to_string()),
KeyValue::new(
resource::SERVICE_INSTANCE_ID,
node_id.unwrap_or("none".to_string()),
),
KeyValue::new(resource::SERVICE_VERSION, common_version::version()),
KeyValue::new(resource::PROCESS_PID, std::process::id().to_string()),
]));
let tracer = opentelemetry_otlp::new_pipeline()
.tracing()
.with_exporter(build_otlp_exporter(opts))
.with_trace_config(trace_config)
.install_batch(opentelemetry_sdk::runtime::Tokio)
.expect("otlp tracer install failed");
.with_resource(
opentelemetry_sdk::Resource::builder_empty()
.with_attributes([
KeyValue::new(resource::SERVICE_NAME, app_name.to_string()),
KeyValue::new(
resource::SERVICE_INSTANCE_ID,
node_id.unwrap_or("none".to_string()),
),
KeyValue::new(resource::SERVICE_VERSION, common_version::version()),
KeyValue::new(resource::PROCESS_PID, std::process::id().to_string()),
])
.build(),
)
.build();
let tracer = provider.tracer("greptimedb");
tracing::subscriber::set_global_default(
subscriber.with(tracing_opentelemetry::layer().with_tracer(tracer)),
@@ -436,7 +437,7 @@ pub fn init_global_logging(
guards
}
fn build_otlp_exporter(opts: &LoggingOptions) -> SpanExporterBuilder {
fn build_otlp_exporter(opts: &LoggingOptions) -> SpanExporter {
let protocol = opts
.otlp_export_protocol
.clone()
@@ -458,17 +459,18 @@ fn build_otlp_exporter(opts: &LoggingOptions) -> SpanExporterBuilder {
});
match protocol {
OtlpExportProtocol::Grpc => SpanExporterBuilder::Tonic(
opentelemetry_otlp::new_exporter()
.tonic()
.with_endpoint(endpoint),
),
OtlpExportProtocol::Http => SpanExporterBuilder::Http(
opentelemetry_otlp::new_exporter()
.http()
.with_endpoint(endpoint)
.with_protocol(Protocol::HttpBinary),
),
OtlpExportProtocol::Grpc => SpanExporter::builder()
.with_tonic()
.with_endpoint(endpoint)
.build()
.expect("Failed to create OTLP gRPC exporter "),
OtlpExportProtocol::Http => SpanExporter::builder()
.with_http()
.with_endpoint(endpoint)
.with_protocol(Protocol::HttpBinary)
.build()
.expect("Failed to create OTLP HTTP exporter "),
}
}