diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe313dd2..c4656e1f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,13 +54,13 @@ jobs: include: - os: macos-11 dist-args: --artifacts=local --target=aarch64-apple-darwin --target=x86_64-apple-darwin - install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.2.0/cargo-dist-installer.sh | sh + install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.4.2/cargo-dist-installer.sh | sh - os: ubuntu-22.04 dist-args: --artifacts=local --target=x86_64-unknown-linux-gnu - install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.2.0/cargo-dist-installer.sh | sh + install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.4.2/cargo-dist-installer.sh | sh - os: windows-2019 dist-args: --artifacts=local --target=x86_64-pc-windows-msvc - install-dist: irm https://github.com/axodotdev/cargo-dist/releases/download/v0.2.0/cargo-dist-installer.ps1 | iex + install-dist: irm https://github.com/axodotdev/cargo-dist/releases/download/v0.4.2/cargo-dist-installer.ps1 | iex runs-on: ${{ matrix.os }} env: diff --git a/.github/workflows/release_manual_trigger.yaml b/.github/workflows/release_manual_trigger.yaml index 33c96041..3dbe29ea 100644 --- a/.github/workflows/release_manual_trigger.yaml +++ b/.github/workflows/release_manual_trigger.yaml @@ -56,13 +56,13 @@ jobs: include: - os: macos-11 dist-args: --artifacts=local --target=aarch64-apple-darwin --target=x86_64-apple-darwin - install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.2.0/cargo-dist-installer.sh | sh + install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.4.2/cargo-dist-installer.sh | sh - os: ubuntu-22.04 dist-args: --artifacts=local --target=x86_64-unknown-linux-gnu - install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.2.0/cargo-dist-installer.sh | sh + install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.4.2/cargo-dist-installer.sh | sh - os: windows-2019 dist-args: --artifacts=local --target=x86_64-pc-windows-msvc - install-dist: irm https://github.com/axodotdev/cargo-dist/releases/download/v0.2.0/cargo-dist-installer.ps1 | iex + install-dist: irm https://github.com/axodotdev/cargo-dist/releases/download/v0.4.2/cargo-dist-installer.ps1 | iex runs-on: ${{ matrix.os }} env: diff --git a/Cargo.lock b/Cargo.lock index 3ac2490d..ad7c3982 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -159,7 +159,7 @@ dependencies = [ "futures-core", "futures-util", "mio", - "socket2 0.5.4", + "socket2 0.5.5", "tokio", "tracing", ] @@ -243,7 +243,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "smallvec", - "socket2 0.5.4", + "socket2 0.5.5", "time", "url", ] @@ -569,9 +569,9 @@ checksum = "8d18b093eba54c9aaa1e3784d4361eb2ba944cf7d0a932a830132238f483e8d8" [[package]] name = "clap" -version = "4.4.7" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" +checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" dependencies = [ "clap_builder", "clap_derive", @@ -588,9 +588,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.7" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" +checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" dependencies = [ "anstream", "anstyle", @@ -935,9 +935,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" dependencies = [ "humantime", "is-terminal", @@ -1137,6 +1137,12 @@ dependencies = [ "url", ] +[[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.21" @@ -1392,7 +1398,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a621162e5c4229abff44d46655dcb777f6064daa851e046df17baf74c9ddf079" dependencies = [ - "itertools", + "itertools 0.11.0", ] [[package]] @@ -1404,6 +1410,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -1563,9 +1578,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "log", @@ -1696,22 +1711,28 @@ dependencies = [ [[package]] name = "opentelemetry" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9591d937bc0e6d2feb6f71a559540ab300ea49955229c347a517a28d27784c54" +checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a" dependencies = [ - "opentelemetry_api", - "opentelemetry_sdk", + "futures-core", + "futures-sink", + "indexmap 2.0.2", + "js-sys", + "once_cell", + "pin-project-lite", + "thiserror", + "urlencoding", ] [[package]] name = "opentelemetry-prometheus" -version = "0.13.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d81bc254e2d572120363a2b16cdb0d715d301b5789be0cfc26ad87e4e10e53" +checksum = "6f8f082da115b0dcb250829e3ed0b8792b8f963a1ad42466e48422fbe6a079bd" dependencies = [ "once_cell", - "opentelemetry_api", + "opentelemetry", "opentelemetry_sdk", "prometheus", "protobuf", @@ -1719,58 +1740,40 @@ dependencies = [ [[package]] name = "opentelemetry-semantic-conventions" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73c9f9340ad135068800e7f1b24e9e09ed9e7143f5bf8518ded3d3ec69789269" +checksum = "f5774f1ef1f982ef2a447f6ee04ec383981a3ab99c8e77a1a7b30182e65bbc84" dependencies = [ "opentelemetry", ] -[[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.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8e705a0612d48139799fcbaba0d4a90f06277153e43dd2bdc16c6f0edd8026" +checksum = "968ba3f2ca03e90e5187f5e4f46c791ef7f2c163ae87789c8ce5f5ca3b7b7de5" dependencies = [ "async-trait", "crossbeam-channel", "futures-channel", "futures-executor", "futures-util", + "glob", "once_cell", - "opentelemetry_api", + "opentelemetry", "ordered-float", "percent-encoding", "rand", - "regex", "serde", "serde_json", "thiserror", - "tokio", - "tokio-stream", ] [[package]] name = "ordered-float" -version = "3.9.1" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a54938017eacd63036332b4ae5c8a49fc8c0c1d6d629893057e4f13609edd06" +checksum = "536900a8093134cf9ccf00a27deb3532421099e958d9dd431135d0c7543ca1e8" dependencies = [ "num-traits", ] @@ -2283,9 +2286,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ "base64", ] @@ -2371,18 +2374,18 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.190" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.190" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", @@ -2543,9 +2546,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -2785,9 +2788,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -2797,7 +2800,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.4", + "socket2 0.5.5", "tokio-macros", "tracing", "windows-sys 0.48.0", @@ -2805,9 +2808,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", @@ -2834,17 +2837,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.9" @@ -2900,12 +2892,12 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] @@ -2921,9 +2913,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", "nu-ansi-term", @@ -3073,7 +3065,7 @@ dependencies = [ "futures", "futures-core", "iter_tools", - "itertools", + "itertools 0.12.0", "lazy_static", "maplit", "num_cpus", @@ -3179,9 +3171,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "utoipa" -version = "4.0.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b208a50ff438dcdc887ea3f2db59530bd2f4bc3d2c70630e4d7ee7a281a1d1b" +checksum = "0ff05e3bac2c9428f57ade702667753ca3f5cf085e2011fe697de5bfd49aa72d" dependencies = [ "indexmap 2.0.2", "serde", @@ -3191,9 +3183,9 @@ dependencies = [ [[package]] name = "utoipa-gen" -version = "4.0.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bd516d8879043e081537690bc96c8f17b5a4602c336aecb8f1de89d9d9c7e72" +checksum = "5f0b6f4667edd64be0e820d6631a60433a269710b6ee89ac39525b872b76d61d" dependencies = [ "proc-macro-error", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 842ff18a..9f4a42de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,9 +5,9 @@ resolver = "2" # Config for 'cargo dist' [workspace.metadata.dist] # The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax) -cargo-dist-version = "0.2.0" +cargo-dist-version = "0.4.2" # The preferred Rust toolchain to use in CI (rustup toolchain syntax) -rust-toolchain-version = "1.72.0" +rust-toolchain-version = "1.73.0" # CI backends to support (see 'cargo dist generate-ci') ci = ["github"] # Target platforms to build apps for (Rust target-triple syntax) diff --git a/server/Cargo.toml b/server/Cargo.toml index cc383255..52c6f193 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -26,27 +26,25 @@ anyhow = "1.0.75" async-trait = "0.1.74" chrono = { version = "0.4.31", features = ["serde"] } cidr = "0.2.2" -clap = { version = "4.4.7", features = ["derive", "env"] } +clap = { version = "4.4.8", features = ["derive", "env"] } clap-markdown = "0.1.3" dashmap = "5.5.3" futures = "0.3.29" futures-core = "0.3.29" iter_tools = "0.4.0" -itertools = "0.11.0" +itertools = "0.12.0" lazy_static = "1.4.0" num_cpus = "1.16.0" -opentelemetry = { version = "0.20.0", features = [ +opentelemetry = { version = "0.21.0", features = [ "trace", - "rt-tokio", "metrics", ] } -opentelemetry-prometheus = "0.13.0" -opentelemetry-semantic-conventions = "0.12.0" -opentelemetry_sdk = { version = "0.20.0", features = [ +opentelemetry-prometheus = "0.14.1" +opentelemetry-semantic-conventions = "0.13.0" +opentelemetry_sdk = { version = "0.21.1", features = [ "metrics", "serde", "serde_json", - "rt-tokio-current-thread", "logs", ] } prometheus = { version = "0.13.3", features = ["process"] } @@ -59,29 +57,29 @@ reqwest = { version = "0.11.22", default-features = false, features = [ "native-tls", ] } rustls = "0.21.8" -rustls-pemfile = "1.0.3" -serde = { version = "1.0.190", features = ["derive"] } +rustls-pemfile = "1.0.4" +serde = { version = "1.0.192", features = ["derive"] } serde_json = "1.0.108" serde_qs = { version = "0.12.0", features = ["actix4", "tracing"] } shadow-rs = "0.24.1" -tokio = { version = "1.33.0", features = [ +tokio = { version = "1.34.0", features = [ "macros", "rt-multi-thread", "tracing", "fs", ] } tracing = { version = "0.1.40", features = ["log"] } -tracing-subscriber = { version = "0.3.17", features = ["json", "env-filter"] } +tracing-subscriber = { version = "0.3.18", features = ["json", "env-filter"] } ulid = "1.1.0" unleash-types = { version = "0.10", features = ["openapi", "hashes"] } unleash-yggdrasil = { version = "0.8.0" } -utoipa = { version = "4", features = ["actix_extras", "chrono"] } +utoipa = { version = "4.1.0", features = ["actix_extras", "chrono"] } utoipa-swagger-ui = { version = "4", features = ["actix-web"] } [dev-dependencies] actix-http = "3.4.0" actix-http-test = "3.1.0" actix-service = "2.0.2" -env_logger = "0.10.0" +env_logger = "0.10.1" maplit = "1.0.2" rand = "0.8.5" test-case = "3.2.1" diff --git a/server/src/metrics/actix_web_metrics.rs b/server/src/metrics/actix_web_metrics.rs index 1fc30246..2a2b1965 100644 --- a/server/src/metrics/actix_web_metrics.rs +++ b/server/src/metrics/actix_web_metrics.rs @@ -5,7 +5,6 @@ use actix_web::http::{header, Method, StatusCode, Version}; use futures::{future, FutureExt}; use futures_core::future::LocalBoxFuture; use opentelemetry::metrics::{Histogram, Meter, MeterProvider, MetricsError, Unit, UpDownCounter}; -use opentelemetry::trace::OrderMap; use opentelemetry::{global, Key, KeyValue, Value}; use opentelemetry_semantic_conventions::trace::{ CLIENT_ADDRESS, CLIENT_SOCKET_ADDRESS, HTTP_REQUEST_METHOD, HTTP_RESPONSE_STATUS_CODE, @@ -62,20 +61,38 @@ pub(super) fn http_scheme(scheme: &str) -> Value { pub(crate) fn trace_attributes_from_request( req: &ServiceRequest, http_route: &str, -) -> OrderMap { +) -> Vec { let conn_info = req.connection_info(); - let mut attributes = OrderMap::with_capacity(11); - attributes.insert(HTTP_REQUEST_METHOD, http_method_str(req.method())); - attributes.insert(NETWORK_PROTOCOL_NAME, "http".into()); - attributes.insert(NETWORK_PROTOCOL_VERSION, http_version(req.version())); - attributes.insert(CLIENT_ADDRESS, conn_info.host().to_string().into()); - attributes.insert(HTTP_ROUTE, http_route.to_owned().into()); - attributes.insert(URL_SCHEME, http_scheme(conn_info.scheme())); + let mut attributes = Vec::with_capacity(11); + attributes.push(KeyValue::new( + HTTP_REQUEST_METHOD, + http_method_str(req.method()), + )); + attributes.push(KeyValue::new::( + NETWORK_PROTOCOL_NAME, + "http".into(), + )); + attributes.push(KeyValue::new( + NETWORK_PROTOCOL_VERSION, + http_version(req.version()), + )); + attributes.push(KeyValue::new::( + CLIENT_ADDRESS, + conn_info.host().to_string(), + )); + attributes.push(KeyValue::new::( + HTTP_ROUTE, + http_route.to_owned(), + )); + attributes.push(KeyValue::new(URL_SCHEME, http_scheme(conn_info.scheme()))); let server_name = req.app_config().host(); if server_name != conn_info.host() { - attributes.insert(SERVER_ADDRESS, server_name.to_string().into()); + attributes.push(KeyValue::new::( + SERVER_ADDRESS, + server_name.to_string(), + )); } if let Some(port) = conn_info .host() @@ -84,27 +101,39 @@ pub(crate) fn trace_attributes_from_request( .and_then(|port| port.parse::().ok()) { if port != 80 && port != 443 { - attributes.insert(SERVER_PORT, port.into()); + attributes.push(KeyValue::new::(SERVER_PORT, port)); } } if let Some(path) = req.uri().path_and_query() { - attributes.insert(URL_PATH, path.as_str().to_string().into()); + attributes.push(KeyValue::new::( + URL_PATH, + path.as_str().to_string(), + )); } if let Some(user_agent) = req .headers() .get(header::USER_AGENT) .and_then(|s| s.to_str().ok()) { - attributes.insert(USER_AGENT_ORIGINAL, user_agent.to_string().into()); + attributes.push(KeyValue::new::( + USER_AGENT_ORIGINAL, + user_agent.to_string(), + )); } let remote_addr = conn_info.realip_remote_addr(); if let Some(remote) = remote_addr { - attributes.insert(CLIENT_ADDRESS, remote.to_string().into()); + attributes.push(KeyValue::new::( + CLIENT_ADDRESS, + remote.to_string(), + )); } if let Some(peer_addr) = req.peer_addr().map(|socket| socket.ip().to_string()) { if Some(peer_addr.as_str()) != remote_addr { // Client is going through a proxy - attributes.insert(CLIENT_SOCKET_ADDRESS, peer_addr.into()); + attributes.push(KeyValue::new::( + CLIENT_SOCKET_ADDRESS, + peer_addr, + )); } } diff --git a/server/src/prom_metrics.rs b/server/src/prom_metrics.rs index 60d7fd1a..bb70b728 100644 --- a/server/src/prom_metrics.rs +++ b/server/src/prom_metrics.rs @@ -46,7 +46,7 @@ pub fn instantiate( fn instantiate_prometheus_metrics_handler( registry: prometheus::Registry, ) -> (PrometheusMetricsHandler, RequestMetrics) { - let resource = opentelemetry::sdk::Resource::new(vec![ + let resource = opentelemetry_sdk::Resource::new(vec![ opentelemetry::KeyValue::new("service.name", "unleash-edge"), opentelemetry::KeyValue::new("edge.version", crate::types::build::PKG_VERSION), opentelemetry::KeyValue::new("edge.githash", crate::types::build::SHORT_COMMIT),