diff --git a/App.toml.sample b/App.toml.sample index 71c9e79f..db61a17d 100644 --- a/App.toml.sample +++ b/App.toml.sample @@ -25,3 +25,6 @@ id = "janus-gateway.svc.example.org" default_timeout = 5 stream_upload_timeout = 600 transaction_watchdog_check_period = 1 + +[metrics.http] +bind_address = "0.0.0.0:8087" diff --git a/Cargo.lock b/Cargo.lock index 9f8bc297..82a0c494 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,6 +99,16 @@ dependencies = [ "syn 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "async-channel" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "concurrent-queue 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "event-listener 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "async-h1" version = "2.1.2" @@ -111,7 +121,7 @@ dependencies = [ "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project-lite 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -125,6 +135,39 @@ dependencies = [ "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "async-session" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "anyhow 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", + "async-std 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "async-trait 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "blake3 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "hmac 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "kv-log-macro 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "async-sse" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "async-channel 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "async-std 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "http-types 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "async-std" version = "1.6.0" @@ -137,12 +180,12 @@ dependencies = [ "futures-core 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures-io 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "kv-log-macro 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "kv-log-macro 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project-lite 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "pin-utils 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "smol 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -175,7 +218,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "async-trait" -version = "0.1.31" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -235,8 +278,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "base64" -version = "0.12.1" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bincode" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "bitflags" @@ -261,6 +313,20 @@ dependencies = [ "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "blake3" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crypto-mac 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "block-buffer" version = "0.9.0" @@ -310,6 +376,11 @@ name = "bytes" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "cache-padded" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cc" version = "1.0.53" @@ -322,13 +393,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "chrono" -version = "0.4.11" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "libc 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -351,15 +424,23 @@ dependencies = [ "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "concurrent-queue" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cache-padded 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "conference" version = "0.5.14" dependencies = [ "anyhow 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", "async-std 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "async-trait 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "async-trait 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "diesel 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -370,21 +451,23 @@ dependencies = [ "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "sentry 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "signal-hook 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-envlogger 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-serde 1.0.0-alpha9 (registry+https://github.com/rust-lang/crates.io-index)", - "svc-agent 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", + "svc-agent 0.14.10 (registry+https://github.com/rust-lang/crates.io-index)", "svc-authn 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "svc-authz 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "svc-error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tide 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "webrtc-sdp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -399,7 +482,7 @@ dependencies = [ "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", "serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -415,7 +498,7 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aes-gcm 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "base64 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", "hkdf 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "hmac 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -585,11 +668,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "diesel_derives 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "pq-sys 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "r2d2 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -672,6 +755,11 @@ dependencies = [ "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "event-listener" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "failure" version = "0.1.8" @@ -692,6 +780,21 @@ dependencies = [ "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "femme" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.39 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.39 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1007,10 +1110,10 @@ dependencies = [ "async-std 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "cookie 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)", "infer 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project-lite 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "serde_qs 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1148,11 +1251,11 @@ name = "jsonwebtoken" version = "7.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "base64 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", "pem 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.16.14 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "simple_asn1 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1167,7 +1270,7 @@ dependencies = [ [[package]] name = "kv-log-macro" -version = "1.0.5" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1500,7 +1603,7 @@ name = "pem" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "base64 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1530,7 +1633,7 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.1.5" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1785,9 +1888,9 @@ dependencies = [ "mime_guess 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project-lite 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1813,12 +1916,17 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "route-recognizer" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rumq-core" version = "0.1.0-alpha.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "async-trait 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "async-trait 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1831,7 +1939,7 @@ name = "rust-argon2" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "base64 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", "blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1973,11 +2081,11 @@ name = "sentry-types" version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "debugid 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2019,7 +2127,7 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.53" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2097,7 +2205,7 @@ name = "simple_asn1" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2156,9 +2264,9 @@ name = "slog-json" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2198,7 +2306,7 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2309,7 +2417,7 @@ dependencies = [ "quote 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2337,9 +2445,9 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project-lite 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.39 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2347,20 +2455,21 @@ dependencies = [ [[package]] name = "svc-agent" -version = "0.14.6" +version = "0.14.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "diesel 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures-channel 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "svc-authn 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "svc-rumq-client 0.1.0-alpha.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2372,7 +2481,7 @@ name = "svc-authn" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "diesel 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "jsonwebtoken 7.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2385,8 +2494,8 @@ name = "svc-authz" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "async-trait 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "async-trait 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "http-client 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2396,7 +2505,7 @@ dependencies = [ "r2d2_redis 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "surf 2.0.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", "svc-authn 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2414,7 +2523,7 @@ dependencies = [ "sentry 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", - "svc-agent 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", + "svc-agent 0.14.10 (registry+https://github.com/rust-lang/crates.io-index)", "svc-authn 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "svc-authz 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2527,6 +2636,26 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tide" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "async-h1 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "async-session 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "async-sse 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "async-std 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "async-trait 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "femme 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "http-types 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "kv-log-macro 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "route-recognizer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "time" version = "0.1.43" @@ -2584,7 +2713,7 @@ dependencies = [ "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project-lite 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-macros 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2714,7 +2843,7 @@ dependencies = [ "futures-core 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures-sink 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project-lite 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2919,7 +3048,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-macro 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3085,13 +3214,16 @@ dependencies = [ "checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" "checksum ascii 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" "checksum async-attributes 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "efd3d156917d94862e779f356c5acae312b08fd3121e792c857d7928c8088423" +"checksum async-channel 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "59740d83946db6a5af71ae25ddf9562c2b176b2ca42cf99a455f09f4a220d6b9" "checksum async-h1 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ca2b5cfe1804f48bb8dfb1b2391e6e9a3fbf89e07514dce3bddb03eb4d529db" "checksum async-native-tls 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9e9e7a929bd34c68a82d58a4de7f86fffdaf97fb2af850162a7bb19dd7269b33" +"checksum async-session 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "345022a2eed092cd105cc1b26fd61c341e100bd5fcbbd792df4baf31c2cc631f" +"checksum async-sse 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a127da64eb321f5b698a43fb9b976d1e5fc1fd3c2f961322d6cc06ce721b47b" "checksum async-std 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a45cee2749d880d7066e328a7e161c7470ced883b2fd000ca4643e9f1dd5083a" "checksum async-stream 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "22068c0c19514942eefcfd4daf8976ef1aad84e61539f95cd200c35202f80af5" "checksum async-stream-impl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25f9db3b38af870bf7e5cc649167533b493928e50744e2c30ae350230b414670" "checksum async-task 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3" -"checksum async-trait 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "26c4f3195085c36ea8d24d32b2f828d23296a9370a28aa39d111f6f16bef9f3b" +"checksum async-trait 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b246867b8b3b6ae56035f1eb1ed557c1d8eae97f0d53696138a50fa0e3a3b8c0" "checksum atom 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3c86699c3f02778ec07158376991c8f783dd1f2f95c579ffaf0738dc984b2fe2" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" "checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" @@ -3099,10 +3231,12 @@ dependencies = [ "checksum base-x 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" -"checksum base64 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "53d1ccbaf7d9ec9537465a97bf19edc1a4e158ecb49fc16178202238c569cc42" +"checksum base64 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +"checksum bincode 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum bitmaps 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" "checksum blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" +"checksum blake3 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e9ff35b701f3914bdb8fad3368d822c766ef2858b2583198e41639b936f09d3f" "checksum block-buffer 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" "checksum block-cipher 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fa136449e765dc7faa244561ccae839c394048667929af599b5d931ebe7b7f10" "checksum bumpalo 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5356f1d23ee24a1f785a56d1d1a5f0fd5b0f6a0c0fb2412ce11da71649ab78f6" @@ -3110,11 +3244,13 @@ dependencies = [ "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" "checksum bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" +"checksum cache-padded 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" "checksum cc 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)" = "404b1fe4f65288577753b17e3b36a04596ee784493ec249bf81c7f2d2acd751c" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" +"checksum chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum combine 3.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" +"checksum concurrent-queue 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" "checksum config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f9107d78ed62b3fa5a86e7d18e647abed48cfd8f8fab6c72f4cdb982d196f7e6" "checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" "checksum cookie 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1373a16a4937bc34efec7b391f9c1500c30b8478a701a4f44c9165cc0475a6e0" @@ -3145,8 +3281,10 @@ dependencies = [ "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" "checksum encoding_rs 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "e8ac63f94732332f44fe654443c46f6375d1939684c17b0afb6cb56b0456e171" "checksum error-chain 0.12.4 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +"checksum event-listener 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" "checksum failure 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" "checksum failure_derive 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" +"checksum femme 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2af1a24f391a5a94d756db5092c6576aad494b88a71a5a36b20c67b63e0df034" "checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" @@ -3196,7 +3334,7 @@ dependencies = [ "checksum js-sys 0.3.39 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5a448de267e7358beaf4a5d849518fe9a0c13fce7afd44b06e68550e5562a7" "checksum jsonwebtoken 7.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6afc14dc098f780c4ec8ec3d7b2bd8ac5d5c9ed031d55d8e0a25378010ae444" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum kv-log-macro 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2a2d3beed37e5483887d81eb39de6de03a8346531410e1306ca48a9a89bd3a51" +"checksum kv-log-macro 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)" = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f" @@ -3239,7 +3377,7 @@ dependencies = [ "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" "checksum pin-project 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)" = "81d480cb4e89522ccda96d0eed9af94180b7a5f93fb28f66e1fd7d68431663d1" "checksum pin-project-internal 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)" = "a82996f11efccb19b685b14b5df818de31c1edcee3daa256ab5775dd98e72feb" -"checksum pin-project-lite 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f" +"checksum pin-project-lite 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" "checksum pin-utils 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" "checksum piper 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "01608bfa680dafb103f9207fa944facf572e4e3e708d10de19a0d0c3d36e5f18" "checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" @@ -3270,6 +3408,7 @@ dependencies = [ "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" "checksum reqwest 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b81e49ddec5109a9dcfc5f2a317ff53377c915e9ae9d4f2fb50914b85614e2" "checksum ring 0.16.14 (registry+https://github.com/rust-lang/crates.io-index)" = "06b3fefa4f12272808f809a0af618501fdaba41a58963c5fb72238ab0be09603" +"checksum route-recognizer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56770675ebc04927ded3e60633437841581c285dc6236109ea25fbf3beb7b59e" "checksum rumq-core 0.1.0-alpha.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7a9e1af4026f37c89a92e70f0e80208515917990b50128943f6110117a9540af" "checksum rust-argon2 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9dab61250775933275e84053ac235621dfb739556d5c54a2f2e9313b7cf43a19" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" @@ -3293,7 +3432,7 @@ dependencies = [ "checksum serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)" = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5" "checksum serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0b833c5ad67d52ced5f5938b2980f32a9c1c5ef047f0b4fb3127e7a423c76153" "checksum serde_derive 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)" = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48" -"checksum serde_json 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)" = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2" +"checksum serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)" = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" "checksum serde_qs 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6f3acf84e23ab27c01cb5917551765c01c50b2000089db8fa47fe018a3260cf" "checksum serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5" "checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" @@ -3327,7 +3466,7 @@ dependencies = [ "checksum stdweb-internal-runtime 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" "checksum subtle 2.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" "checksum surf 2.0.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "68bf1412b095b3a54da6ec3a969e2663cb3cf535652cd97c02e99443a400fd7d" -"checksum svc-agent 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)" = "bdeb3cd95d467087c9560980482e75be835ce044b5047dcc29a3d3a4ffdfbb3c" +"checksum svc-agent 0.14.10 (registry+https://github.com/rust-lang/crates.io-index)" = "35f7eecd834c81cdde33ed0435b31d5086fb8b8c8f6162a6c44346a2bceb6ace" "checksum svc-authn 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f546e117d9287d7b1274e855315019011d13736fdc5c8f8ef9d09ae00509de6" "checksum svc-authz 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3d6372c729616b9782b86d1bc8c80db49ae53fba7c788b3b4bc307800e7bcc88" "checksum svc-error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5ca1419d26952fbb917f2481b0697bc77768c0ad9bde5618fd7cefdf18fd1738" @@ -3342,6 +3481,7 @@ dependencies = [ "checksum thiserror 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "b13f926965ad00595dd129fa12823b04bbf866e9085ab0a5f2b05b850fbfc344" "checksum thiserror-impl 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "893582086c2f98cde18f906265a65b5030a074b1046c674ae898be6519a7f479" "checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +"checksum tide 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7c4c4e35f5a89ed08cbb59b6e4e1d648e563d6f8daa804002f3557d11d3c8f9" "checksum time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" "checksum time 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "3a51cadc5b1eec673a685ff7c33192ff7b7603d0b75446fb354939ee615acb15" "checksum time-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ae9b6e9f095bc105e183e3cd493d72579be3181ad4004fceb01adbe9eecab2d" diff --git a/Cargo.toml b/Cargo.toml index 895a8b5b..b806a722 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,3 +37,6 @@ svc-authz = "0.10" svc-error = { version = "0.1", features = ["diesel", "r2d2", "svc-agent", "svc-authn", "svc-authz", "sentry-extension"] } uuid = { version = "0.6", features = ["v4", "serde"] } webrtc-sdp = "0.1" +tide = "0.13.0" +# this is to prohibit tide and surf inside svc-authz from updating this dependency +pin-project-lite = "=0.1.7" diff --git a/src/app/context.rs b/src/app/context.rs index 4ec0be8f..321eff4c 100644 --- a/src/app/context.rs +++ b/src/app/context.rs @@ -9,7 +9,7 @@ use svc_authz::cache::ConnectionPool as RedisConnectionPool; use svc_authz::ClientMap as Authz; use crate::app::error::{Error as AppError, ErrorExt, ErrorKind as AppErrorKind}; -use crate::app::metrics::{DbPoolStatsCollector, DynamicStatsCollector}; +use crate::app::metrics::{DynamicStatsCollector, Metric}; use crate::backend::janus::Client as JanusClient; use crate::config::Config; use crate::db::ConnectionPool as Db; @@ -27,8 +27,8 @@ pub(crate) trait GlobalContext: Sync { fn janus_topics(&self) -> &JanusTopics; fn queue_counter(&self) -> &Option; fn redis_pool(&self) -> &Option; - fn db_pool_stats(&self) -> &Option; fn dynamic_stats(&self) -> Option<&DynamicStatsCollector>; + fn get_metrics(&self, duration: u64) -> anyhow::Result>; fn get_conn(&self) -> Result>, AppError> { self.db() @@ -59,7 +59,6 @@ pub(crate) struct AppContext { janus_topics: JanusTopics, queue_counter: Option, redis_pool: Option, - db_pool_stats: Option, dynamic_stats: Option>, } @@ -82,7 +81,6 @@ impl AppContext { janus_topics, queue_counter: None, redis_pool: None, - db_pool_stats: None, dynamic_stats: Some(Arc::new(DynamicStatsCollector::start())), } } @@ -100,13 +98,6 @@ impl AppContext { ..self } } - - pub(crate) fn db_pool_stats(self, stats: DbPoolStatsCollector) -> Self { - Self { - db_pool_stats: Some(stats), - ..self - } - } } impl GlobalContext for AppContext { @@ -142,13 +133,13 @@ impl GlobalContext for AppContext { &self.redis_pool } - fn db_pool_stats(&self) -> &Option { - &self.db_pool_stats - } - fn dynamic_stats(&self) -> Option<&DynamicStatsCollector> { self.dynamic_stats.as_deref() } + + fn get_metrics(&self, duration: u64) -> anyhow::Result> { + crate::app::metrics::Collector::new(self, duration).get() + } } /////////////////////////////////////////////////////////////////////////////// @@ -202,13 +193,13 @@ impl<'a, C: GlobalContext> GlobalContext for AppMessageContext<'a, C> { self.global_context.redis_pool() } - fn db_pool_stats(&self) -> &Option { - self.global_context.db_pool_stats() - } - fn dynamic_stats(&self) -> Option<&DynamicStatsCollector> { self.global_context.dynamic_stats() } + + fn get_metrics(&self, duration: u64) -> anyhow::Result> { + self.global_context.get_metrics(duration) + } } impl<'a, C: GlobalContext> MessageContext for AppMessageContext<'a, C> { diff --git a/src/app/endpoint/metric.rs b/src/app/endpoint/metric.rs index 06599a71..0858e6f9 100644 --- a/src/app/endpoint/metric.rs +++ b/src/app/endpoint/metric.rs @@ -1,7 +1,5 @@ use async_std::stream; use async_trait::async_trait; -use chrono::{DateTime, Utc}; -use diesel::pg::PgConnection; use serde_derive::Deserialize; use svc_agent::mqtt::{ IncomingEventProperties, IntoPublishableMessage, OutgoingEvent, ShortTermTimingProperties, @@ -9,9 +7,8 @@ use svc_agent::mqtt::{ use crate::app::context::Context; use crate::app::endpoint::prelude::*; -use crate::app::metrics::{Metric, Metric2, MetricValue}; +use crate::app::metrics::Metric2; use crate::config::TelemetryConfig; -use crate::db; #[derive(Debug, Deserialize)] pub(crate) struct PullPayload { @@ -38,74 +35,10 @@ impl EventHandler for PullHandler { TelemetryConfig { id: Some(ref account_id), } => { - let now = Utc::now(); - - let mut metrics = if let Some(qc) = context.queue_counter() { - let stats = qc - .get_stats(payload.duration) - .map_err(|err| anyhow!("Failed to get stats: {}", err)) - .error(AppErrorKind::StatsCollectionFailed)?; - - vec![ - Metric::IncomingQueueRequests(MetricValue::new( - stats.incoming_requests, - now, - )), - Metric::IncomingQueueResponses(MetricValue::new( - stats.incoming_responses, - now, - )), - Metric::IncomingQueueEvents(MetricValue::new(stats.incoming_events, now)), - Metric::OutgoingQueueRequests(MetricValue::new( - stats.outgoing_requests, - now, - )), - Metric::OutgoingQueueResponses(MetricValue::new( - stats.outgoing_responses, - now, - )), - Metric::OutgoingQueueEvents(MetricValue::new(stats.outgoing_events, now)), - ] - } else { - vec![] - }; - - let db_state = context.db().state(); - metrics.push(Metric::DbConnections(MetricValue::new( - db_state.connections as u64, - now, - ))); - - metrics.push(Metric::IdleDbConnections(MetricValue::new( - db_state.idle_connections as u64, - now, - ))); - - if let Some(pool) = context.redis_pool() { - let pool_state = pool.state(); - metrics.push(Metric::RedisConnections(MetricValue::new( - pool_state.connections as u64, - now, - ))); - - metrics.push(Metric::IdleRedisConnections(MetricValue::new( - pool_state.idle_connections as u64, - now, - ))); - } - - append_db_pool_stats(&mut metrics, context, now); - - append_dynamic_stats(&mut metrics, context, now) + let metrics = context + .get_metrics(payload.duration) .error(AppErrorKind::StatsCollectionFailed)?; - { - let conn = context.get_conn()?; - - append_janus_stats(&mut metrics, &conn, now) - .error(AppErrorKind::StatsCollectionFailed)?; - } - let metrics2 = metrics .clone() .into_iter() @@ -132,101 +65,3 @@ impl EventHandler for PullHandler { } } } - -fn append_db_pool_stats(metrics: &mut Vec, context: &C, now: DateTime) { - if let Some(db_pool_stats) = context.db_pool_stats() { - let stats = db_pool_stats.get_stats(); - - let m = [ - Metric::DbPoolCheckinAverage(MetricValue::new(stats.avg_checkin, now)), - Metric::MaxDbPoolCheckin(MetricValue::new(stats.max_checkin, now)), - Metric::DbPoolCheckoutAverage(MetricValue::new(stats.avg_checkout, now)), - Metric::MaxDbPoolCheckout(MetricValue::new(stats.max_checkout, now)), - Metric::DbPoolTimeoutAverage(MetricValue::new(stats.avg_timeout, now)), - Metric::MaxDbPoolTimeout(MetricValue::new(stats.max_timeout, now)), - Metric::DbPoolReleaseAverage(MetricValue::new(stats.avg_release, now)), - Metric::MaxDbPoolRelease(MetricValue::new(stats.max_release, now)), - ]; - - metrics.extend_from_slice(&m); - } -} - -fn append_dynamic_stats( - metrics: &mut Vec, - context: &C, - now: DateTime, -) -> anyhow::Result<()> { - if let Some(dynamic_stats) = context.dynamic_stats() { - for (key, value) in dynamic_stats.flush()? { - metrics.push(Metric::Dynamic { - key, - value: MetricValue::new(value as u64, now), - }); - } - } - - Ok(()) -} - -fn append_janus_stats( - metrics: &mut Vec, - conn: &PgConnection, - now: DateTime, -) -> anyhow::Result<()> { - use anyhow::Context; - - // The number of online janus backends. - let online_backends_count = - db::janus_backend::count(&conn).context("Failed to get janus backends count")?; - - let value = MetricValue::new(online_backends_count as u64, now); - metrics.push(Metric::OnlineJanusBackendsCount(value)); - - // Total capacity of online janus backends. - let total_capacity = db::janus_backend::total_capacity(&conn) - .context("Failed to get janus backends total capacity")?; - - let value = MetricValue::new(total_capacity as u64, now); - metrics.push(Metric::JanusBackendTotalCapacity(value)); - - // The number of agents connect to an RTC. - let connected_agents_count = db::agent::CountQuery::new() - .status(db::agent::Status::Connected) - .execute(&conn) - .context("Failed to get connected agents count")?; - - let value = MetricValue::new(connected_agents_count as u64, now); - metrics.push(Metric::ConnectedAgentsCount(value)); - - Ok(()) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[derive(Deserialize)] - struct DynamicMetric { - metric: String, - value: u64, - timestamp: DateTime, - } - - #[test] - fn serialize_dynamic_metric() { - let now = Utc::now(); - - let json = serde_json::json!(Metric::Dynamic { - key: String::from("example"), - value: MetricValue::new(123, now), - }); - - let parsed: DynamicMetric = - serde_json::from_str(&json.to_string()).expect("Failed to parse json"); - - assert_eq!(&parsed.metric, "apps.conference.example_total"); - assert_eq!(parsed.value, 123); - assert_eq!(parsed.timestamp, now); - } -} diff --git a/src/app/metrics/collector.rs b/src/app/metrics/collector.rs new file mode 100644 index 00000000..8b9d72b3 --- /dev/null +++ b/src/app/metrics/collector.rs @@ -0,0 +1,222 @@ +use chrono::{DateTime, Utc}; + +use crate::app::context::GlobalContext; +use crate::app::metrics::{Metric, MetricKey, Tags}; + +pub(crate) struct Collector<'a, C: GlobalContext> { + context: &'a C, + duration: u64, +} + +impl<'a, C: GlobalContext> Collector<'a, C> { + pub(crate) fn new(context: &'a C, duration: u64) -> Self { + Self { context, duration } + } + + pub(crate) fn get(&self) -> anyhow::Result> { + let now = Utc::now(); + let mut metrics = vec![]; + + append_mqtt_stats(&mut metrics, self.context, now, self.duration)?; + append_internal_stats(&mut metrics, self.context, now); + append_redis_pool_metrics(&mut metrics, self.context, now); + append_dynamic_stats(&mut metrics, self.context, now)?; + + append_janus_stats(&mut metrics, self.context, now)?; + {} + + Ok(metrics) + } +} + +fn append_mqtt_stats( + metrics: &mut Vec, + context: &impl GlobalContext, + now: DateTime, + duration: u64, +) -> anyhow::Result<()> { + if let Some(qc) = context.queue_counter() { + let stats = qc + .get_stats(duration) + .map_err(|err| anyhow!(err).context("Failed to get stats"))?; + + stats.into_iter().for_each(|(tags, value)| { + let tags = Tags::build_queues_tags(crate::APP_VERSION, context.agent_id(), tags); + + let m = [ + Metric::new( + MetricKey::IncomingQueueRequests, + value.incoming_requests, + now, + tags.clone(), + ), + Metric::new( + MetricKey::IncomingQueueResponses, + value.incoming_responses, + now, + tags.clone(), + ), + Metric::new( + MetricKey::IncomingQueueEvents, + value.incoming_events, + now, + tags.clone(), + ), + Metric::new( + MetricKey::OutgoingQueueRequests, + value.outgoing_requests, + now, + tags.clone(), + ), + Metric::new( + MetricKey::OutgoingQueueResponses, + value.outgoing_responses, + now, + tags.clone(), + ), + Metric::new( + MetricKey::OutgoingQueueEvents, + value.outgoing_events, + now, + tags, + ), + ]; + + metrics.extend_from_slice(&m); + }); + } + + Ok(()) +} + +fn append_internal_stats( + metrics: &mut Vec, + context: &impl GlobalContext, + now: DateTime, +) { + let tags = Tags::build_internal_tags(crate::APP_VERSION, context.agent_id()); + let state = context.db().state(); + + metrics.extend_from_slice(&[ + Metric::new( + MetricKey::DbConnections, + state.connections, + now, + tags.clone(), + ), + Metric::new( + MetricKey::IdleDbConnections, + state.idle_connections, + now, + tags, + ), + ]) +} + +fn append_redis_pool_metrics( + metrics: &mut Vec, + context: &impl GlobalContext, + now: DateTime, +) { + if let Some(pool) = context.redis_pool() { + let state = pool.state(); + let tags = Tags::build_internal_tags(crate::APP_VERSION, context.agent_id()); + + metrics.extend_from_slice(&[ + Metric::new( + MetricKey::RedisConnections, + state.connections, + now, + tags.clone(), + ), + Metric::new( + MetricKey::IdleRedisConnections, + state.idle_connections, + now, + tags, + ), + ]); + } +} + +fn append_dynamic_stats( + metrics: &mut Vec, + context: &impl GlobalContext, + now: DateTime, +) -> anyhow::Result<()> { + if let Some(dynamic_stats) = context.dynamic_stats() { + for (key, value) in dynamic_stats.flush()? { + metrics.push(Metric::new( + MetricKey::Dynamic(key), + value, + now, + Tags::Empty, + )); + } + } + + Ok(()) +} + +fn append_janus_stats( + metrics: &mut Vec, + context: &impl GlobalContext, + now: DateTime, +) -> anyhow::Result<()> { + use crate::db::agent; + use anyhow::Context; + let conn = context.get_conn().unwrap(); + + let tags = Tags::build_internal_tags(crate::APP_VERSION, context.agent_id()); + + // The number of online janus backends. + let online_backends_count = + crate::db::janus_backend::count(&conn).context("Failed to get janus backends count")?; + + metrics.push(Metric::new( + MetricKey::OnlineJanusBackendsCount, + online_backends_count, + now, + tags.clone(), + )); + + // Total capacity of online janus backends. + let total_capacity = crate::db::janus_backend::total_capacity(&conn) + .context("Failed to get janus backends total capacity")?; + + metrics.push(Metric::new( + MetricKey::JanusBackendTotalCapacity, + total_capacity, + now, + tags.clone(), + )); + + // The number of agents connect to an RTC. + let connected_agents_count = agent::CountQuery::new() + .status(agent::Status::Connected) + .execute(&conn) + .context("Failed to get connected agents count")?; + + metrics.push(Metric::new( + MetricKey::ConnectedAgentsCount, + connected_agents_count, + now, + tags, + )); + + let backend_load = crate::db::janus_backend::reserve_load_for_each_backend(&conn) + .context("Failed to get janus backends reserve load")? + .into_iter() + .map(|load_row| { + let tags = Tags::build_janus_tags( + crate::APP_VERSION, + context.agent_id(), + &load_row.backend_id, + ); + Metric::new(MetricKey::JanusBackendReserveLoad, load_row.load, now, tags) + }); + + metrics.extend(backend_load); + + Ok(()) +} diff --git a/src/app/metrics/metric.rs b/src/app/metrics/metric.rs index 72a29fc0..69521f21 100644 --- a/src/app/metrics/metric.rs +++ b/src/app/metrics/metric.rs @@ -1,179 +1,286 @@ use chrono::{serde::ts_seconds, DateTime, Utc}; use serde_derive::Serialize; +use svc_agent::{mqtt::ExtraTags, AgentId, Authenticable}; -#[derive(Serialize, Copy, Clone)] -pub(crate) struct MetricValue { - value: T, +#[derive(Serialize, Clone)] +pub(crate) struct Metric { + value: serde_json::Value, + #[serde(flatten)] + metric: MetricKey, #[serde(with = "ts_seconds")] timestamp: DateTime, + tags: Tags, } -impl MetricValue { - pub fn new(value: T, timestamp: DateTime) -> Self { - Self { value, timestamp } +impl Metric { + pub fn new( + metric: MetricKey, + value: impl serde::Serialize, + timestamp: DateTime, + tags: Tags, + ) -> Self { + Self { + metric, + timestamp, + tags, + value: serde_json::to_value(value).unwrap_or(serde_json::value::Value::Null), + } } } -#[derive(Serialize, Clone)] +#[derive(Serialize, Debug, Clone)] +pub(crate) struct Metric2 { + value: serde_json::Value, + #[serde(flatten)] + metric: MetricKey2, + #[serde(with = "ts_seconds")] + timestamp: DateTime, + tags: Tags, +} + +impl Metric2 { + pub fn tags(&self) -> &Tags { + &self.tags + } + + pub fn key(&self) -> &MetricKey2 { + &self.metric + } + + pub fn value(&self) -> &serde_json::Value { + &self.value + } +} + +#[derive(Debug, Clone, Serialize, PartialEq)] +#[serde(untagged)] +pub enum Tags { + Internal { + version: String, + agent_label: String, + account_label: String, + account_audience: String, + }, + Queues { + version: String, + agent_label: String, + account_label: String, + account_audience: String, + #[serde(flatten)] + tags: ExtraTags, + }, + Janus { + version: String, + agent_label: String, + account_label: String, + account_audience: String, + backend_label: String, + }, + Empty, +} + +impl Tags { + pub fn build_internal_tags(version: &str, agent_id: &AgentId) -> Self { + Tags::Internal { + version: version.to_owned(), + agent_label: agent_id.label().to_owned(), + account_label: agent_id.as_account_id().label().to_owned(), + account_audience: agent_id.as_account_id().audience().to_owned(), + } + } + + pub fn build_queues_tags(version: &str, agent_id: &AgentId, tags: ExtraTags) -> Self { + Tags::Queues { + version: version.to_owned(), + agent_label: agent_id.label().to_owned(), + account_label: agent_id.as_account_id().label().to_owned(), + account_audience: agent_id.as_account_id().audience().to_owned(), + tags, + } + } + + pub fn build_janus_tags(version: &str, agent_id: &AgentId, janus_id: &AgentId) -> Self { + Tags::Janus { + version: version.to_owned(), + agent_label: agent_id.label().to_owned(), + account_label: agent_id.as_account_id().label().to_owned(), + account_audience: agent_id.as_account_id().audience().to_owned(), + backend_label: janus_id.label().to_owned(), + } + } +} + +#[derive(Serialize, Clone, Debug)] #[serde(tag = "metric")] -pub(crate) enum Metric { +pub(crate) enum MetricKey { #[serde(rename(serialize = "apps.conference.incoming_requests_total"))] - IncomingQueueRequests(MetricValue), + IncomingQueueRequests, #[serde(rename(serialize = "apps.conference.incoming_responses_total"))] - IncomingQueueResponses(MetricValue), + IncomingQueueResponses, #[serde(rename(serialize = "apps.conference.incoming_events_total"))] - IncomingQueueEvents(MetricValue), + IncomingQueueEvents, #[serde(rename(serialize = "apps.conference.outgoing_requests_total"))] - OutgoingQueueRequests(MetricValue), + OutgoingQueueRequests, #[serde(rename(serialize = "apps.conference.outgoing_responses_total"))] - OutgoingQueueResponses(MetricValue), + OutgoingQueueResponses, #[serde(rename(serialize = "apps.conference.outgoing_events_total"))] - OutgoingQueueEvents(MetricValue), + OutgoingQueueEvents, #[serde(rename(serialize = "apps.conference.db_connections_total"))] - DbConnections(MetricValue), + DbConnections, #[serde(rename(serialize = "apps.conference.idle_db_connections_total"))] - IdleDbConnections(MetricValue), + IdleDbConnections, #[serde(rename(serialize = "apps.conference.redis_connections_total"))] - RedisConnections(MetricValue), + RedisConnections, #[serde(rename(serialize = "apps.conference.idle_redis_connections_total"))] - IdleRedisConnections(MetricValue), - #[serde(rename(serialize = "apps.conference.db_pool_checkin_average_total"))] - DbPoolCheckinAverage(MetricValue), - #[serde(rename(serialize = "apps.conference.max_db_pool_checkin_total"))] - MaxDbPoolCheckin(MetricValue), - #[serde(rename(serialize = "apps.conference.db_pool_checkout_average_total"))] - DbPoolCheckoutAverage(MetricValue), - #[serde(rename(serialize = "apps.conference.max_db_pool_checkout_total"))] - MaxDbPoolCheckout(MetricValue), - #[serde(rename(serialize = "apps.conference.db_pool_release_average_total"))] - DbPoolReleaseAverage(MetricValue), - #[serde(rename(serialize = "apps.conference.max_db_pool_release_total"))] - MaxDbPoolRelease(MetricValue), - #[serde(rename(serialize = "apps.conference.db_pool_timeout_average_total"))] - DbPoolTimeoutAverage(MetricValue), - #[serde(rename(serialize = "apps.conference.max_db_pool_timeout_total"))] - MaxDbPoolTimeout(MetricValue), + IdleRedisConnections, #[serde(rename(serialize = "apps.conference.online_janus_backends_total"))] - OnlineJanusBackendsCount(MetricValue), + OnlineJanusBackendsCount, #[serde(rename(serialize = "apps.conference.janus_backends_capacity_total"))] - JanusBackendTotalCapacity(MetricValue), + JanusBackendTotalCapacity, #[serde(rename(serialize = "apps.conference.connected_agents_total"))] - ConnectedAgentsCount(MetricValue), + ConnectedAgentsCount, + #[serde(rename(serialize = "apps.conference.janus_backend_reserve_load"))] + JanusBackendReserveLoad, #[serde(serialize_with = "serialize_dynamic_metric")] - Dynamic { - key: String, - value: MetricValue, - }, + Dynamic(String), } -#[derive(Serialize, Clone)] + +#[derive(Serialize, Clone, Debug)] #[serde(tag = "metric")] -pub(crate) enum Metric2 { +pub(crate) enum MetricKey2 { #[serde(rename(serialize = "incoming_requests_total"))] - IncomingQueueRequests(MetricValue), + IncomingQueueRequests, #[serde(rename(serialize = "incoming_responses_total"))] - IncomingQueueResponses(MetricValue), + IncomingQueueResponses, #[serde(rename(serialize = "incoming_events_total"))] - IncomingQueueEvents(MetricValue), + IncomingQueueEvents, #[serde(rename(serialize = "outgoing_requests_total"))] - OutgoingQueueRequests(MetricValue), + OutgoingQueueRequests, #[serde(rename(serialize = "outgoing_responses_total"))] - OutgoingQueueResponses(MetricValue), + OutgoingQueueResponses, #[serde(rename(serialize = "outgoing_events_total"))] - OutgoingQueueEvents(MetricValue), + OutgoingQueueEvents, #[serde(rename(serialize = "db_connections_total"))] - DbConnections(MetricValue), + DbConnections, #[serde(rename(serialize = "idle_db_connections_total"))] - IdleDbConnections(MetricValue), + IdleDbConnections, #[serde(rename(serialize = "redis_connections_total"))] - RedisConnections(MetricValue), + RedisConnections, #[serde(rename(serialize = "idle_redis_connections_total"))] - IdleRedisConnections(MetricValue), - #[serde(rename(serialize = "db_pool_checkin_average_total"))] - DbPoolCheckinAverage(MetricValue), - #[serde(rename(serialize = "max_db_pool_checkin_total"))] - MaxDbPoolCheckin(MetricValue), - #[serde(rename(serialize = "db_pool_checkout_average_total"))] - DbPoolCheckoutAverage(MetricValue), - #[serde(rename(serialize = "max_db_pool_checkout_total"))] - MaxDbPoolCheckout(MetricValue), - #[serde(rename(serialize = "db_pool_release_average_total"))] - DbPoolReleaseAverage(MetricValue), - #[serde(rename(serialize = "max_db_pool_release_total"))] - MaxDbPoolRelease(MetricValue), - #[serde(rename(serialize = "db_pool_timeout_average_total"))] - DbPoolTimeoutAverage(MetricValue), - #[serde(rename(serialize = "max_db_pool_timeout_total"))] - MaxDbPoolTimeout(MetricValue), + IdleRedisConnections, #[serde(rename(serialize = "online_janus_backends_total"))] - OnlineJanusBackendsCount(MetricValue), + OnlineJanusBackendsCount, #[serde(rename(serialize = "janus_backends_capacity_total"))] - JanusBackendTotalCapacity(MetricValue), + JanusBackendTotalCapacity, #[serde(rename(serialize = "connected_agents_total"))] - ConnectedAgentsCount(MetricValue), - #[serde(serialize_with = "serialize_dynamic_metric")] - Dynamic { - key: String, - value: MetricValue, - }, + ConnectedAgentsCount, + #[serde(rename(serialize = "janus_backend_reserve_load_total"))] + JanusBackendReserveLoad, + #[serde(serialize_with = "serialize_dynamic_metric2")] + Dynamic(String), +} + +impl From for MetricKey2 { + fn from(m: MetricKey) -> Self { + match m { + MetricKey::IncomingQueueRequests => MetricKey2::IncomingQueueRequests, + MetricKey::IncomingQueueResponses => MetricKey2::IncomingQueueResponses, + MetricKey::IncomingQueueEvents => MetricKey2::IncomingQueueEvents, + MetricKey::OutgoingQueueRequests => MetricKey2::OutgoingQueueRequests, + MetricKey::OutgoingQueueResponses => MetricKey2::OutgoingQueueResponses, + MetricKey::OutgoingQueueEvents => MetricKey2::OutgoingQueueEvents, + MetricKey::DbConnections => MetricKey2::DbConnections, + MetricKey::IdleDbConnections => MetricKey2::IdleDbConnections, + MetricKey::RedisConnections => MetricKey2::RedisConnections, + MetricKey::IdleRedisConnections => MetricKey2::IdleRedisConnections, + MetricKey::OnlineJanusBackendsCount => MetricKey2::OnlineJanusBackendsCount, + MetricKey::JanusBackendTotalCapacity => MetricKey2::JanusBackendTotalCapacity, + MetricKey::ConnectedAgentsCount => MetricKey2::ConnectedAgentsCount, + MetricKey::Dynamic(key) => MetricKey2::Dynamic(key), + MetricKey::JanusBackendReserveLoad => MetricKey2::JanusBackendReserveLoad, + } + } +} + +impl std::fmt::Display for MetricKey2 { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + MetricKey2::IncomingQueueRequests => write!(f, "incoming_queue_requests_total"), + MetricKey2::IncomingQueueResponses => write!(f, "incoming_queue_responses_total"), + MetricKey2::IncomingQueueEvents => write!(f, "incoming_queue_events_total"), + MetricKey2::OutgoingQueueRequests => write!(f, "outgoing_queue_responses_total"), + MetricKey2::OutgoingQueueResponses => write!(f, "outgoing_queue_responses_total"), + MetricKey2::OutgoingQueueEvents => write!(f, "outgoing_queue_events_total"), + MetricKey2::DbConnections => write!(f, "db_connections_total"), + MetricKey2::IdleDbConnections => write!(f, "idle_db_connections_total"), + MetricKey2::RedisConnections => write!(f, "redis_connections_total"), + MetricKey2::IdleRedisConnections => write!(f, "idle_redis_connections_total"), + MetricKey2::OnlineJanusBackendsCount => write!(f, "online_janus_backends_total"), + MetricKey2::JanusBackendTotalCapacity => write!(f, "janus_backends_capacity_total"), + MetricKey2::ConnectedAgentsCount => write!(f, "connected_agents_total"), + MetricKey2::JanusBackendReserveLoad => write!(f, "janus_backend_reserve_load_total"), + MetricKey2::Dynamic(key) => write!(f, "{}_total", key), + } + } } impl From for Metric2 { fn from(m: Metric) -> Self { - match m { - Metric::IncomingQueueRequests(v) => Metric2::IncomingQueueRequests(v), - Metric::IncomingQueueResponses(v) => Metric2::IncomingQueueResponses(v), - Metric::IncomingQueueEvents(v) => Metric2::IncomingQueueEvents(v), - Metric::OutgoingQueueRequests(v) => Metric2::OutgoingQueueRequests(v), - Metric::OutgoingQueueResponses(v) => Metric2::OutgoingQueueResponses(v), - Metric::OutgoingQueueEvents(v) => Metric2::OutgoingQueueEvents(v), - Metric::DbConnections(v) => Metric2::DbConnections(v), - Metric::IdleDbConnections(v) => Metric2::IdleDbConnections(v), - Metric::RedisConnections(v) => Metric2::RedisConnections(v), - Metric::IdleRedisConnections(v) => Metric2::IdleRedisConnections(v), - Metric::DbPoolCheckinAverage(v) => Metric2::DbPoolCheckinAverage(v), - Metric::MaxDbPoolCheckin(v) => Metric2::MaxDbPoolCheckin(v), - Metric::DbPoolCheckoutAverage(v) => Metric2::DbPoolCheckoutAverage(v), - Metric::MaxDbPoolCheckout(v) => Metric2::MaxDbPoolCheckout(v), - Metric::DbPoolReleaseAverage(v) => Metric2::DbPoolReleaseAverage(v), - Metric::MaxDbPoolRelease(v) => Metric2::MaxDbPoolRelease(v), - Metric::DbPoolTimeoutAverage(v) => Metric2::DbPoolTimeoutAverage(v), - Metric::MaxDbPoolTimeout(v) => Metric2::MaxDbPoolTimeout(v), - Metric::OnlineJanusBackendsCount(v) => Metric2::OnlineJanusBackendsCount(v), - Metric::JanusBackendTotalCapacity(v) => Metric2::JanusBackendTotalCapacity(v), - Metric::ConnectedAgentsCount(v) => Metric2::ConnectedAgentsCount(v), - Metric::Dynamic { key, value } => Metric2::Dynamic { key, value }, + let Metric { + metric, + value, + timestamp, + tags, + } = m; + Self { + value, + timestamp, + tags, + metric: metric.into(), } } } -fn serialize_dynamic_metric( - key: K, - metric_value: &MetricValue, +fn serialize_dynamic_metric( + metric_key: &str, + serializer: S, +) -> std::result::Result +where + S: serde::ser::Serializer, +{ + use serde::ser::SerializeMap; + + let mut map = serializer.serialize_map(Some(1))?; + map.serialize_entry("metric", &format!("apps.conference.{}_total", metric_key))?; + map.end() +} + +fn serialize_dynamic_metric2( + metric_key: &str, serializer: S, ) -> std::result::Result where - K: std::fmt::Display, - V: serde::Serialize, S: serde::ser::Serializer, { use serde::ser::SerializeMap; - let mut map = serializer.serialize_map(Some(3))?; - map.serialize_entry("metric", &format!("apps.conference.{}_total", key))?; - map.serialize_entry("value", &metric_value.value)?; - map.serialize_entry("timestamp", &metric_value.timestamp)?; + let mut map = serializer.serialize_map(Some(1))?; + map.serialize_entry("metric", &format!("{}_total", metric_key))?; map.end() } #[cfg(test)] mod tests { use super::*; + use chrono::offset::TimeZone; use serde_derive::Deserialize; + use svc_agent::AccountId; #[derive(Deserialize)] struct DynamicMetric { metric: String, value: u64, + #[serde(with = "ts_seconds")] timestamp: DateTime, } @@ -181,16 +288,18 @@ mod tests { fn serialize_dynamic_metric() { let now = Utc::now(); - let json = serde_json::json!(Metric::Dynamic { - key: String::from("example"), - value: MetricValue::new(123, now), - }); + let json = serde_json::json!(Metric::new( + MetricKey::Dynamic("example".into()), + 123, + now, + Tags::build_internal_tags("whatever", &AgentId::new("q", AccountId::new("foo", "bar"))) + )); let parsed: DynamicMetric = serde_json::from_str(&json.to_string()).expect("Failed to parse json"); assert_eq!(&parsed.metric, "apps.conference.example_total"); assert_eq!(parsed.value, 123); - assert_eq!(parsed.timestamp, now); + assert_eq!(parsed.timestamp, Utc.timestamp(now.timestamp(), 0)); } } diff --git a/src/app/metrics/mod.rs b/src/app/metrics/mod.rs index e630c8e8..d70445d6 100644 --- a/src/app/metrics/mod.rs +++ b/src/app/metrics/mod.rs @@ -1,7 +1,9 @@ -pub(crate) use db_pool_stats_collector::DbPoolStatsCollector; +pub(crate) use collector::Collector; pub(crate) use dynamic_stats_collector::DynamicStatsCollector; -pub(crate) use metric::{Metric, Metric2, MetricValue}; +pub(crate) use metric::{Metric, Metric2, MetricKey, Tags}; +pub(crate) use stats_route::StatsRoute; -mod db_pool_stats_collector; +mod collector; mod dynamic_stats_collector; mod metric; +mod stats_route; diff --git a/src/app/metrics/stats_route.rs b/src/app/metrics/stats_route.rs new file mode 100644 index 00000000..37fb6f82 --- /dev/null +++ b/src/app/metrics/stats_route.rs @@ -0,0 +1,171 @@ +use std::sync::Arc; + +use anyhow::{Context as AnyhowContext, Result}; +use async_std::stream::StreamExt; +use async_std::sync::Sender; +use chrono::{serde::ts_seconds, DateTime, Utc}; +use serde_derive::Deserialize; + +use crate::app::metrics::Metric2; +use crate::app::{context::GlobalContext, MessageHandler}; + +#[derive(Clone)] +pub(crate) struct StatsRoute { + message_handler: Arc>, +} + +#[derive(Debug, Clone)] +struct StatsHandle { + tx: async_std::sync::Sender, +} + +enum StatsRouteCommand { + GetStats(Sender>), +} + +impl StatsRoute { + pub fn start(config: crate::app::config::Config, message_handler: Arc>) { + if let Some(metrics_conf) = config.metrics { + let (tx, mut rx) = async_std::sync::channel(1000); + let handle = StatsHandle { tx }; + + let route = Self { message_handler }; + + async_std::task::spawn(async move { + loop { + if let Some(x) = rx.next().await { + match x { + StatsRouteCommand::GetStats(chan) => { + chan.send(route.get_stats()).await; + } + } + } + } + }); + + std::thread::Builder::new() + .name(String::from("tide-metrics-server")) + .spawn(move || { + warn!( + crate::LOG, + "StatsRoute listening on http://{}", metrics_conf.http.bind_address + ); + + let mut app = tide::with_state(handle); + app.at("/metrics") + .get(|req: tide::Request| async move { + match req.state().get_stats().await { + Ok(Ok(text)) => { + let mut res = tide::Response::new(200); + res.set_body(tide::Body::from_string(text)); + Ok(res) + } + Ok(Err(e)) => { + error!(crate::LOG, "Something went wrong: {:?}", e); + let mut res = tide::Response::new(500); + res.set_body(tide::Body::from_string( + "Something went wrong".into(), + )); + Ok(res) + } + Err(e) => { + error!(crate::LOG, "Something went wrong: {:?}", e); + let mut res = tide::Response::new(500); + res.set_body(tide::Body::from_string( + "Something went wrong".into(), + )); + Ok(res) + } + } + }); + + if let Err(e) = + async_std::task::block_on(app.listen(metrics_conf.http.bind_address)) + { + error!(crate::LOG, "Tide future completed with error: {:?}", e); + } + }) + .expect("Failed to spawn tide-metrics-server thread"); + } + } + + fn get_stats(&self) -> Result { + let mut acc = String::new(); + + let metrics = self + .message_handler + .global_context() + .get_metrics(5) + .context("Failed to get metrics")?; + + for metric in metrics { + let metric: Metric2 = metric.into(); + + // metrics with Dynamic key have Empty tag so we skip them + if *metric.tags() == super::metric::Tags::Empty { + continue; + } + + match serde_json::to_value(metric.tags()) { + Ok(tags) => { + if let Some(tags) = tags.as_object() { + let tags_acc = tags.iter().filter_map(|(key, val)| { + let val = if val.is_null() { + Some("") + } else if val.is_string() { + val.as_str() + } else { + warn!( + crate::LOG, + "StatsRoute: improper tag value, expected string or null, metric: {:?}", + metric + ); + + None + }; + val.map(|v| format!("{}=\"{}\"", key, v)) + }).collect::>().join(", "); + + acc.push_str(&format!( + "{}{{{}}} {}\n", + metric.key(), + tags_acc, + metric.value() + )); + } else { + warn!( + crate::LOG, + "StatsRoute: failed to parse metric tags, metric: {:?}", metric + ); + } + } + Err(e) => { + warn!( + crate::LOG, + "Conversion from Metric to MetricHelper failed, reason = {:?}", e + ); + } + } + } + + Ok(acc) + } +} + +#[derive(Deserialize, Debug)] +struct MetricHelper { + pub value: serde_json::Value, + #[serde(rename = "metric")] + pub key: String, + #[serde(with = "ts_seconds")] + pub timestamp: DateTime, + pub tags: serde_json::Value, +} + +impl StatsHandle { + pub async fn get_stats(&self) -> Result> { + let (tx, rx) = async_std::sync::channel(1); + self.tx.send(StatsRouteCommand::GetStats(tx)).await; + rx.recv().await.context("Stats handle recv error") + } +} diff --git a/src/app/mod.rs b/src/app/mod.rs index efcf4794..144bde06 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -21,7 +21,7 @@ use svc_error::{extension::sentry, Error as SvcError}; use crate::app::context::GlobalContext; use crate::app::error::{Error as AppError, ErrorKind as AppErrorKind}; -use crate::app::metrics::DbPoolStatsCollector; +use crate::app::metrics::StatsRoute; use crate::backend::janus::Client as JanusClient; use crate::config::{self, Config, KruonisConfig}; use crate::db::ConnectionPool; @@ -36,7 +36,6 @@ pub(crate) async fn run( db: &ConnectionPool, redis_pool: Option, authz_cache: Option, - db_pool_stats: DbPoolStatsCollector, ) -> Result<()> { // Config let config = config::load().expect("Failed to load config"); @@ -95,8 +94,7 @@ pub(crate) async fn run( JanusClient::start(&config.backend, agent_id)?, janus_topics, ) - .add_queue_counter(agent.get_queue_counter()) - .db_pool_stats(db_pool_stats); + .add_queue_counter(agent.get_queue_counter()); let context = match redis_pool { Some(pool) => context.add_redis_pool(pool), @@ -105,6 +103,7 @@ pub(crate) async fn run( // Message handler let message_handler = Arc::new(MessageHandler::new(agent.clone(), context)); + StatsRoute::start(config, message_handler.clone()); // Message loop let term_check_period = Duration::from_secs(1); diff --git a/src/config.rs b/src/config.rs index e76aaa02..105578d7 100644 --- a/src/config.rs +++ b/src/config.rs @@ -18,6 +18,7 @@ pub(crate) struct Config { pub(crate) telemetry: TelemetryConfig, #[serde(default)] pub(crate) kruonis: KruonisConfig, + pub(crate) metrics: Option, } #[derive(Clone, Debug, Deserialize)] @@ -52,3 +53,13 @@ pub(crate) struct TelemetryConfig { pub(crate) struct KruonisConfig { pub(crate) id: Option, } + +#[derive(Clone, Debug, Deserialize)] +pub struct MetricsConfig { + pub http: MetricsHttpConfig, +} + +#[derive(Clone, Debug, Deserialize)] +pub struct MetricsHttpConfig { + pub bind_address: std::net::SocketAddr, +} diff --git a/src/db/janus_backend.rs b/src/db/janus_backend.rs index 5d332662..ff6b94dc 100644 --- a/src/db/janus_backend.rs +++ b/src/db/janus_backend.rs @@ -407,7 +407,7 @@ pub(crate) fn free_capacity(rtc_id: Uuid, conn: &PgConnection) -> Result Result { +pub(crate) fn total_capacity(conn: &PgConnection) -> Result { use diesel::dsl::sum; use diesel::prelude::*; @@ -417,7 +417,7 @@ pub(crate) fn count(conn: &PgConnection) -> Result { .map(|v| v.unwrap_or(0)) } -pub(crate) fn total_capacity(conn: &PgConnection) -> Result { +pub(crate) fn count(conn: &PgConnection) -> Result { use diesel::dsl::count; use diesel::prelude::*; @@ -425,3 +425,56 @@ pub(crate) fn total_capacity(conn: &PgConnection) -> Result { .select(count(janus_backend::id)) .get_result(conn) } + +#[derive(QueryableByName)] +pub(crate) struct ReserveLoadQueryLoad { + #[sql_type = "svc_agent::sql::Agent_id"] + pub backend_id: AgentId, + #[sql_type = "diesel::sql_types::Integer"] + pub load: i32, +} + +pub(crate) fn reserve_load_for_each_backend( + conn: &PgConnection, +) -> Result, Error> { + use diesel::prelude::*; + + diesel::sql_query(LOAD_FOR_EACH_BACKEND).get_results(conn) +} + +const LOAD_FOR_EACH_BACKEND: &str = r#" +WITH + room_load AS ( + SELECT + room_id, + COUNT(id) AS taken + FROM agent + WHERE status = 'connected' + GROUP BY room_id + ), + active_room AS ( + SELECT * + FROM room + WHERE backend = 'janus' + AND UPPER(time) BETWEEN NOW() AND NOW() + INTERVAL '1 day' + ) +SELECT + backend_id, + SUM(reserve) AS load +FROM ( + SELECT DISTINCT ON(backend_id, room_id) + rec.backend_id, + rtc.room_id, + COALESCE(rl.taken, 0) AS taken, + COALESCE(ar.reserve, 0) AS reserve + FROM recording AS rec + INNER JOIN rtc + ON rtc.id = rec.rtc_id + LEFT JOIN active_room AS ar + ON ar.id = rtc.room_id + LEFT JOIN room_load AS rl + ON rl.room_id = rtc.room_id + WHERE rec.status = 'in_progress' +) AS sub +GROUP BY backend_id +"#; diff --git a/src/db/mod.rs b/src/db/mod.rs index 122223be..3577093f 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -1,11 +1,8 @@ use diesel::pg::PgConnection; -use diesel::r2d2::event::HandleEvent; use diesel::r2d2::{ConnectionManager, Pool}; use std::sync::Arc; use std::time::Duration; -use crate::app::metrics::DbPoolStatsCollector; - pub(crate) type ConnectionPool = Arc>>; pub(crate) fn create_pool( @@ -13,26 +10,18 @@ pub(crate) fn create_pool( size: u32, idle_size: Option, timeout: u64, - enable_stats: bool, -) -> (ConnectionPool, DbPoolStatsCollector) { +) -> ConnectionPool { let manager = ConnectionManager::::new(url); - let (collector, transmitter) = DbPoolStatsCollector::new(); let builder = Pool::builder() .max_size(size) .min_idle(idle_size) .connection_timeout(Duration::from_secs(timeout)); - let builder = if enable_stats { - builder.event_handler(Box::new(transmitter) as Box) - } else { - builder - }; - let pool = builder .build(manager) .expect("Error creating a database pool"); - (Arc::new(pool), collector) + Arc::new(pool) } pub mod sql { diff --git a/src/main.rs b/src/main.rs index fcd6e995..03a936a3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,9 +24,11 @@ lazy_static! { }; } +const APP_VERSION: &str = env!("CARGO_PKG_VERSION"); + #[async_std::main] async fn main() -> Result<()> { - let (db, db_pool_stats) = { + let db = { let url = var("DATABASE_URL").expect("DATABASE_URL must be specified"); let size = var("DATABASE_POOL_SIZE") .map(|val| { @@ -49,7 +51,7 @@ async fn main() -> Result<()> { }) .unwrap_or_else(|_| 5); - crate::db::create_pool(&url, size, idle_size, timeout, true) + crate::db::create_pool(&url, size, idle_size, timeout) }; let (redis_pool, authz_cache) = if let Some("1") = var("CACHE_ENABLED").ok().as_deref() { @@ -83,7 +85,7 @@ async fn main() -> Result<()> { (None, None) }; - app::run(&db, redis_pool, authz_cache, db_pool_stats).await + app::run(&db, redis_pool, authz_cache).await } mod app; diff --git a/src/test_helpers/context.rs b/src/test_helpers/context.rs index 476e0d9f..dd456452 100644 --- a/src/test_helpers/context.rs +++ b/src/test_helpers/context.rs @@ -8,7 +8,7 @@ use svc_authz::cache::ConnectionPool as RedisConnectionPool; use svc_authz::ClientMap as Authz; use crate::app::context::{Context, GlobalContext, JanusTopics, MessageContext}; -use crate::app::metrics::{DbPoolStatsCollector, DynamicStatsCollector}; +use crate::app::metrics::DynamicStatsCollector; use crate::backend::janus::Client as JanusClient; use crate::config::Config; use crate::db::ConnectionPool as Db; @@ -116,13 +116,13 @@ impl GlobalContext for TestContext { &None } - fn db_pool_stats(&self) -> &Option { - &None - } - fn dynamic_stats(&self) -> Option<&DynamicStatsCollector> { None } + + fn get_metrics(&self, _duration: u64) -> anyhow::Result> { + Ok(vec![]) + } } impl MessageContext for TestContext { diff --git a/src/test_helpers/db.rs b/src/test_helpers/db.rs index 6cea7016..3ddc7203 100644 --- a/src/test_helpers/db.rs +++ b/src/test_helpers/db.rs @@ -12,7 +12,7 @@ pub(crate) struct TestDb { impl TestDb { pub(crate) fn new() -> Self { let url = var("DATABASE_URL").expect("DATABASE_URL must be specified"); - let (connection_pool, _db_pool_stats) = create_pool(&url, 1, None, TIMEOUT, false); + let connection_pool = create_pool(&url, 1, None, TIMEOUT); let conn = connection_pool .get()