diff --git a/Cargo.lock b/Cargo.lock index 0aa0866057e55..10e7d6d360290 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -628,7 +628,7 @@ dependencies = [ "fastrand 2.3.0", "hex", "http 0.2.9", - "hyper 0.14.27", + "hyper 0.14.32", "ring", "time", "tokio", @@ -921,7 +921,7 @@ dependencies = [ "http 0.2.9", "http-body 0.4.5", "http-body 1.0.0", - "hyper 0.14.27", + "hyper 0.14.32", "once_cell", "pin-project-lite", "pin-utils", @@ -1010,7 +1010,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.0", "http-body-util", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", "itoa", "matchit", @@ -1421,12 +1421,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "built" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6a6c0b39c38fd754ac338b00a88066436389c0f029da5d37d1e01091d9b7c17" - [[package]] name = "bumpalo" version = "3.12.1" @@ -1547,19 +1541,6 @@ dependencies = [ "serde", ] -[[package]] -name = "cargo_metadata" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", -] - [[package]] name = "cargo_metadata" version = "0.18.1" @@ -2675,15 +2656,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "error-chain" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" -dependencies = [ - "version_check", -] - [[package]] name = "event-listener" version = "2.5.3" @@ -2713,13 +2685,13 @@ dependencies = [ [[package]] name = "eventsource-client" -version = "0.11.0" -source = "git+https://github.com/MaterializeInc/rust-eventsource-client#7a446462e9cec0da283b100258c706286e9486e5" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43ddc25e1ad2cc0106d5e2d967397b4fb2068a66677ee9b0eea4600e5cfe8fb4" dependencies = [ "futures", - "hyper 0.14.27", + "hyper 0.14.32", "hyper-timeout 0.4.1", - "hyper-tls 0.5.0", "log", "pin-project", "rand 0.8.5", @@ -2732,7 +2704,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c3708c48ed7245587498d116a41566942d6d9943f5b3207fbf522e2bd0b72d0" dependencies = [ - "loom", + "loom 0.5.6", ] [[package]] @@ -3026,7 +2998,20 @@ dependencies = [ "libc", "log", "rustversion", - "windows", + "windows 0.48.0", +] + +[[package]] +name = "generator" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bd114ceda131d3b1d665eba35788690ad37f5916457286b32ab6fd3c438dd" +dependencies = [ + "cfg-if", + "libc", + "log", + "rustversion", + "windows 0.58.0", ] [[package]] @@ -3123,7 +3108,7 @@ checksum = "34e99a7734579b834a076ef11789783c153c6eb5fb3520ed15bc41f483f0f317" dependencies = [ "ahash", "camino", - "cargo_metadata 0.18.1", + "cargo_metadata", "cfg-if", "debug-ignore", "fixedbitset", @@ -3417,9 +3402,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "f2d708df4e7140240a16cd6ab0ab65c972d7433ab77819ea693fde9c43811e2a" [[package]] name = "httpdate" @@ -3435,9 +3420,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" dependencies = [ "bytes", "futures-channel", @@ -3450,7 +3435,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2", "tokio", "tower-service", "tracing", @@ -3459,9 +3444,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.4.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" dependencies = [ "bytes", "futures-channel", @@ -3485,7 +3470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "527d4d619ca2c2aafa31ec139a3d1d60bf557bf7578a1f20f743637eccd9ca19" dependencies = [ "http 1.1.0", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", "linked_hash_set", "once_cell", @@ -3503,7 +3488,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper 0.14.27", + "hyper 0.14.32", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -3515,7 +3500,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" dependencies = [ - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", "pin-project-lite", "tokio", @@ -3529,7 +3514,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.27", + "hyper 0.14.32", "native-tls", "tokio", "tokio-native-tls", @@ -3543,7 +3528,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", "native-tls", "tokio", @@ -3562,9 +3547,9 @@ dependencies = [ "futures-util", "http 1.1.0", "http-body 1.0.0", - "hyper 1.4.1", + "hyper 1.6.0", "pin-project-lite", - "socket2 0.5.7", + "socket2", "tokio", "tower", "tower-service", @@ -3943,7 +3928,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.0", "http-body-util", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-openssl", "hyper-timeout 0.5.1", "hyper-util", @@ -4026,23 +4011,23 @@ dependencies = [ [[package]] name = "launchdarkly-server-sdk" -version = "1.0.0" -source = "git+https://github.com/MaterializeInc/rust-server-sdk?rev=87c0f67aa51fa936d3a6a49605e8e3f565d15281#87c0f67aa51fa936d3a6a49605e8e3f565d15281" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f45bcc66f766cb4860390ef92ef9fccf167e84d57352b805f5f28e6018481a64" dependencies = [ - "built", "chrono", "crossbeam-channel", "data-encoding", "eventsource-client", "futures", - "hyper 0.14.27", - "hyper-tls 0.5.0", + "hyper 0.14.32", "launchdarkly-server-sdk-evaluation", "lazy_static", "log", "lru", "moka", "parking_lot", + "rand 0.8.5", "ring", "serde", "serde_json", @@ -4054,9 +4039,9 @@ dependencies = [ [[package]] name = "launchdarkly-server-sdk-evaluation" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c27dd31ce69c55fca526d1c22c2dcca96fd0c98e496529d37eeef6c41652173" +checksum = "518248a3a50272432e36bc533675e50d09f97107d548a39875ade1fe1bb24910" dependencies = [ "base16ct", "chrono", @@ -4070,7 +4055,6 @@ dependencies = [ "serde_json", "serde_with", "sha1", - "urlencoding", ] [[package]] @@ -4266,7 +4250,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" dependencies = [ "cfg-if", - "generator", + "generator 0.7.5", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "loom" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" +dependencies = [ + "cfg-if", + "generator 0.8.4", "scoped-tls", "tracing", "tracing-subscriber", @@ -4460,23 +4457,20 @@ dependencies = [ [[package]] name = "moka" -version = "0.9.6" +version = "0.12.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b49a05f67020456541f4f29cbaa812016a266a86ec76f96d3873d459c68fe5e" +checksum = "a9321642ca94a4282428e6ea4af8cc2ca4eac48ac7a6a4ea8f33f76d0ce70926" dependencies = [ "crossbeam-channel", "crossbeam-epoch", "crossbeam-utils", - "num_cpus", - "once_cell", + "loom 0.7.2", "parking_lot", + "portable-atomic 1.6.0", "rustc_version", - "scheduled-thread-pool", - "skeptic", "smallvec", "tagptr", "thiserror", - "triomphe", "uuid", ] @@ -4516,7 +4510,7 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "socket2 0.5.7", + "socket2", "thiserror", "tokio", "tokio-native-tls", @@ -4570,7 +4564,7 @@ dependencies = [ "clap", "csv", "dirs", - "hyper 1.4.1", + "hyper 1.6.0", "indicatif", "maplit", "mz-build-info", @@ -4620,6 +4614,8 @@ dependencies = [ "governor", "hex", "http 1.1.0", + "hyper 0.14.32", + "hyper-tls 0.5.0", "ipnet", "itertools 0.12.1", "launchdarkly-server-sdk", @@ -4833,7 +4829,7 @@ dependencies = [ "domain", "futures", "humantime", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-openssl", "hyper-util", "jsonwebtoken", @@ -5013,7 +5009,7 @@ name = "mz-ccsr" version = "0.0.0" dependencies = [ "anyhow", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", "mz-build-tools", "mz-ore", @@ -5128,7 +5124,7 @@ dependencies = [ "clap", "fail", "futures", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-util", "mz-alloc", "mz-alloc-default", @@ -5414,7 +5410,7 @@ dependencies = [ "http 1.1.0", "http-body-util", "humantime", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-openssl", "hyper-tls 0.6.0", "hyper-util", @@ -5626,7 +5622,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "socket2 0.5.7", + "socket2", "thiserror", "tokio", "tokio-postgres", @@ -5694,7 +5690,7 @@ dependencies = [ "base64 0.22.0", "chrono", "clap", - "hyper 1.4.1", + "hyper 1.6.0", "jsonwebtoken", "mz-frontegg-auth", "mz-ore", @@ -5719,7 +5715,7 @@ dependencies = [ "axum-extra", "headers", "http 1.1.0", - "hyper 1.4.1", + "hyper 1.6.0", "include_dir", "mz-ore", "prometheus", @@ -6726,7 +6722,7 @@ dependencies = [ "openssl", "proxy-header", "scopeguard", - "socket2 0.5.7", + "socket2", "tokio", "tokio-stream", "tracing", @@ -8758,17 +8754,6 @@ dependencies = [ "cc", ] -[[package]] -name = "pulldown-cmark" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34f197a544b0c9ab3ae46c359a7ec9cbbb5c7bf97054266fecb7ead794a181d6" -dependencies = [ - "bitflags 1.3.2", - "memchr", - "unicase", -] - [[package]] name = "qcell" version = "0.5.4" @@ -9078,7 +9063,7 @@ dependencies = [ "h2 0.3.26", "http 0.2.9", "http-body 0.4.5", - "hyper 0.14.27", + "hyper 0.14.32", "hyper-tls 0.5.0", "ipnet", "js-sys", @@ -9123,7 +9108,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.0", "http-body-util", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-tls 0.6.0", "hyper-util", "ipnet", @@ -9175,7 +9160,7 @@ dependencies = [ "chrono", "futures", "http 0.2.9", - "hyper 0.14.27", + "hyper 0.14.32", "reqwest 0.11.24", "reqwest-middleware", "retry-policies", @@ -9382,15 +9367,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "scheduled-thread-pool" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "977a7519bff143a44f842fd07e80ad1329295bd71686457f18e496736f4bf9bf" -dependencies = [ - "parking_lot", -] - [[package]] name = "schemars" version = "0.8.11" @@ -9931,21 +9907,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "skeptic" -version = "0.13.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" -dependencies = [ - "bytecount", - "cargo_metadata 0.14.2", - "error-chain", - "glob", - "pulldown-cmark", - "tempfile", - "walkdir", -] - [[package]] name = "slab" version = "0.4.9" @@ -9970,16 +9931,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" -[[package]] -name = "socket2" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "socket2" version = "0.5.7" @@ -10541,7 +10492,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.7", + "socket2", "tokio-macros", "tracing", "windows-sys 0.48.0", @@ -10641,7 +10592,7 @@ dependencies = [ "postgres-types", "rand 0.8.5", "serde", - "socket2 0.5.7", + "socket2", "tokio", "tokio-util", "whoami", @@ -10773,13 +10724,13 @@ dependencies = [ "http 1.1.0", "http-body 1.0.0", "http-body-util", - "hyper 1.4.1", + "hyper 1.6.0", "hyper-timeout 0.5.1", "hyper-util", "percent-encoding", "pin-project", "prost", - "socket2 0.5.7", + "socket2", "tokio", "tokio-stream", "tower", @@ -11008,12 +10959,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" -[[package]] -name = "triomphe" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1ee9bd9239c339d714d657fac840c6d2a4f9c45f4f9ec7b0975113458be78db" - [[package]] name = "try-lock" version = "0.2.2" @@ -11510,6 +11455,70 @@ dependencies = [ "windows-targets 0.48.0", ] +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.63", +] + +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.63", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.42.0" @@ -11798,8 +11807,8 @@ dependencies = [ "getrandom 0.2.10", "half 2.4.1", "hashbrown 0.14.5", - "hyper 0.14.27", - "hyper 1.4.1", + "hyper 0.14.32", + "hyper 1.6.0", "hyper-util", "indexmap 1.9.1", "insta", @@ -11862,7 +11871,7 @@ dependencies = [ "sha2", "similar", "smallvec", - "socket2 0.5.7", + "socket2", "subtle", "syn 1.0.107", "syn 2.0.63", diff --git a/Cargo.toml b/Cargo.toml index 74517c65d8d38..d10d7fd359146 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -306,12 +306,6 @@ serde-value = { git = "https://github.com/MaterializeInc/serde-value.git" } # upstream. tracing-opentelemetry = { git = "https://github.com/MaterializeInc/tracing-opentelemetry.git" } -# Waiting on https://github.com/launchdarkly/rust-server-sdk/pull/20 to make -# it into a release. -# Also bumps lru to 0.12.0 -# Needs a more complex update to 2.0.0, with a custom TLS connector. -launchdarkly-server-sdk = { git = "https://github.com/MaterializeInc/rust-server-sdk", rev = "87c0f67aa51fa936d3a6a49605e8e3f565d15281" } - # Waiting on https://github.com/edenhill/librdkafka/pull/4051. rdkafka = { git = "https://github.com/MaterializeInc/rust-rdkafka.git" } rdkafka-sys = { git = "https://github.com/MaterializeInc/rust-rdkafka.git" } diff --git a/src/adapter/Cargo.toml b/src/adapter/Cargo.toml index c58b17196ca29..68b6300b25060 100644 --- a/src/adapter/Cargo.toml +++ b/src/adapter/Cargo.toml @@ -24,12 +24,12 @@ fail = { version = "0.5.1", features = ["failpoints"] } futures = "0.3.25" governor = "0.6.0" hex = "0.4.3" +hyper = { version = "0.14.32", features = ["client", "http1"] } +hyper-tls = "0.5.0" http = "1.1.0" ipnet = "2.5.0" itertools = "0.12.1" -launchdarkly-server-sdk = { version = "1.0.0", default-features = false, features = [ - "hypertls", -] } +launchdarkly-server-sdk = { version = "2.4.1", default-features = false } maplit = "1.0.2" mz-adapter-types = { path = "../adapter-types" } mz-audit-log = { path = "../audit-log" } diff --git a/src/adapter/src/config.rs b/src/adapter/src/config.rs index ede0b5343fdbb..025aa97280d14 100644 --- a/src/adapter/src/config.rs +++ b/src/adapter/src/config.rs @@ -11,8 +11,7 @@ use std::collections::BTreeMap; use mz_build_info::BuildInfo; use mz_ore::metric; -use mz_ore::metrics::{MetricsRegistry, UIntGauge}; -use mz_ore::now::NowFn; +use mz_ore::metrics::MetricsRegistry; use mz_sql::catalog::EnvironmentId; use prometheus::IntCounter; @@ -35,8 +34,6 @@ pub struct SystemParameterSyncConfig { build_info: &'static BuildInfo, /// Parameter sync metrics. metrics: Metrics, - /// Function to return the current time. - now_fn: NowFn, /// The SDK key. ld_sdk_key: String, /// A map from parameter names to LaunchDarkly feature keys @@ -51,7 +48,6 @@ impl SystemParameterSyncConfig { env_id: EnvironmentId, build_info: &'static BuildInfo, registry: &MetricsRegistry, - now_fn: NowFn, ld_sdk_key: String, ld_key_map: BTreeMap, ) -> Self { @@ -59,7 +55,6 @@ impl SystemParameterSyncConfig { env_id, build_info, metrics: Metrics::register_into(registry), - now_fn, ld_sdk_key, ld_key_map, } @@ -68,22 +63,12 @@ impl SystemParameterSyncConfig { #[derive(Debug, Clone)] pub(super) struct Metrics { - pub last_cse_time_seconds: UIntGauge, - pub last_sse_time_seconds: UIntGauge, pub params_changed: IntCounter, } impl Metrics { pub(super) fn register_into(registry: &MetricsRegistry) -> Self { Self { - last_cse_time_seconds: registry.register(metric!( - name: "mz_parameter_frontend_last_cse_time_seconds", - help: "The last known time when the LaunchDarkly client sent an event to the LaunchDarkly server (as unix timestamp).", - )), - last_sse_time_seconds: registry.register(metric!( - name: "mz_parameter_frontend_last_sse_time_seconds", - help: "The last known time when the LaunchDarkly client received an event from the LaunchDarkly server (as unix timestamp).", - )), params_changed: registry.register(metric!( name: "mz_parameter_frontend_params_changed", help: "The number of parameter changes pulled from the LaunchDarkly frontend.", diff --git a/src/adapter/src/config/frontend.rs b/src/adapter/src/config/frontend.rs index 5c5f3c8dc0451..b55907b1b0928 100644 --- a/src/adapter/src/config/frontend.rs +++ b/src/adapter/src/config/frontend.rs @@ -8,16 +8,13 @@ // by the Apache License, Version 2.0. use std::collections::BTreeMap; -use std::sync::Arc; use std::time::Duration; use derivative::Derivative; use launchdarkly_server_sdk as ld; use mz_build_info::BuildInfo; use mz_cloud_provider::CloudProvider; -use mz_ore::now::NowFn; use mz_sql::catalog::EnvironmentId; -use tokio::time; use crate::config::{Metrics, SynchronizedParameters, SystemParameterSyncConfig}; @@ -37,8 +34,6 @@ pub struct SystemParameterFrontend { ld_key_map: BTreeMap, /// Frontend metrics. ld_metrics: Metrics, - /// Function to return the current time. - now_fn: NowFn, } impl SystemParameterFrontend { @@ -53,7 +48,6 @@ impl SystemParameterFrontend { ld_ctx: ld_ctx(&sync_config.env_id, sync_config.build_info)?, ld_key_map: sync_config.ld_key_map.clone(), ld_metrics: sync_config.metrics.clone(), - now_fn: sync_config.now_fn.clone(), }) } @@ -90,43 +84,29 @@ impl SystemParameterFrontend { } } -fn ld_config(sync_config: &SystemParameterSyncConfig) -> ld::Config { +fn ld_config(sync_config: &SystemParameterSyncConfig) -> Result { ld::ConfigBuilder::new(&sync_config.ld_sdk_key) - .event_processor(ld::EventProcessorBuilder::new().on_success({ - let last_cse_time_seconds = sync_config.metrics.last_cse_time_seconds.clone(); - Arc::new(move |result| { - if let Ok(ts) = u64::try_from(result.time_from_server / 1000) { - last_cse_time_seconds.set(ts); - } else { - tracing::warn!("Cannot convert time_from_server / 1000 from u128 to u64"); - } - }) - })) + .event_processor( + ld::EventProcessorBuilder::new().https_connector(hyper_tls::HttpsConnector::new()), + ) + .data_source(&ld::StreamingDataSourceBuilder::< + hyper_tls::HttpsConnector, + >::new()) .build() } async fn ld_client(sync_config: &SystemParameterSyncConfig) -> Result { - let ld_client = ld::Client::build(ld_config(sync_config))?; + let ld_client = ld::Client::build(ld_config(sync_config)?)?; tracing::info!("waiting for SystemParameterFrontend to initialize"); - // Start and initialize LD client for the frontend. The callback passed - // will export the last time when an SSE event from the LD server was - // received in a Prometheus metric. - ld_client.start_with_default_executor_and_callback({ - let last_sse_time_seconds = sync_config.metrics.last_sse_time_seconds.clone(); - let now_fn = sync_config.now_fn.clone(); - Arc::new(move |_ev| { - let ts = now_fn() / 1000; - last_sse_time_seconds.set(ts); - }) - }); + // Start and initialize LD client for the frontend. + ld_client.start_with_default_executor(); let max_backoff = Duration::from_secs(60); let mut backoff = Duration::from_secs(5); - while !ld_client.initialized_async().await { + while ld_client.wait_for_initialization(backoff).await != Some(true) { tracing::warn!("SystemParameterFrontend failed to initialize"); - time::sleep(backoff).await; backoff = (backoff * 2).min(max_backoff); } diff --git a/src/balancerd/Cargo.toml b/src/balancerd/Cargo.toml index d84b7c0bedd76..561cd2340690a 100644 --- a/src/balancerd/Cargo.toml +++ b/src/balancerd/Cargo.toml @@ -24,7 +24,7 @@ hyper = { version = "1.4.1", features = ["http1", "server"] } hyper-openssl = "0.10.2" hyper-util = "0.1.6" jsonwebtoken = "9.2.0" -launchdarkly-server-sdk = { version = "1.0.0", default-features = false } +launchdarkly-server-sdk = { version = "2.4.1", default-features = false } mz-alloc = { path = "../alloc" } mz-alloc-default = { path = "../alloc-default", optional = true } mz-build-info = { path = "../build-info" } diff --git a/src/dyncfg-launchdarkly/Cargo.toml b/src/dyncfg-launchdarkly/Cargo.toml index a3c48f0c66568..1b1aa80ccf629 100644 --- a/src/dyncfg-launchdarkly/Cargo.toml +++ b/src/dyncfg-launchdarkly/Cargo.toml @@ -13,9 +13,7 @@ workspace = true [dependencies] anyhow = { version = "1.0.66", features = ["backtrace"] } humantime = "2.1.0" -launchdarkly-server-sdk = { version = "1.0.0", default-features = false, features = [ - "hypertls", -] } +launchdarkly-server-sdk = { version = "2.4.1", default-features = false } mz-build-info = { path = "../build-info" } mz-dyncfg = { path = "../dyncfg" } mz-ore = { path = "../ore", default-features = false } diff --git a/src/dyncfg-launchdarkly/src/lib.rs b/src/dyncfg-launchdarkly/src/lib.rs index 85f5b75896914..60e7cd481c100 100644 --- a/src/dyncfg-launchdarkly/src/lib.rs +++ b/src/dyncfg-launchdarkly/src/lib.rs @@ -49,14 +49,13 @@ where let _ = dyn_into_flag(entry.val())?; } let ld_client = if let Some(key) = launchdarkly_sdk_key { - let client = ld::Client::build(ld::ConfigBuilder::new(key).build())?; + let client = ld::Client::build(ld::ConfigBuilder::new(key).build()?)?; client.start_with_default_executor(); let init = async { let max_backoff = Duration::from_secs(60); let mut backoff = Duration::from_secs(5); - while !client.initialized_async().await { + while client.wait_for_initialization(backoff).await != Some(true) { tracing::warn!("SyncedConfigSet failed to initialize"); - tokio::time::sleep(backoff).await; backoff = (backoff * 2).min(max_backoff); } }; diff --git a/src/environmentd/src/lib.rs b/src/environmentd/src/lib.rs index 48197544110e4..2d554d54c2264 100644 --- a/src/environmentd/src/lib.rs +++ b/src/environmentd/src/lib.rs @@ -361,7 +361,6 @@ impl Listeners { config.environment_id.clone(), &BUILD_INFO, &config.metrics_registry, - config.now.clone(), ld_sdk_key, config.launchdarkly_key_map, ))