diff --git a/CHANGELOG.md b/CHANGELOG.md index 906eb6ee96..f412738d90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,6 @@ the release. ## Unreleased -* [loadgenerator] emit logs via OTLP - ([#1446](https://github.com/open-telemetry/opentelemetry-demo/pull/1446)) -* [frontend] reset quantity when new product selected - ([#1447](https://github.com/open-telemetry/opentelemetry-demo/pull/1447)) * [featureflag] deprecate in favor of flagd ([#1338](https://github.com/open-telemetry/opentelemetry-demo/pull/1388)) * [checkoutservice] add producer interceptor for tracing @@ -31,10 +27,14 @@ the release. ([#1415](https://github.com/open-telemetry/opentelemetry-demo/pull/1415)) * [chore] - add tests and odd profiles to make stop ([#1427](https://github.com/open-telemetry/opentelemetry-demo/pull/1427)) -* [shippingservice] fix context propagation and add OTLP logs +* [shippingservice] fix context propagation ([#1433](https://github.com/open-telemetry/opentelemetry-demo/pull/1433)) * [chore] - Update Telemetry Components ([#1440](https://github.com/open-telemetry/opentelemetry-demo/pull/1440)) +* [loadgenerator] emit logs via OTLP + ([#1446](https://github.com/open-telemetry/opentelemetry-demo/pull/1446)) +* [frontend] reset quantity when new product selected + ([#1447](https://github.com/open-telemetry/opentelemetry-demo/pull/1447)) * [paymentservice] add paymentServiceFailure feature flag ([#1449](https://github.com/open-telemetry/opentelemetry-demo/pull/1449)) * [checkoutservice] add paymentServiceUnreachable feature flag diff --git a/docker-compose.minimal.yml b/docker-compose.minimal.yml index 15a7c32b18..fb53948ecc 100644 --- a/docker-compose.minimal.yml +++ b/docker-compose.minimal.yml @@ -440,7 +440,7 @@ services: environment: - SHIPPING_SERVICE_PORT - QUOTE_SERVICE_ADDR - - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}/v1/traces + - OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC} - OTEL_RESOURCE_ATTRIBUTES - OTEL_SERVICE_NAME=shippingservice depends_on: diff --git a/src/shippingservice/Cargo.lock b/src/shippingservice/Cargo.lock index 64dd268293..e52a0b4c74 100644 --- a/src/shippingservice/Cargo.lock +++ b/src/shippingservice/Cargo.lock @@ -51,7 +51,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -62,7 +62,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -204,6 +204,15 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + [[package]] name = "either" version = "1.10.0" @@ -296,7 +305,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -509,15 +518,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.11.0" @@ -630,6 +630,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-traits" version = "0.2.18" @@ -649,6 +655,15 @@ dependencies = [ "libc", ] +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + [[package]] name = "object" version = "0.32.2" @@ -666,13 +681,12 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opentelemetry" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a" +checksum = "900d57987be3f2aeb70d385fff9b27fb74c5723cc9a52d904d4f9c807a0667bf" dependencies = [ "futures-core", "futures-sink", - "indexmap 2.2.5", "js-sys", "once_cell", "pin-project-lite", @@ -680,25 +694,11 @@ dependencies = [ "urlencoding", ] -[[package]] -name = "opentelemetry-appender-tracing" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12c4bd073648dae8ac45cfc81588d74b3dc5f334119ac08567ddcbfe16f2d809" -dependencies = [ - "once_cell", - "opentelemetry", - "opentelemetry_sdk", - "tracing", - "tracing-core", - "tracing-subscriber", -] - [[package]] name = "opentelemetry-http" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f51189ce8be654f9b5f7e70e49967ed894e84a06fc35c6c042e64ac1fc5399e" +checksum = "7cbfa5308166ca861434f0b0913569579b8e587430a3d6bcd7fd671921ec145a" dependencies = [ "async-trait", "bytes", @@ -708,9 +708,9 @@ dependencies = [ [[package]] name = "opentelemetry-otlp" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f24cda83b20ed2433c68241f918d0f6fdec8b1d43b7a9590ab4420c5095ca930" +checksum = "1a016b8d9495c639af2145ac22387dcb88e44118e45320d9238fbf4e7889abcb" dependencies = [ "async-trait", "futures-core", @@ -719,38 +719,35 @@ dependencies = [ "opentelemetry-proto", "opentelemetry-semantic-conventions", "opentelemetry_sdk", - "prost 0.11.9", + "prost", "thiserror", "tokio", - "tonic 0.9.2", + "tonic", ] [[package]] name = "opentelemetry-proto" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2e155ce5cc812ea3d1dffbd1539aed653de4bf4882d60e6e04dcf0901d674e1" +checksum = "3a8fddc9b68f5b80dae9d6f510b88e02396f006ad48cac349411fbecc80caae4" dependencies = [ "opentelemetry", "opentelemetry_sdk", - "prost 0.11.9", - "tonic 0.9.2", + "prost", + "tonic", ] [[package]] name = "opentelemetry-semantic-conventions" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5774f1ef1f982ef2a447f6ee04ec383981a3ab99c8e77a1a7b30182e65bbc84" -dependencies = [ - "opentelemetry", -] +checksum = "f9ab5bd6c42fb9349dcf28af2ba9a0667f697f9bdcca045d39f2cec5543e2910" [[package]] name = "opentelemetry_sdk" -version = "0.21.2" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f16aec8a98a457a52664d69e0091bac3a0abd18ead9b641cb00202ba4e0efe4" +checksum = "9e90c7113be649e31e9a0f8b5ee24ed7a16923b322c3c5ab6367469c049d6b7e" dependencies = [ "async-trait", "crossbeam-channel", @@ -763,7 +760,6 @@ dependencies = [ "ordered-float", "percent-encoding", "rand", - "serde_json", "thiserror", "tokio", "tokio-stream", @@ -817,7 +813,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -832,6 +828,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -845,7 +847,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.52", + "syn", ] [[package]] @@ -857,16 +859,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "prost" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" -dependencies = [ - "bytes", - "prost-derive 0.11.9", -] - [[package]] name = "prost" version = "0.12.3" @@ -874,7 +866,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ "bytes", - "prost-derive 0.12.3", + "prost-derive", ] [[package]] @@ -885,33 +877,20 @@ checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" dependencies = [ "bytes", "heck", - "itertools 0.11.0", + "itertools", "log", "multimap", "once_cell", "petgraph", "prettyplease", - "prost 0.12.3", + "prost", "prost-types", "regex", - "syn 2.0.52", + "syn", "tempfile", "which", ] -[[package]] -name = "prost-derive" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" -dependencies = [ - "anyhow", - "itertools 0.10.5", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "prost-derive" version = "0.12.3" @@ -919,10 +898,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ "anyhow", - "itertools 0.11.0", + "itertools", "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -931,7 +910,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" dependencies = [ - "prost 0.12.3", + "prost", ] [[package]] @@ -1041,9 +1020,9 @@ dependencies = [ [[package]] name = "reqwest-middleware" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a3e86aa6053e59030e7ce2d2a3b258dd08fc2d337d52f73f6cb480f5858690" +checksum = "5a735987236a8e238bf0296c7e351b999c188ccc11477f311b82b55c93984216" dependencies = [ "anyhow", "async-trait", @@ -1056,9 +1035,9 @@ dependencies = [ [[package]] name = "reqwest-tracing" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0152176687dd5cfe7f507ac1cb1a491c679cfe483afd133a7db7aaea818bb3" +checksum = "190838e54153d7a7e2ea98851304b3ce92daeabf14c54d32b01b84a3e636f683" dependencies = [ "anyhow", "async-trait", @@ -1120,7 +1099,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1161,18 +1140,18 @@ version = "1.8.0" dependencies = [ "log", "opentelemetry", - "opentelemetry-appender-tracing", "opentelemetry-http", "opentelemetry-otlp", "opentelemetry-semantic-conventions", "opentelemetry_sdk", - "prost 0.12.3", + "prost", "prost-types", "reqwest", "reqwest-middleware", "reqwest-tracing", + "simplelog", "tokio", - "tonic 0.11.0", + "tonic", "tonic-build", "tonic-health", "tracing", @@ -1181,6 +1160,17 @@ dependencies = [ "uuid", ] +[[package]] +name = "simplelog" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16257adbfaef1ee58b1363bdc0664c9b8e1e30aed86049635fb5f147d065a9c0" +dependencies = [ + "log", + "termcolor", + "time", +] + [[package]] name = "slab" version = "0.4.9" @@ -1206,17 +1196,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.52" @@ -1276,6 +1255,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.57" @@ -1293,7 +1281,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1306,6 +1294,39 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +dependencies = [ + "deranged", + "itoa", + "libc", + "num-conv", + "num_threads", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -1356,7 +1377,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1384,34 +1405,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "tonic" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" -dependencies = [ - "async-trait", - "axum", - "base64", - "bytes", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-timeout", - "percent-encoding", - "pin-project", - "prost 0.11.9", - "tokio", - "tokio-stream", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "tonic" version = "0.11.0" @@ -1430,7 +1423,7 @@ dependencies = [ "hyper-timeout", "percent-encoding", "pin-project", - "prost 0.12.3", + "prost", "tokio", "tokio-stream", "tower", @@ -1441,15 +1434,15 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" +checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" dependencies = [ "prettyplease", "proc-macro2", "prost-build", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1459,10 +1452,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cef6e24bc96871001a7e48e820ab240b3de2201e59b517cf52835df2f1d2350" dependencies = [ "async-stream", - "prost 0.12.3", + "prost", "tokio", "tokio-stream", - "tonic 0.11.0", + "tonic", ] [[package]] @@ -1516,7 +1509,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1542,9 +1535,9 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c67ac25c5407e7b961fafc6f7e9aa5958fd297aada2d20fa2ae1737357e55596" +checksum = "a9be14ba1bbe4ab79e9229f7f89fab8d120b865859f10527f31c033e599d2284" dependencies = [ "js-sys", "once_cell", @@ -1627,9 +1620,9 @@ checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom", "rand", @@ -1638,13 +1631,13 @@ dependencies = [ [[package]] name = "uuid-macro-internal" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abb14ae1a50dad63eaa768a458ef43d298cd1bd44951677bd10b732a9ba2a2d" +checksum = "9881bea7cbe687e36c9ab3b778c36cd0487402e270304e8b1296d5085303c1a2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1695,7 +1688,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn", "wasm-bindgen-shared", ] @@ -1729,7 +1722,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1752,9 +1745,9 @@ dependencies = [ [[package]] name = "web-time" -version = "0.2.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -1788,6 +1781,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/src/shippingservice/Cargo.toml b/src/shippingservice/Cargo.toml index 26e091c0c6..d24ad1dd06 100644 --- a/src/shippingservice/Cargo.toml +++ b/src/shippingservice/Cargo.toml @@ -19,21 +19,21 @@ reqwest = { version = "0.11", default-features = false, features = ["json"] } prost = "0.12" prost-types = "0.12" tokio = { version = "1.36", features = ["macros", "rt-multi-thread"] } -opentelemetry = { version = "0.21", features = ["trace", "metrics", "logs"] } -opentelemetry-appender-tracing = "0.2.0" -opentelemetry_sdk = { version = "0.21", features = ["rt-tokio", "metrics", "logs_level_enabled"]} -opentelemetry-semantic-conventions = "0.13.0" -opentelemetry-http = "0.10.0" -opentelemetry-otlp = { version = "0.14.0", features = ["tonic", "metrics", "logs"] } -log = "0.4.20" -reqwest-middleware = "0.2.4" -reqwest-tracing = { version = "0.4.7", features = ["opentelemetry_0_21"] } +opentelemetry = { version = "0.22", features = ["trace"] } +opentelemetry_sdk = { version = "0.22", features = ["rt-tokio"]} +opentelemetry-semantic-conventions = "0.14.0" +opentelemetry-http = "0.11.0" +opentelemetry-otlp = { version = "0.15.0", features = ["tonic"] } +log = "0.4.21" +simplelog = "0.12" +reqwest-middleware = "0.2.5" +reqwest-tracing = { version = "0.4.8", features = ["opentelemetry_0_22"] } tracing = { version = "0.1", features = ["max_level_debug", "release_max_level_info"] } -tracing-opentelemetry = "0.22.0" +tracing-opentelemetry = "0.23.0" tracing-subscriber = "0.3" [dependencies.uuid] -version = "1.7.0" +version = "1.8.0" features = [ "v4", # Lets you generate random UUIDs "fast-rng", # Use a faster (but still sufficiently random) RNG @@ -41,4 +41,4 @@ features = [ ] [build-dependencies] -tonic-build = "0.10" +tonic-build = "0.11" diff --git a/src/shippingservice/src/main.rs b/src/shippingservice/src/main.rs index 4dfe5e6bb0..37a4121088 100644 --- a/src/shippingservice/src/main.rs +++ b/src/shippingservice/src/main.rs @@ -12,10 +12,9 @@ use shipping_service::shop::shipping_service_server::ShippingServiceServer; use shipping_service::ShippingServer; mod telemetry; -use telemetry::configure_global_logger; use telemetry::init_logger; -use telemetry::init_metrics; +use telemetry::init_reqwest_tracing; use telemetry::init_tracer; #[tokio::main] @@ -25,11 +24,8 @@ async fn main() -> Result<(), Box> { .set_serving::>() .await; - let tracer = init_tracer()?; - let _ = init_metrics()?; - - let _ = init_logger(); - configure_global_logger(tracer); + init_logger()?; + init_reqwest_tracing(init_tracer()?)?; info!("OTel pipeline created"); let port = env::var("SHIPPING_SERVICE_PORT").expect("$SHIPPING_SERVICE_PORT is not set"); diff --git a/src/shippingservice/src/shipping_service.rs b/src/shippingservice/src/shipping_service.rs index 2a1d7ae33f..20f6479e37 100644 --- a/src/shippingservice/src/shipping_service.rs +++ b/src/shippingservice/src/shipping_service.rs @@ -3,7 +3,7 @@ use opentelemetry::trace::{FutureExt, SpanKind, TraceContextExt, Tracer}; use opentelemetry::{global, propagation::Extractor, trace::Span, Context, KeyValue}; -use opentelemetry_semantic_conventions as semcov; +use opentelemetry_semantic_conventions as semconv; use shop::shipping_service_server::ShippingService; use shop::{GetQuoteRequest, GetQuoteResponse, Money, ShipOrderRequest, ShipOrderResponse}; use tonic::{Request, Response, Status}; @@ -74,7 +74,7 @@ impl ShippingService for ShippingServer { .span_builder("oteldemo.ShippingService/GetQuote") .with_kind(SpanKind::Server) .start_with_context(&tracer, &parent_cx); - span.set_attribute(semcov::trace::RPC_SYSTEM.string(RPC_SYSTEM_GRPC)); + span.set_attribute(KeyValue::new(semconv::trace::RPC_SYSTEM, RPC_SYSTEM_GRPC)); span.add_event("Processing get quote request".to_string(), vec![]); span.set_attribute(KeyValue::new( @@ -89,9 +89,10 @@ impl ShippingService for ShippingServer { { Ok(quote) => quote, Err(status) => { - cx.span().set_attribute( - semcov::trace::RPC_GRPC_STATUS_CODE.i64(RPC_GRPC_STATUS_CODE_UNKNOWN), - ); + cx.span().set_attribute(KeyValue::new( + semconv::trace::RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE_UNKNOWN, + )); return Err(status); } }; @@ -105,8 +106,10 @@ impl ShippingService for ShippingServer { }; info!("Sending Quote: {}", q); - cx.span() - .set_attribute(semcov::trace::RPC_GRPC_STATUS_CODE.i64(RPC_GRPC_STATUS_CODE_OK)); + cx.span().set_attribute(KeyValue::new( + semconv::trace::RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE_OK, + )); Ok(Response::new(reply)) } async fn ship_order( @@ -124,7 +127,7 @@ impl ShippingService for ShippingServer { .span_builder("oteldemo.ShippingService/ShipOrder") .with_kind(SpanKind::Server) .start_with_context(&tracer, &parent_cx); - span.set_attribute(semcov::trace::RPC_SYSTEM.string(RPC_SYSTEM_GRPC)); + span.set_attribute(KeyValue::new(semconv::trace::RPC_SYSTEM, RPC_SYSTEM_GRPC)); span.add_event("Processing shipping order request".to_string(), vec![]); @@ -137,7 +140,10 @@ impl ShippingService for ShippingServer { vec![], ); - span.set_attribute(semcov::trace::RPC_GRPC_STATUS_CODE.i64(RPC_GRPC_STATUS_CODE_OK)); + span.set_attribute(KeyValue::new( + semconv::trace::RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE_OK, + )); Ok(Response::new(ShipOrderResponse { tracking_id: tid })) } } diff --git a/src/shippingservice/src/telemetry.rs b/src/shippingservice/src/telemetry.rs index a2255252c8..ed3f66806c 100644 --- a/src/shippingservice/src/telemetry.rs +++ b/src/shippingservice/src/telemetry.rs @@ -5,11 +5,8 @@ mod resources_conf; pub use resources_conf::get_resource_attr; mod traces_conf; +pub use traces_conf::init_reqwest_tracing; pub use traces_conf::init_tracer; mod logs_conf; -pub use logs_conf::configure_global_logger; pub use logs_conf::init_logger; - -mod metrics_conf; -pub use metrics_conf::init_metrics; diff --git a/src/shippingservice/src/telemetry/logs_conf.rs b/src/shippingservice/src/telemetry/logs_conf.rs index ccd7d5017a..354bfdaf3f 100644 --- a/src/shippingservice/src/telemetry/logs_conf.rs +++ b/src/shippingservice/src/telemetry/logs_conf.rs @@ -1,29 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -use opentelemetry_appender_tracing::layer::OpenTelemetryTracingBridge; -use opentelemetry_sdk::{logs::Config, runtime}; - -use tracing_subscriber::prelude::*; - -use opentelemetry_sdk::logs as sdklogs; - -use super::get_resource_attr; - -pub fn init_logger() -> Result { - opentelemetry_otlp::new_pipeline() - .logging() - .with_log_config(Config::default().with_resource(get_resource_attr())) - .with_exporter(opentelemetry_otlp::new_exporter().tonic()) - .install_batch(runtime::Tokio) -} - -pub fn configure_global_logger(tracer: opentelemetry_sdk::trace::Tracer) { - let telemetry = tracing_opentelemetry::layer().with_tracer(tracer); - let logger_provider = opentelemetry::global::logger_provider(); - let layer = OpenTelemetryTracingBridge::new(&logger_provider); - let _ = tracing_subscriber::registry() - .with(layer) - .with(telemetry) - .init(); +use simplelog::*; + +pub fn init_logger() -> Result<(), log::SetLoggerError> { + CombinedLogger::init(vec![ + SimpleLogger::new(LevelFilter::Info, Config::default()), + SimpleLogger::new(LevelFilter::Warn, Config::default()), + SimpleLogger::new(LevelFilter::Error, Config::default()), + ]) } diff --git a/src/shippingservice/src/telemetry/metrics_conf.rs b/src/shippingservice/src/telemetry/metrics_conf.rs deleted file mode 100644 index d6efc7b225..0000000000 --- a/src/shippingservice/src/telemetry/metrics_conf.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -use opentelemetry::metrics::MetricsError; -use opentelemetry_sdk::{metrics::MeterProvider, runtime}; - -use super::get_resource_attr; - -pub fn init_metrics() -> Result { - opentelemetry_otlp::new_pipeline() - .metrics(runtime::Tokio) - .with_exporter(opentelemetry_otlp::new_exporter().tonic()) - .with_resource(get_resource_attr()) - .build() -} diff --git a/src/shippingservice/src/telemetry/traces_conf.rs b/src/shippingservice/src/telemetry/traces_conf.rs index 626a128d4f..42bb469328 100644 --- a/src/shippingservice/src/telemetry/traces_conf.rs +++ b/src/shippingservice/src/telemetry/traces_conf.rs @@ -4,6 +4,7 @@ use opentelemetry::{global, trace::TraceError}; use opentelemetry_otlp; use opentelemetry_sdk::{propagation::TraceContextPropagator, runtime, trace as sdktrace}; +use tracing_subscriber::{layer::SubscriberExt, Registry}; use super::get_resource_attr; @@ -16,3 +17,11 @@ pub fn init_tracer() -> Result { .with_trace_config(sdktrace::config().with_resource(get_resource_attr())) .install_batch(runtime::Tokio) } + +pub fn init_reqwest_tracing( + tracer: sdktrace::Tracer, +) -> Result<(), tracing::subscriber::SetGlobalDefaultError> { + let telemetry = tracing_opentelemetry::layer().with_tracer(tracer); + let subscriber = Registry::default().with(telemetry); + tracing::subscriber::set_global_default(subscriber) +}