From 6d2cc563fd3cc64b6d0d5444590c8464eb18c0da Mon Sep 17 00:00:00 2001 From: Joonas Bergius Date: Tue, 23 Jul 2024 12:00:50 -0500 Subject: [PATCH] fix: Upgrade opentelemetry to 0.21 Signed-off-by: Joonas Bergius --- Cargo.lock | 119 +++++++++++++++------------------------------------- Cargo.toml | 10 +++-- src/main.rs | 11 ++--- 3 files changed, 46 insertions(+), 94 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3a2e284..2f02507 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -894,6 +894,12 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "h2" version = "0.3.26" @@ -1736,16 +1742,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "opentelemetry" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9591d937bc0e6d2feb6f71a559540ab300ea49955229c347a517a28d27784c54" -dependencies = [ - "opentelemetry_api", - "opentelemetry_sdk 0.20.0", -] - [[package]] name = "opentelemetry" version = "0.21.0" @@ -1764,17 +1760,17 @@ dependencies = [ [[package]] name = "opentelemetry-otlp" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e5e5a5c4135864099f3faafbe939eb4d7f9b80ebf68a8448da961b32a7c1275" +checksum = "f24cda83b20ed2433c68241f918d0f6fdec8b1d43b7a9590ab4420c5095ca930" dependencies = [ "async-trait", "futures-core", "http", + "opentelemetry", "opentelemetry-proto", "opentelemetry-semantic-conventions", - "opentelemetry_api", - "opentelemetry_sdk 0.20.0", + "opentelemetry_sdk", "prost", "thiserror", "tokio", @@ -1783,62 +1779,23 @@ dependencies = [ [[package]] name = "opentelemetry-proto" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e3f814aa9f8c905d0ee4bde026afd3b2577a97c10e1699912e3e44f0c4cbeb" +checksum = "a2e155ce5cc812ea3d1dffbd1539aed653de4bf4882d60e6e04dcf0901d674e1" dependencies = [ - "opentelemetry_api", - "opentelemetry_sdk 0.20.0", + "opentelemetry", + "opentelemetry_sdk", "prost", "tonic", ] [[package]] name = "opentelemetry-semantic-conventions" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73c9f9340ad135068800e7f1b24e9e09ed9e7143f5bf8518ded3d3ec69789269" -dependencies = [ - "opentelemetry 0.20.0", -] - -[[package]] -name = "opentelemetry_api" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a81f725323db1b1206ca3da8bb19874bbd3f57c3bcd59471bfb04525b265b9b" -dependencies = [ - "futures-channel", - "futures-util", - "indexmap 1.9.3", - "js-sys", - "once_cell", - "pin-project-lite", - "thiserror", - "urlencoding", -] - -[[package]] -name = "opentelemetry_sdk" -version = "0.20.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8e705a0612d48139799fcbaba0d4a90f06277153e43dd2bdc16c6f0edd8026" +checksum = "f5774f1ef1f982ef2a447f6ee04ec383981a3ab99c8e77a1a7b30182e65bbc84" dependencies = [ - "async-trait", - "crossbeam-channel", - "futures-channel", - "futures-executor", - "futures-util", - "once_cell", - "opentelemetry_api", - "ordered-float 3.9.2", - "percent-encoding", - "rand", - "regex", - "serde_json", - "thiserror", - "tokio", - "tokio-stream", + "opentelemetry", ] [[package]] @@ -1852,8 +1809,9 @@ dependencies = [ "futures-channel", "futures-executor", "futures-util", + "glob", "once_cell", - "opentelemetry 0.21.0", + "opentelemetry", "ordered-float 4.2.0", "percent-encoding", "rand", @@ -1872,15 +1830,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "ordered-float" -version = "3.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" -dependencies = [ - "num-traits", -] - [[package]] name = "ordered-float" version = "4.2.0" @@ -3122,17 +3071,14 @@ dependencies = [ ] [[package]] -name = "tracing-opentelemetry" -version = "0.20.0" +name = "tracing-log" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc09e402904a5261e42cf27aea09ccb7d5318c6717a9eec3d8e2e65c56b18f19" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ + "log", "once_cell", - "opentelemetry 0.20.0", - "tracing", "tracing-core", - "tracing-log", - "tracing-subscriber", ] [[package]] @@ -3143,10 +3089,12 @@ checksum = "c67ac25c5407e7b961fafc6f7e9aa5958fd297aada2d20fa2ae1737357e55596" 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-subscriber", "web-time", ] @@ -3178,7 +3126,7 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log", + "tracing-log 0.1.3", "tracing-serde", ] @@ -3577,13 +3525,13 @@ dependencies = [ "cloudevents-sdk", "futures", "oci-distribution", - "opentelemetry 0.21.0", - "opentelemetry_sdk 0.21.2", + "opentelemetry", + "opentelemetry_sdk", "serde", "serde_json", "tokio", "tracing", - "tracing-opentelemetry 0.22.0", + "tracing-opentelemetry", "wasmcloud-core", ] @@ -3631,8 +3579,9 @@ dependencies = [ "json-patch", "k8s-openapi", "kube", - "opentelemetry 0.20.0", + "opentelemetry", "opentelemetry-otlp", + "opentelemetry_sdk", "rcgen", "schemars", "secrecy", @@ -3644,7 +3593,7 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "tracing-opentelemetry 0.20.0", + "tracing-opentelemetry", "tracing-subscriber", "utoipa", "uuid", diff --git a/Cargo.toml b/Cargo.toml index 9fdb19d..5264255 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,6 +34,7 @@ json-patch = { workspace = true } k8s-openapi = { workspace = true, features = ["v1_28", "schemars"] } kube = { workspace = true, features = ["runtime", "derive", "default"] } opentelemetry = { workspace = true } +opentelemetry_sdk = { workspace = true } opentelemetry-otlp = { workspace = true } rcgen = { workspace = true } schemars = { workspace = true } @@ -71,12 +72,13 @@ handlebars = "5.1" json-patch = "1.4.0" k8s-openapi = { version = "0.20", default-features = false } kube = { version = "0.87", default-features = false } -opentelemetry = { version = "0.20", features = [ +opentelemetry = { version = "0.21", default-features = false } +opentelemetry_sdk = { version = "0.21", features = [ "metrics", "trace", "rt-tokio", -] } -opentelemetry-otlp = { version = "0.13", features = ["tokio"] } +]} +opentelemetry-otlp = { version = "0.14", features = ["tokio"] } rcgen = "0.11" schemars = "0.8" secrecy = "0.8" @@ -88,7 +90,7 @@ time = "0.3" tokio = { version = "1", features = ["full"] } tokio-util = { version = "0.7", features = ["rt"] } tracing = "0.1" -tracing-opentelemetry = "0.20" +tracing-opentelemetry = "0.22" tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] } utoipa = { version = "4.1", features = ["axum_extras"] } uuid = { version = "1", features = ["v5"] } diff --git a/src/main.rs b/src/main.rs index f58d6ba..c90de6c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,9 +13,10 @@ use kube::{ client::Client, CustomResourceExt, }; -use opentelemetry::sdk::{ - trace::{self, RandomIdGenerator, Sampler}, - Resource as OTELResource, +use opentelemetry::KeyValue; +use opentelemetry_sdk::{ + trace::{RandomIdGenerator, Sampler}, + Resource, }; use std::io::IsTerminal; use std::net::SocketAddr; @@ -80,12 +81,12 @@ fn configure_tracing(enabled: bool) -> anyhow::Result<()> { .tracing() .with_exporter(opentelemetry_otlp::new_exporter().tonic()) .with_trace_config( - trace::config() + opentelemetry_sdk::trace::config() .with_sampler(Sampler::AlwaysOn) .with_id_generator(RandomIdGenerator::default()) .with_max_attributes_per_span(32) .with_max_events_per_span(32) - .with_resource(OTELResource::new(vec![opentelemetry::KeyValue::new( + .with_resource(Resource::new(vec![KeyValue::new( "service.name", "wasmcloud-operator", )])),