From 28a6c745ab841bce6f1d88a01e7231f8e817729a Mon Sep 17 00:00:00 2001 From: Juliano Costa Date: Mon, 17 Jul 2023 15:39:47 +0200 Subject: [PATCH] [shippingservice] Update Rust deps and add TelemetryResourceDetector (#972) * Update Rust deps and add TelemetryResourceDetector * Changelog * Update min versions --------- Co-authored-by: Austin Parker --- CHANGELOG.md | 2 + src/shippingservice/Cargo.lock | 124 ++++++++++++++++++++++---------- src/shippingservice/Cargo.toml | 18 ++--- src/shippingservice/src/main.rs | 5 +- 4 files changed, 102 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fb98ba6d4..39a19a3d13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,8 @@ release. ([#872](https://github.com/open-telemetry/opentelemetry-demo/pull/872)) * [frontendproxy]Envoy expose a route for the collector to route frontend spans ([#938](https://github.com/open-telemetry/opentelemetry-demo/pull/938)) +* [shippingservice] Update Rust dependencies and add TelemetryResourceDetector + ([#972](https://github.com/open-telemetry/opentelemetry-demo/pull/972)) ## 1.4.0 diff --git a/src/shippingservice/Cargo.lock b/src/shippingservice/Cargo.lock index e1fbc19f71..8a35004102 100644 --- a/src/shippingservice/Cargo.lock +++ b/src/shippingservice/Cargo.lock @@ -647,33 +647,43 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69d6c3d7288a106c0a363e4b0e8d308058d56902adefb16f4936f417ffef086e" dependencies = [ - "opentelemetry_api", - "opentelemetry_sdk", + "opentelemetry_api 0.18.0", + "opentelemetry_sdk 0.18.0", +] + +[[package]] +name = "opentelemetry" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f4b8347cc26099d3aeee044065ecc3ae11469796b4d65d065a23a584ed92a6f" +dependencies = [ + "opentelemetry_api 0.19.0", + "opentelemetry_sdk 0.19.0", ] [[package]] name = "opentelemetry-http" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc79add46364183ece1a4542592ca593e6421c60807232f5b8f7a31703825d" +checksum = "a819b71d6530c4297b49b3cae2939ab3a8cc1b9f382826a1bc29dd0ca3864906" dependencies = [ "async-trait", "bytes", "http", - "opentelemetry_api", + "opentelemetry_api 0.19.0", ] [[package]] name = "opentelemetry-otlp" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1c928609d087790fc936a1067bdc310ae702bdf3b090c3f281b713622c8bbde" +checksum = "8af72d59a4484654ea8eb183fea5ae4eb6a41d7ac3e3bae5f4d2a282a3a7d3ca" dependencies = [ "async-trait", "futures", "futures-util", "http", - "opentelemetry", + "opentelemetry 0.19.0", "opentelemetry-proto", "prost", "thiserror", @@ -683,25 +693,24 @@ dependencies = [ [[package]] name = "opentelemetry-proto" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61a2f56df5574508dd86aaca016c917489e589ece4141df1b5e349af8d66c28" +checksum = "045f8eea8c0fa19f7d48e7bc3128a39c2e5c533d5c61298c548dfefc1064474c" dependencies = [ "futures", "futures-util", - "opentelemetry", + "opentelemetry 0.19.0", "prost", "tonic 0.8.2", - "tonic-build 0.8.2", ] [[package]] name = "opentelemetry-semantic-conventions" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b02e0230abb0ab6636d18e2ba8fa02903ea63772281340ccac18e0af3ec9eeb" +checksum = "24e33428e6bf08c6f7fcea4ddb8e358fab0fe48ab877a87c70c6ebe20f673ce5" dependencies = [ - "opentelemetry", + "opentelemetry 0.19.0", ] [[package]] @@ -720,6 +729,22 @@ dependencies = [ "thiserror", ] +[[package]] +name = "opentelemetry_api" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed41783a5bf567688eb38372f2b7a8530f5a607a4b49d38dd7573236c23ca7e2" +dependencies = [ + "fnv", + "futures-channel", + "futures-util", + "indexmap", + "once_cell", + "pin-project-lite", + "thiserror", + "urlencoding", +] + [[package]] name = "opentelemetry_sdk" version = "0.18.0" @@ -734,7 +759,27 @@ dependencies = [ "futures-executor", "futures-util", "once_cell", - "opentelemetry_api", + "opentelemetry_api 0.18.0", + "percent-encoding", + "rand", + "thiserror", +] + +[[package]] +name = "opentelemetry_sdk" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b3a2a91fdbfdd4d212c0dcc2ab540de2c2bcbbd90be17de7a7daf8822d010c1" +dependencies = [ + "async-trait", + "crossbeam-channel", + "dashmap", + "fnv", + "futures-channel", + "futures-executor", + "futures-util", + "once_cell", + "opentelemetry_api 0.19.0", "percent-encoding", "rand", "thiserror", @@ -1017,12 +1062,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b739d87a6b2cf4743968ad2b4cef648fbe0204c19999509824425babb2097bce" dependencies = [ "async-trait", - "opentelemetry", + "opentelemetry 0.18.0", "reqwest", "reqwest-middleware", "task-local-extensions", "tracing", - "tracing-opentelemetry", + "tracing-opentelemetry 0.18.0", ] [[package]] @@ -1086,11 +1131,11 @@ name = "shippingservice" version = "1.4.0" dependencies = [ "log", - "opentelemetry", + "opentelemetry 0.19.0", "opentelemetry-http", "opentelemetry-otlp", "opentelemetry-semantic-conventions", - "opentelemetry_api", + "opentelemetry_api 0.19.0", "prost", "prost-types", "reqwest", @@ -1099,10 +1144,10 @@ dependencies = [ "simplelog", "tokio", "tonic 0.9.2", - "tonic-build 0.9.2", + "tonic-build", "tonic-health", "tracing", - "tracing-opentelemetry", + "tracing-opentelemetry 0.19.0", "tracing-subscriber", "uuid", ] @@ -1399,19 +1444,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "tonic-build" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c6fd7c2581e36d63388a9e04c350c21beb7a8b059580b2e93993c526899ddc" -dependencies = [ - "prettyplease", - "proc-macro2", - "prost-build", - "quote", - "syn 1.0.103", -] - [[package]] name = "tonic-build" version = "0.9.2" @@ -1551,7 +1583,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21ebb87a95ea13271332df069020513ab70bdb5637ca42d6e492dc3bbbad48de" dependencies = [ "once_cell", - "opentelemetry", + "opentelemetry 0.18.0", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber", +] + +[[package]] +name = "tracing-opentelemetry" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00a39dcf9bfc1742fa4d6215253b33a6e474be78275884c216fc2a06267b3600" +dependencies = [ + "once_cell", + "opentelemetry 0.19.0", "tracing", "tracing-core", "tracing-log", @@ -1619,6 +1665,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "urlencoding" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" + [[package]] name = "uuid" version = "1.3.2" diff --git a/src/shippingservice/Cargo.toml b/src/shippingservice/Cargo.toml index 5dacbf3252..a778bca1c8 100644 --- a/src/shippingservice/Cargo.toml +++ b/src/shippingservice/Cargo.toml @@ -19,17 +19,17 @@ reqwest = { version = "0.11", default-features = false, features = ["json"] } prost = "0.11" prost-types = "0.11" tokio = { version = "1.28", features = ["macros", "rt-multi-thread"] } -opentelemetry = { version = "0.18", features = ["rt-tokio", "trace"] } -opentelemetry-semantic-conventions = "0.10.0" -opentelemetry_api = { version = "0.18" } -opentelemetry-http = "0.7.0" -opentelemetry-otlp = "0.11.0" -log = "0.4.17" +opentelemetry = { version = "0.19", features = ["rt-tokio", "trace"] } +opentelemetry-semantic-conventions = "0.11.0" +opentelemetry_api = { version = "0.19" } +opentelemetry-http = "0.8.0" +opentelemetry-otlp = "0.12.0" +log = "0.4.19" simplelog = "0.12" -reqwest-middleware = "0.2.0" -reqwest-tracing = { version = "0.4.0", features = ["opentelemetry_0_18"] } +reqwest-middleware = "0.2.2" +reqwest-tracing = { version = "0.4.5", features = ["opentelemetry_0_18"] } tracing = { version = "0.1", features = ["max_level_debug", "release_max_level_info"] } -tracing-opentelemetry = "0.18.0" +tracing-opentelemetry = "0.19.0" tracing-subscriber = "0.3" [dependencies.uuid] diff --git a/src/shippingservice/src/main.rs b/src/shippingservice/src/main.rs index c94606272e..019e7dd854 100644 --- a/src/shippingservice/src/main.rs +++ b/src/shippingservice/src/main.rs @@ -8,7 +8,7 @@ use opentelemetry::{ propagation::TraceContextPropagator, resource::{ OsResourceDetector, ProcessResourceDetector, ResourceDetector, - EnvResourceDetector, + EnvResourceDetector, TelemetryResourceDetector, SdkProvidedResourceDetector, }, trace as sdktrace, @@ -46,6 +46,7 @@ fn init_tracer() -> Result { let process_resource = ProcessResourceDetector.detect(Duration::from_secs(0)); let sdk_resource = SdkProvidedResourceDetector.detect(Duration::from_secs(0)); let env_resource = EnvResourceDetector::new().detect(Duration::from_secs(0)); + let telemetry_resource = TelemetryResourceDetector.detect(Duration::from_secs(0)); opentelemetry_otlp::new_pipeline() .tracing() .with_exporter( @@ -61,7 +62,7 @@ fn init_tracer() -> Result { ) .with_trace_config( sdktrace::config() - .with_resource(os_resource.merge(&process_resource).merge(&sdk_resource).merge(&env_resource)), + .with_resource(os_resource.merge(&process_resource).merge(&sdk_resource).merge(&env_resource).merge(&telemetry_resource)), ) .install_batch(opentelemetry::runtime::Tokio) }