From fe5863c2c8932147a3d8d1c9ee37fda62fe57577 Mon Sep 17 00:00:00 2001 From: Pietro Date: Tue, 11 Nov 2025 16:11:17 +0100 Subject: [PATCH 1/6] Add influx push --- Cargo.lock | 511 +++++++++++++++++++++--- rs/cli/Cargo.toml | 2 + rs/cli/src/commands/node_rewards/mod.rs | 148 +++++++ 3 files changed, 597 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 60ed5ce56..4a8302c9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -543,7 +543,7 @@ dependencies = [ "bytes", "futures-util", "http 1.3.1", - "http-body", + "http-body 1.0.1", "http-body-util", "itoa", "matchit 0.7.3", @@ -553,7 +553,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper", + "sync_wrapper 1.0.2", "tower 0.5.2", "tower-layer", "tower-service", @@ -571,9 +571,9 @@ dependencies = [ "form_urlencoded", "futures-util", "http 1.3.1", - "http-body", + "http-body 1.0.1", "http-body-util", - "hyper", + "hyper 1.7.0", "hyper-util", "itoa", "matchit 0.8.4", @@ -586,7 +586,7 @@ dependencies = [ "serde_path_to_error", "serde_urlencoded", "sha1", - "sync_wrapper", + "sync_wrapper 1.0.2", "tokio", "tokio-tungstenite", "tower 0.5.2", @@ -605,12 +605,12 @@ dependencies = [ "bytes", "futures-util", "http 1.3.1", - "http-body", + "http-body 1.0.1", "http-body-util", "mime", "pin-project-lite", "rustversion", - "sync_wrapper", + "sync_wrapper 1.0.2", "tower-layer", "tower-service", ] @@ -624,11 +624,11 @@ dependencies = [ "bytes", "futures-core", "http 1.3.1", - "http-body", + "http-body 1.0.1", "http-body-util", "mime", "pin-project-lite", - "sync_wrapper", + "sync_wrapper 1.0.2", "tower-layer", "tower-service", "tracing", @@ -643,7 +643,7 @@ dependencies = [ "axum 0.8.6", "futures-util", "http 1.3.1", - "http-body", + "http-body 1.0.1", "opentelemetry", "opentelemetry-semantic-conventions", "opentelemetry_sdk", @@ -694,6 +694,12 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" @@ -1107,7 +1113,7 @@ dependencies = [ "humantime", "log", "pretty_env_logger", - "reqwest", + "reqwest 0.12.24", "serde", "serde_json", "tokio", @@ -1530,7 +1536,7 @@ dependencies = [ "bitflags 2.10.0", "crossterm_winapi", "document-features", - "parking_lot", + "parking_lot 0.12.5", "rustix 1.1.2", "winapi", ] @@ -1811,7 +1817,7 @@ dependencies = [ "hashbrown 0.14.5", "lock_api", "once_cell", - "parking_lot_core", + "parking_lot_core 0.9.12", ] [[package]] @@ -2138,6 +2144,12 @@ dependencies = [ "syn 2.0.110", ] +[[package]] +name = "doc-comment" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "780955b8b195a21ab8e4ac6b60dd1dbdcec1dc6c51c0617964b08c81785e12c9" + [[package]] name = "document-features" version = "0.2.12" @@ -2216,6 +2228,8 @@ dependencies = [ "ic-types", "icp-ledger", "indexmap 2.12.0", + "influxdb2", + "influxdb2-structmap", "itertools 0.13.0", "keyring", "log", @@ -2224,7 +2238,7 @@ dependencies = [ "prost", "regex", "registry-canister", - "reqwest", + "reqwest 0.12.24", "rosetta-core", "rust_decimal", "self_update", @@ -2575,6 +2589,21 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.2.2" @@ -2796,6 +2825,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "go-parse-duration" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558b88954871f5e5b2af0e62e2e176c8bde7a6c2c4ed41b13d138d96da2e2cbd" + [[package]] name = "group" version = "0.13.0" @@ -2807,6 +2842,25 @@ dependencies = [ "subtle", ] +[[package]] +name = "h2" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap 2.12.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "h2" version = "0.4.12" @@ -2975,6 +3029,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + [[package]] name = "http-body" version = "1.0.1" @@ -2994,7 +3059,7 @@ dependencies = [ "bytes", "futures-core", "http 1.3.1", - "http-body", + "http-body 1.0.1", "pin-project-lite", ] @@ -3022,6 +3087,30 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" +[[package]] +name = "hyper" +version = "0.14.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.3.27", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.5.10", + "tokio", + "tower-service", + "tracing", + "want", +] + [[package]] name = "hyper" version = "1.7.0" @@ -3032,9 +3121,9 @@ dependencies = [ "bytes", "futures-channel", "futures-core", - "h2", + "h2 0.4.12", "http 1.3.1", - "http-body", + "http-body 1.0.1", "httparse", "httpdate", "itoa", @@ -3052,7 +3141,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ "http 1.3.1", - "hyper", + "hyper 1.7.0", "hyper-util", "log", "rustls", @@ -3070,13 +3159,26 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ - "hyper", + "hyper 1.7.0", "hyper-util", "pin-project-lite", "tokio", "tower-service", ] +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper 0.14.32", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "hyper-util" version = "0.1.17" @@ -3089,14 +3191,14 @@ dependencies = [ "futures-core", "futures-util", "http 1.3.1", - "http-body", - "hyper", + "http-body 1.0.1", + "hyper 1.7.0", "ipnet", "libc", "percent-encoding", "pin-project-lite", "socket2 0.6.1", - "system-configuration", + "system-configuration 0.6.1", "tokio", "tower-service", "tracing", @@ -3175,7 +3277,7 @@ dependencies = [ "futures-util", "hex", "http 1.3.1", - "http-body", + "http-body 1.0.1", "ic-certification 3.0.3", "ic-transport-types 0.39.3", "ic-verify-bls-signature", @@ -3186,7 +3288,7 @@ dependencies = [ "pkcs8", "rand 0.8.5", "rangemap", - "reqwest", + "reqwest 0.12.24", "sec1", "serde", "serde_bytes", @@ -3223,7 +3325,7 @@ dependencies = [ "futures-util", "hex", "http 1.3.1", - "http-body", + "http-body 1.0.1", "ic-certification 3.0.3", "ic-transport-types 0.40.1", "ic-verify-bls-signature", @@ -3234,7 +3336,7 @@ dependencies = [ "pkcs8", "rand 0.8.5", "rangemap", - "reqwest", + "reqwest 0.12.24", "ring", "sec1", "serde", @@ -3305,7 +3407,7 @@ dependencies = [ "backoff", "futures-util", "http-body-util", - "hyper", + "hyper 1.7.0", "hyper-rustls", "hyper-util", "ic-canister-client-sender", @@ -3390,7 +3492,7 @@ dependencies = [ "icrc-ledger-types", "log", "prost", - "reqwest", + "reqwest 0.12.24", "rewards-calculation 0.6.9", "serde", "sha2 0.10.9", @@ -3673,7 +3775,7 @@ dependencies = [ "ic-crypto-secrets-containers", "ic-crypto-sha2", "ic-types", - "parking_lot", + "parking_lot 0.12.5", "rand 0.8.5", "rand_chacha 0.3.1", "serde", @@ -3921,7 +4023,7 @@ dependencies = [ "bytes", "futures", "futures-util", - "hyper", + "hyper 1.7.0", "ic-logger", "slog", "tokio", @@ -4241,7 +4343,7 @@ dependencies = [ "prometheus-http-query", "regex", "registry-canister", - "reqwest", + "reqwest 0.12.24", "serde", "serde_json", "serde_yaml", @@ -4300,7 +4402,7 @@ dependencies = [ "ic-types", "indexmap 2.12.0", "registry-canister", - "reqwest", + "reqwest 0.12.24", "serde", "serde_json", "strum 0.26.3", @@ -4318,7 +4420,7 @@ dependencies = [ "futures", "ic-adapter-metrics-client", "libc", - "parking_lot", + "parking_lot 0.12.5", "procfs 0.9.1", "prometheus", "tokio", @@ -5933,6 +6035,55 @@ dependencies = [ "web-time", ] +[[package]] +name = "influxdb2" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24cc9f9d9fee9ebda1a77b61769cde513e03ad09607b347602f4ea887657689e" +dependencies = [ + "base64 0.13.1", + "bytes", + "chrono", + "csv", + "fallible-iterator", + "futures", + "go-parse-duration", + "influxdb2-derive", + "influxdb2-structmap", + "ordered-float", + "parking_lot 0.11.2", + "reqwest 0.11.27", + "secrecy 0.8.0", + "serde", + "serde_json", + "snafu 0.6.10", + "url", +] + +[[package]] +name = "influxdb2-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990f899841aa30130fc06f7938e3cc2cbc3d5b92c03fd4b5d79a965045abcf16" +dependencies = [ + "itertools 0.10.5", + "proc-macro2", + "quote", + "regex", + "syn 1.0.109", +] + +[[package]] +name = "influxdb2-structmap" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1408e712051787357e99ff732e44e8833e79cea0fabc9361018abfbff72b6265" +dependencies = [ + "chrono", + "num-traits", + "ordered-float", +] + [[package]] name = "instant" version = "0.1.13" @@ -5985,6 +6136,15 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.11.0" @@ -6248,7 +6408,7 @@ checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" dependencies = [ "bitflags 2.10.0", "libc", - "redox_syscall", + "redox_syscall 0.5.18", ] [[package]] @@ -6315,7 +6475,7 @@ dependencies = [ "clap", "log", "pretty_env_logger", - "reqwest", + "reqwest 0.12.24", "serde", "serde_json", "tokio", @@ -6345,7 +6505,7 @@ dependencies = [ "anyhow", "clap", "log-noise-filter-backend", - "reqwest", + "reqwest 0.12.24", "serde", "serde_json", "slog", @@ -6561,7 +6721,7 @@ dependencies = [ "opentelemetry-prometheus", "opentelemetry_sdk", "prometheus", - "reqwest", + "reqwest 0.12.24", "retry", "serde", "serde_json", @@ -6586,7 +6746,7 @@ dependencies = [ "humantime", "multiservice-discovery-shared", "regex", - "reqwest", + "reqwest 0.12.24", "serde_json", "service-discovery", "slog", @@ -6609,6 +6769,23 @@ dependencies = [ "service-discovery", ] +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework 2.11.1", + "security-framework-sys", + "tempfile", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -6784,7 +6961,7 @@ dependencies = [ "candid", "ic-agent 0.39.3", "rand 0.9.2", - "reqwest", + "reqwest 0.12.24", "serde", "url", ] @@ -6805,9 +6982,9 @@ dependencies = [ "futures", "futures-util", "http 1.3.1", - "http-body", + "http-body 1.0.1", "http-body-util", - "hyper", + "hyper 1.7.0", "hyper-rustls", "hyper-timeout", "hyper-util", @@ -6820,7 +6997,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "snafu", + "snafu 0.8.9", "tokio", "tower 0.5.2", "tower-http", @@ -6860,12 +7037,50 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +[[package]] +name = "openssl" +version = "0.10.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", +] + [[package]] name = "openssl-probe" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +[[package]] +name = "openssl-sys" +version = "0.9.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "opentelemetry" version = "0.28.0" @@ -6925,6 +7140,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "ordered-float" +version = "3.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" +dependencies = [ + "num-traits", +] + [[package]] name = "p256" version = "0.13.2" @@ -6974,6 +7198,17 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + [[package]] name = "parking_lot" version = "0.12.5" @@ -6981,7 +7216,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.9.12", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", ] [[package]] @@ -6992,7 +7241,7 @@ checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.5.18", "smallvec", "windows-link 0.2.1", ] @@ -7425,7 +7674,7 @@ dependencies = [ "lazy_static", "libc", "memchr", - "parking_lot", + "parking_lot 0.12.5", "procfs 0.16.0", "protobuf", "thiserror 1.0.69", @@ -7466,7 +7715,7 @@ checksum = "0fcebfa99f03ae51220778316b37d24981e36322c82c24848f48c5bd0f64cbdb" dependencies = [ "enum-as-inner", "mime", - "reqwest", + "reqwest 0.12.24", "serde", "time", "url", @@ -7785,6 +8034,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_syscall" version = "0.5.18" @@ -7914,6 +8172,48 @@ dependencies = [ "bytecheck", ] +[[package]] +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.3.27", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.32", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration 0.5.1", + "tokio", + "tokio-native-tls", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "winreg", +] + [[package]] name = "reqwest" version = "0.12.24" @@ -7926,9 +8226,9 @@ dependencies = [ "futures-core", "futures-util", "http 1.3.1", - "http-body", + "http-body 1.0.1", "http-body-util", - "hyper", + "hyper 1.7.0", "hyper-rustls", "hyper-util", "js-sys", @@ -7941,7 +8241,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.2", "tokio", "tokio-rustls", "tokio-util", @@ -8196,6 +8496,15 @@ dependencies = [ "security-framework 3.5.1", ] +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + [[package]] name = "rustls-pki-types" version = "1.13.0" @@ -8362,12 +8671,12 @@ version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469a3970061380c19852269f393e74c0fe607a4e23d85267382cf25486aa8de5" dependencies = [ - "hyper", + "hyper 1.7.0", "indicatif", "log", "quick-xml", "regex", - "reqwest", + "reqwest 0.12.24", "self-replace", "semver", "serde_json", @@ -8530,7 +8839,7 @@ dependencies = [ "futures", "lazy_static", "log", - "parking_lot", + "parking_lot 0.12.5", "serial_test_derive", ] @@ -8703,7 +9012,7 @@ dependencies = [ "log", "regex", "registry-canister", - "reqwest", + "reqwest 0.12.24", "retry", "serde", "serde_json", @@ -8788,13 +9097,34 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +[[package]] +name = "snafu" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7" +dependencies = [ + "doc-comment", + "snafu-derive 0.6.10", +] + [[package]] name = "snafu" version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e84b3f4eacbf3a1ce05eac6763b4d629d60cbc94d632e4092c54ade71f1e1a2" dependencies = [ - "snafu-derive", + "snafu-derive 0.8.9", +] + +[[package]] +name = "snafu-derive" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -8821,7 +9151,7 @@ dependencies = [ "humantime", "ic-canisters", "multiservice-discovery-shared", - "reqwest", + "reqwest 0.12.24", "serde_json", "slog", "slog-async", @@ -8937,7 +9267,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" dependencies = [ "new_debug_unreachable", - "parking_lot", + "parking_lot 0.12.5", "phf_shared", "precomputed-hash", ] @@ -9032,6 +9362,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "sync_wrapper" version = "1.0.2" @@ -9052,6 +9388,17 @@ dependencies = [ "syn 2.0.110", ] +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "system-configuration-sys 0.5.0", +] + [[package]] name = "system-configuration" version = "0.6.1" @@ -9060,7 +9407,17 @@ checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.10.0", "core-foundation 0.9.4", - "system-configuration-sys", + "system-configuration-sys 0.6.0", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", ] [[package]] @@ -9325,7 +9682,7 @@ dependencies = [ "bytes", "libc", "mio", - "parking_lot", + "parking_lot 0.12.5", "pin-project-lite", "signal-hook-registry", "socket2 0.6.1", @@ -9366,6 +9723,16 @@ dependencies = [ "tokio-stream", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.26.4" @@ -9453,11 +9820,11 @@ dependencies = [ "axum 0.7.9", "base64 0.22.1", "bytes", - "h2", + "h2 0.4.12", "http 1.3.1", - "http-body", + "http-body 1.0.1", "http-body-util", - "hyper", + "hyper 1.7.0", "hyper-timeout", "hyper-util", "percent-encoding", @@ -9518,7 +9885,7 @@ dependencies = [ "indexmap 2.12.0", "pin-project-lite", "slab", - "sync_wrapper", + "sync_wrapper 1.0.2", "tokio", "tokio-util", "tower-layer", @@ -9538,7 +9905,7 @@ dependencies = [ "futures-core", "futures-util", "http 1.3.1", - "http-body", + "http-body 1.0.1", "http-body-util", "iri-string", "pin-project-lite", @@ -9767,6 +10134,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" @@ -10344,6 +10717,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "wiremock" version = "0.6.4" @@ -10357,7 +10740,7 @@ dependencies = [ "futures", "http 1.3.1", "http-body-util", - "hyper", + "hyper 1.7.0", "hyper-util", "log", "once_cell", diff --git a/rs/cli/Cargo.toml b/rs/cli/Cargo.toml index 22e4d6ee8..c394fb0db 100644 --- a/rs/cli/Cargo.toml +++ b/rs/cli/Cargo.toml @@ -90,6 +90,8 @@ url = { workspace = true } hex = { workspace = true } ic-registry-common-proto = { workspace = true } base64 = { version = "0.22" } +influxdb2 = "0.5" +influxdb2-structmap = "0.2" [dev-dependencies] actix-rt = { workspace = true } diff --git a/rs/cli/src/commands/node_rewards/mod.rs b/rs/cli/src/commands/node_rewards/mod.rs index 2181e7885..a5c0f7d4e 100644 --- a/rs/cli/src/commands/node_rewards/mod.rs +++ b/rs/cli/src/commands/node_rewards/mod.rs @@ -10,6 +10,8 @@ use ic_canisters::governance::GovernanceCanisterWrapper; use ic_canisters::node_rewards::NodeRewardsCanisterWrapper; use ic_node_rewards_canister_api::DateUtc; use ic_node_rewards_canister_api::provider_rewards_calculation::{DailyNodeFailureRate, DailyNodeProviderRewards, DailyResults}; +use influxdb2::Client as InfluxClient; +use influxdb2::models::DataPoint; use itertools::Itertools; use log::info; use std::cell::RefCell; @@ -43,6 +45,12 @@ pub enum NodeRewardsMode { #[arg(long)] compare_with_governance: bool, }, + /// Push node rewards metrics to InfluxDB for a specific date + PushToInflux { + /// Date in format YYYY-MM-DD (defaults to yesterday) + #[arg(long)] + date: Option, + }, } #[derive(Args, Debug)] @@ -85,6 +93,11 @@ impl ExecutableCommand for NodeRewards { fn validate(&self, _args: &GlobalArgs, _cmd: &mut clap::Command) {} async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> { + // Handle PushToInflux separately as it doesn't need governance client + if let NodeRewardsMode::PushToInflux { date } = &self.mode { + return self.push_to_influx(ctx, date.clone()).await; + } + let (_, canister_agent) = ctx.create_ic_agent_canister_client().await?; let node_rewards_client: NodeRewardsCanisterWrapper = canister_agent.clone().into(); let governance_client: GovernanceCanisterWrapper = canister_agent.into(); @@ -94,6 +107,9 @@ impl ExecutableCommand for NodeRewards { let gov_rewards_list = governance_client.list_node_provider_rewards(None).await?; // Run the selected subcommand and populate self attributes match &self.mode { + NodeRewardsMode::PushToInflux { .. } => { + unreachable!("PushToInflux should have been handled earlier") + } NodeRewardsMode::Ongoing { csv_detailed_output_path, provider_id, @@ -927,4 +943,136 @@ impl NodeRewards { wtr.flush()?; Ok(()) } + + /// Push node rewards metrics to InfluxDB + async fn push_to_influx(&self, ctx: crate::ctx::DreContext, date_str: Option) -> anyhow::Result<()> { + // Get InfluxDB configuration from environment + let influx_url = std::env::var("INFLUXDB_URL").unwrap_or_else(|_| "http://localhost:8086".to_string()); + let influx_token = std::env::var("INFLUXDB_TOKEN").map_err(|_| anyhow!("INFLUXDB_TOKEN environment variable not set"))?; + let influx_org = std::env::var("INFLUXDB_ORG").unwrap_or_else(|_| "ic-org".to_string()); + let influx_bucket = std::env::var("INFLUXDB_BUCKET").unwrap_or_else(|_| "node-rewards".to_string()); + + // Parse or default to yesterday + let target_date = if let Some(date) = date_str { + chrono::NaiveDate::parse_from_str(&date, "%Y-%m-%d")? + } else { + let today = chrono::Utc::now().date_naive(); + today.pred_opt().unwrap() + }; + + info!("Pushing node rewards data to InfluxDB for date: {}", target_date); + + // Fetch data from node rewards canister + let (_, canister_agent) = ctx.create_ic_agent_canister_client().await?; + let node_rewards_client: NodeRewardsCanisterWrapper = canister_agent.into(); + + let date_utc = DateUtc::from(target_date); + let daily_results = node_rewards_client.get_rewards_daily(date_utc).await?; + + // Create InfluxDB client + let client = InfluxClient::new(influx_url, influx_org, influx_token); + + let timestamp_nanos = target_date + .and_hms_opt(0, 0, 0) + .ok_or_else(|| anyhow!("Invalid date midnight"))? + .and_utc() + .timestamp_nanos_opt() + .ok_or_else(|| anyhow!("Timestamp overflow"))?; + + let mut points: Vec = Vec::new(); + + // Push provider-level metrics + for (provider_id, provider_rewards) in daily_results.provider_results { + let provider_id_str = provider_id.to_string(); + + // Latest nodes count + points.push( + DataPoint::builder("latest_nodes_count") + .tag("provider_id", &provider_id_str) + .field("value", provider_rewards.daily_nodes_rewards.len() as i64) + .timestamp(timestamp_nanos) + .build()?, + ); + + // Total base rewards + points.push( + DataPoint::builder("latest_total_base_rewards_xdr_permyriad") + .tag("provider_id", &provider_id_str) + .field("value", provider_rewards.total_base_rewards_xdr_permyriad.unwrap() as i64) + .timestamp(timestamp_nanos) + .build()?, + ); + + // Total adjusted rewards + points.push( + DataPoint::builder("latest_total_adjusted_rewards_xdr_permyriad") + .tag("provider_id", &provider_id_str) + .field("value", provider_rewards.total_adjusted_rewards_xdr_permyriad.unwrap() as i64) + .timestamp(timestamp_nanos) + .build()?, + ); + + // Node-level metrics + for node_result in &provider_rewards.daily_nodes_rewards { + let node_id_str = node_result.node_id.map(|id| id.to_string()).unwrap_or_default(); + + // Original failure rate + if let Some(DailyNodeFailureRate::SubnetMember { node_metrics: Some(m) }) = &node_result.daily_node_failure_rate { + if let Some(original_fr) = m.original_failure_rate { + points.push( + DataPoint::builder("latest_original_failure_rate") + .tag("provider_id", &provider_id_str) + .tag("node_id", &node_id_str) + .tag("subnet_id", &m.subnet_assigned.map(|s| s.to_string()).unwrap_or_default()) + .field("value", original_fr) + .timestamp(timestamp_nanos) + .build()?, + ); + } + + if let Some(relative_fr) = m.relative_failure_rate { + points.push( + DataPoint::builder("latest_relative_failure_rate") + .tag("provider_id", &provider_id_str) + .tag("node_id", &node_id_str) + .tag("subnet_id", &m.subnet_assigned.map(|s| s.to_string()).unwrap_or_default()) + .field("value", relative_fr) + .timestamp(timestamp_nanos) + .build()?, + ); + } + } + } + } + + // Push subnet-level metrics + for (subnet_id, failure_rate) in daily_results.subnets_failure_rate { + points.push( + DataPoint::builder("subnet_failure_rate") + .tag("subnet_id", &subnet_id.to_string()) + .field("value", failure_rate) + .timestamp(timestamp_nanos) + .build()?, + ); + } + + // Push governance latest reward timestamp + let governance_client: GovernanceCanisterWrapper = ctx.create_ic_agent_canister_client().await?.1.into(); + let gov_rewards_list = governance_client.list_node_provider_rewards(None).await?; + if let Some(last_rewards) = gov_rewards_list.first() { + points.push( + DataPoint::builder("governance_latest_reward_event_timestamp_seconds") + .field("value", last_rewards.timestamp as i64) + .timestamp(timestamp_nanos) + .build()?, + ); + } + + // Write all points to InfluxDB + info!("Writing {} data points to InfluxDB...", points.len()); + client.write(&influx_bucket, futures::stream::iter(points)).await?; + + info!("Successfully pushed node rewards data for {} to InfluxDB", target_date); + Ok(()) + } } From ad72059691a0fd34a932b3ec7c301fe6919d9680 Mon Sep 17 00:00:00 2001 From: Pietro Date: Tue, 11 Nov 2025 20:38:55 +0100 Subject: [PATCH 2/6] Add command to push to Victoria --- Cargo.lock | 1 + rs/cli/Cargo.toml | 1 + rs/cli/src/commands/node_rewards/mod.rs | 233 +++++++++++++++--------- 3 files changed, 149 insertions(+), 86 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4a8302c9b..80f59d5af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2235,6 +2235,7 @@ dependencies = [ "log", "mockall", "pretty_env_logger", + "prometheus", "prost", "regex", "registry-canister", diff --git a/rs/cli/Cargo.toml b/rs/cli/Cargo.toml index c394fb0db..6f3990b57 100644 --- a/rs/cli/Cargo.toml +++ b/rs/cli/Cargo.toml @@ -92,6 +92,7 @@ ic-registry-common-proto = { workspace = true } base64 = { version = "0.22" } influxdb2 = "0.5" influxdb2-structmap = "0.2" +prometheus = "0.13" [dev-dependencies] actix-rt = { workspace = true } diff --git a/rs/cli/src/commands/node_rewards/mod.rs b/rs/cli/src/commands/node_rewards/mod.rs index a5c0f7d4e..75d87ec4f 100644 --- a/rs/cli/src/commands/node_rewards/mod.rs +++ b/rs/cli/src/commands/node_rewards/mod.rs @@ -10,8 +10,6 @@ use ic_canisters::governance::GovernanceCanisterWrapper; use ic_canisters::node_rewards::NodeRewardsCanisterWrapper; use ic_node_rewards_canister_api::DateUtc; use ic_node_rewards_canister_api::provider_rewards_calculation::{DailyNodeFailureRate, DailyNodeProviderRewards, DailyResults}; -use influxdb2::Client as InfluxClient; -use influxdb2::models::DataPoint; use itertools::Itertools; use log::info; use std::cell::RefCell; @@ -51,6 +49,15 @@ pub enum NodeRewardsMode { #[arg(long)] date: Option, }, + /// Push node rewards metrics to VictoriaMetrics for a specific date + PushToVictoria { + /// Date in format YYYY-MM-DD (defaults to yesterday) + #[arg(long)] + date: Option, + /// VictoriaMetrics URL (defaults to http://localhost:9090) + #[arg(long)] + victoria_url: Option, + }, } #[derive(Args, Debug)] @@ -98,6 +105,11 @@ impl ExecutableCommand for NodeRewards { return self.push_to_influx(ctx, date.clone()).await; } + // Handle PushToVictoria separately as it doesn't need governance client + if let NodeRewardsMode::PushToVictoria { date, victoria_url } = &self.mode { + return self.push_to_victoria(ctx, date.clone(), victoria_url.clone()).await; + } + let (_, canister_agent) = ctx.create_ic_agent_canister_client().await?; let node_rewards_client: NodeRewardsCanisterWrapper = canister_agent.clone().into(); let governance_client: GovernanceCanisterWrapper = canister_agent.into(); @@ -110,6 +122,9 @@ impl ExecutableCommand for NodeRewards { NodeRewardsMode::PushToInflux { .. } => { unreachable!("PushToInflux should have been handled earlier") } + NodeRewardsMode::PushToVictoria { .. } => { + unreachable!("PushToVictoria should have been handled earlier") + } NodeRewardsMode::Ongoing { csv_detailed_output_path, provider_id, @@ -944,13 +959,13 @@ impl NodeRewards { Ok(()) } - /// Push node rewards metrics to InfluxDB - async fn push_to_influx(&self, ctx: crate::ctx::DreContext, date_str: Option) -> anyhow::Result<()> { - // Get InfluxDB configuration from environment - let influx_url = std::env::var("INFLUXDB_URL").unwrap_or_else(|_| "http://localhost:8086".to_string()); - let influx_token = std::env::var("INFLUXDB_TOKEN").map_err(|_| anyhow!("INFLUXDB_TOKEN environment variable not set"))?; - let influx_org = std::env::var("INFLUXDB_ORG").unwrap_or_else(|_| "ic-org".to_string()); - let influx_bucket = std::env::var("INFLUXDB_BUCKET").unwrap_or_else(|_| "node-rewards".to_string()); + async fn push_to_victoria(&self, ctx: crate::ctx::DreContext, date_str: Option, victoria_url: Option) -> anyhow::Result<()> { + use prometheus::{GaugeVec, Opts, Registry}; + + // Get VictoriaMetrics configuration + let vm_url = victoria_url + .or_else(|| std::env::var("VICTORIA_METRICS_URL").ok()) + .unwrap_or_else(|| "http://localhost:9090".to_string()); // Parse or default to yesterday let target_date = if let Some(date) = date_str { @@ -960,7 +975,7 @@ impl NodeRewards { today.pred_opt().unwrap() }; - info!("Pushing node rewards data to InfluxDB for date: {}", target_date); + info!("Pushing node rewards data to VictoriaMetrics for date: {}", target_date); // Fetch data from node rewards canister let (_, canister_agent) = ctx.create_ic_agent_canister_client().await?; @@ -969,110 +984,156 @@ impl NodeRewards { let date_utc = DateUtc::from(target_date); let daily_results = node_rewards_client.get_rewards_daily(date_utc).await?; - // Create InfluxDB client - let client = InfluxClient::new(influx_url, influx_org, influx_token); + // Create Prometheus registry and metrics + let registry = Registry::new(); - let timestamp_nanos = target_date - .and_hms_opt(0, 0, 0) - .ok_or_else(|| anyhow!("Invalid date midnight"))? + let timestamp_millis = target_date + .and_hms_opt(12, 0, 0) + .ok_or_else(|| anyhow!("Invalid date noon"))? .and_utc() - .timestamp_nanos_opt() - .ok_or_else(|| anyhow!("Timestamp overflow"))?; - - let mut points: Vec = Vec::new(); - - // Push provider-level metrics + .timestamp_millis(); + + // Define metrics + let nodes_count = GaugeVec::new(Opts::new("latest_nodes_count", "Number of nodes per provider"), &["provider_id"])?; + registry.register(Box::new(nodes_count.clone()))?; + + let base_rewards = GaugeVec::new( + Opts::new("latest_total_base_rewards_xdr_permyriad", "Total base rewards in XDR permyriad"), + &["provider_id"], + )?; + registry.register(Box::new(base_rewards.clone()))?; + + let adjusted_rewards = GaugeVec::new( + Opts::new("latest_total_adjusted_rewards_xdr_permyriad", "Total adjusted rewards in XDR permyriad"), + &["provider_id"], + )?; + registry.register(Box::new(adjusted_rewards.clone()))?; + + let original_failure_rate = GaugeVec::new( + Opts::new("latest_original_failure_rate", "Original failure rate per node"), + &["provider_id", "node_id", "subnet_id"], + )?; + registry.register(Box::new(original_failure_rate.clone()))?; + + let relative_failure_rate = GaugeVec::new( + Opts::new("latest_relative_failure_rate", "Relative failure rate per node"), + &["provider_id", "node_id", "subnet_id"], + )?; + registry.register(Box::new(relative_failure_rate.clone()))?; + + let subnet_failure = GaugeVec::new(Opts::new("subnet_failure_rate", "Failure rate per subnet"), &["subnet_id"])?; + registry.register(Box::new(subnet_failure.clone()))?; + + let gov_timestamp = prometheus::Gauge::new( + "governance_latest_reward_event_timestamp_seconds", + "Latest governance reward event timestamp", + )?; + registry.register(Box::new(gov_timestamp.clone()))?; + + // Set provider-level metrics for (provider_id, provider_rewards) in daily_results.provider_results { let provider_id_str = provider_id.to_string(); - // Latest nodes count - points.push( - DataPoint::builder("latest_nodes_count") - .tag("provider_id", &provider_id_str) - .field("value", provider_rewards.daily_nodes_rewards.len() as i64) - .timestamp(timestamp_nanos) - .build()?, - ); - - // Total base rewards - points.push( - DataPoint::builder("latest_total_base_rewards_xdr_permyriad") - .tag("provider_id", &provider_id_str) - .field("value", provider_rewards.total_base_rewards_xdr_permyriad.unwrap() as i64) - .timestamp(timestamp_nanos) - .build()?, - ); - - // Total adjusted rewards - points.push( - DataPoint::builder("latest_total_adjusted_rewards_xdr_permyriad") - .tag("provider_id", &provider_id_str) - .field("value", provider_rewards.total_adjusted_rewards_xdr_permyriad.unwrap() as i64) - .timestamp(timestamp_nanos) - .build()?, - ); + nodes_count + .with_label_values(&[&provider_id_str]) + .set(provider_rewards.daily_nodes_rewards.len() as f64); + + if let Some(base) = provider_rewards.total_base_rewards_xdr_permyriad { + base_rewards.with_label_values(&[&provider_id_str]).set(base as f64); + } + + if let Some(adjusted) = provider_rewards.total_adjusted_rewards_xdr_permyriad { + adjusted_rewards.with_label_values(&[&provider_id_str]).set(adjusted as f64); + } // Node-level metrics for node_result in &provider_rewards.daily_nodes_rewards { let node_id_str = node_result.node_id.map(|id| id.to_string()).unwrap_or_default(); - // Original failure rate if let Some(DailyNodeFailureRate::SubnetMember { node_metrics: Some(m) }) = &node_result.daily_node_failure_rate { + let subnet_id_str = m.subnet_assigned.map(|s| s.to_string()).unwrap_or_default(); + if let Some(original_fr) = m.original_failure_rate { - points.push( - DataPoint::builder("latest_original_failure_rate") - .tag("provider_id", &provider_id_str) - .tag("node_id", &node_id_str) - .tag("subnet_id", &m.subnet_assigned.map(|s| s.to_string()).unwrap_or_default()) - .field("value", original_fr) - .timestamp(timestamp_nanos) - .build()?, - ); + original_failure_rate + .with_label_values(&[&provider_id_str, &node_id_str, &subnet_id_str]) + .set(original_fr); } if let Some(relative_fr) = m.relative_failure_rate { - points.push( - DataPoint::builder("latest_relative_failure_rate") - .tag("provider_id", &provider_id_str) - .tag("node_id", &node_id_str) - .tag("subnet_id", &m.subnet_assigned.map(|s| s.to_string()).unwrap_or_default()) - .field("value", relative_fr) - .timestamp(timestamp_nanos) - .build()?, - ); + relative_failure_rate + .with_label_values(&[&provider_id_str, &node_id_str, &subnet_id_str]) + .set(relative_fr); } } } } - // Push subnet-level metrics + // Set subnet-level metrics for (subnet_id, failure_rate) in daily_results.subnets_failure_rate { - points.push( - DataPoint::builder("subnet_failure_rate") - .tag("subnet_id", &subnet_id.to_string()) - .field("value", failure_rate) - .timestamp(timestamp_nanos) - .build()?, - ); + subnet_failure.with_label_values(&[&subnet_id.to_string()]).set(failure_rate); } - // Push governance latest reward timestamp + // Set governance timestamp let governance_client: GovernanceCanisterWrapper = ctx.create_ic_agent_canister_client().await?.1.into(); let gov_rewards_list = governance_client.list_node_provider_rewards(None).await?; if let Some(last_rewards) = gov_rewards_list.first() { - points.push( - DataPoint::builder("governance_latest_reward_event_timestamp_seconds") - .field("value", last_rewards.timestamp as i64) - .timestamp(timestamp_nanos) - .build()?, - ); + gov_timestamp.set(last_rewards.timestamp as f64); } - // Write all points to InfluxDB - info!("Writing {} data points to InfluxDB...", points.len()); - client.write(&influx_bucket, futures::stream::iter(points)).await?; + // Gather metrics and manually format with timestamps + let metric_families = registry.gather(); + let mut buffer = String::new(); - info!("Successfully pushed node rewards data for {} to InfluxDB", target_date); - Ok(()) + // Manually construct Prometheus format with timestamps + for mf in metric_families { + for m in mf.get_metric() { + let metric_name = mf.get_name(); + + // Build label string + let mut labels = Vec::new(); + for label in m.get_label() { + labels.push(format!("{}=\"{}\"", label.get_name(), label.get_value())); + } + let label_str = if labels.is_empty() { + String::new() + } else { + format!("{{{}}}", labels.join(",")) + }; + + // Get metric value + let value = if m.has_gauge() { + m.get_gauge().get_value() + } else if m.has_counter() { + m.get_counter().get_value() + } else if m.has_untyped() { + m.get_untyped().get_value() + } else { + continue; // Skip unsupported metric types + }; + + // Format: metric_name{labels} value timestamp_ms + buffer.push_str(&format!("{}{} {} {}\n", metric_name, label_str, value, timestamp_millis)); + } + } + + // Push to VictoriaMetrics via import API + let client = reqwest::Client::new(); + let import_url = format!("{}/api/v1/import/prometheus", vm_url.trim_end_matches('/')); + + info!( + "Pushing {} metrics to VictoriaMetrics for timestamp {}...", + metric_families.len(), + timestamp_millis + ); + + let response = client.post(&import_url).header("Content-Type", "text/plain").body(buffer).send().await?; + + if response.status().is_success() { + info!("Successfully pushed node rewards data for {} to VictoriaMetrics", target_date); + Ok(()) + } else { + let error_text = response.text().await?; + Err(anyhow!("Failed to push to VictoriaMetrics: {}", error_text)) + } } } From 58435e1ddebec09c081725e3ae2c0ae9202dad9f Mon Sep 17 00:00:00 2001 From: Pietro Date: Tue, 11 Nov 2025 20:56:36 +0100 Subject: [PATCH 3/6] Remove influx --- rs/cli/src/commands/node_rewards/mod.rs | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/rs/cli/src/commands/node_rewards/mod.rs b/rs/cli/src/commands/node_rewards/mod.rs index 75d87ec4f..05b454e9e 100644 --- a/rs/cli/src/commands/node_rewards/mod.rs +++ b/rs/cli/src/commands/node_rewards/mod.rs @@ -43,12 +43,6 @@ pub enum NodeRewardsMode { #[arg(long)] compare_with_governance: bool, }, - /// Push node rewards metrics to InfluxDB for a specific date - PushToInflux { - /// Date in format YYYY-MM-DD (defaults to yesterday) - #[arg(long)] - date: Option, - }, /// Push node rewards metrics to VictoriaMetrics for a specific date PushToVictoria { /// Date in format YYYY-MM-DD (defaults to yesterday) @@ -100,11 +94,6 @@ impl ExecutableCommand for NodeRewards { fn validate(&self, _args: &GlobalArgs, _cmd: &mut clap::Command) {} async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> { - // Handle PushToInflux separately as it doesn't need governance client - if let NodeRewardsMode::PushToInflux { date } = &self.mode { - return self.push_to_influx(ctx, date.clone()).await; - } - // Handle PushToVictoria separately as it doesn't need governance client if let NodeRewardsMode::PushToVictoria { date, victoria_url } = &self.mode { return self.push_to_victoria(ctx, date.clone(), victoria_url.clone()).await; @@ -119,9 +108,6 @@ impl ExecutableCommand for NodeRewards { let gov_rewards_list = governance_client.list_node_provider_rewards(None).await?; // Run the selected subcommand and populate self attributes match &self.mode { - NodeRewardsMode::PushToInflux { .. } => { - unreachable!("PushToInflux should have been handled earlier") - } NodeRewardsMode::PushToVictoria { .. } => { unreachable!("PushToVictoria should have been handled earlier") } @@ -1083,9 +1069,10 @@ impl NodeRewards { // Gather metrics and manually format with timestamps let metric_families = registry.gather(); let mut buffer = String::new(); + let num_families = metric_families.len(); // Manually construct Prometheus format with timestamps - for mf in metric_families { + for mf in &metric_families { for m in mf.get_metric() { let metric_name = mf.get_name(); @@ -1122,8 +1109,7 @@ impl NodeRewards { info!( "Pushing {} metrics to VictoriaMetrics for timestamp {}...", - metric_families.len(), - timestamp_millis + num_families, timestamp_millis ); let response = client.post(&import_url).header("Content-Type", "text/plain").body(buffer).send().await?; From 83e7d0ad8232c5ec840656d8230609bd110c36cc Mon Sep 17 00:00:00 2001 From: Pietro Date: Wed, 12 Nov 2025 15:45:17 +0100 Subject: [PATCH 4/6] Add URL victoria --- rs/cli/src/commands/node_rewards/mod.rs | 56 +++++++++++-------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/rs/cli/src/commands/node_rewards/mod.rs b/rs/cli/src/commands/node_rewards/mod.rs index 05b454e9e..c00b9cdcd 100644 --- a/rs/cli/src/commands/node_rewards/mod.rs +++ b/rs/cli/src/commands/node_rewards/mod.rs @@ -16,6 +16,7 @@ use std::cell::RefCell; use std::collections::BTreeMap; use std::fs; use tabled::Tabled; +use url::Url; #[derive(Subcommand, Debug, Clone)] pub enum NodeRewardsMode { @@ -45,7 +46,7 @@ pub enum NodeRewardsMode { }, /// Push node rewards metrics to VictoriaMetrics for a specific date PushToVictoria { - /// Date in format YYYY-MM-DD (defaults to yesterday) + /// Date in format YYYY-MM-DD #[arg(long)] date: Option, /// VictoriaMetrics URL (defaults to http://localhost:9090) @@ -94,11 +95,6 @@ impl ExecutableCommand for NodeRewards { fn validate(&self, _args: &GlobalArgs, _cmd: &mut clap::Command) {} async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> { - // Handle PushToVictoria separately as it doesn't need governance client - if let NodeRewardsMode::PushToVictoria { date, victoria_url } = &self.mode { - return self.push_to_victoria(ctx, date.clone(), victoria_url.clone()).await; - } - let (_, canister_agent) = ctx.create_ic_agent_canister_client().await?; let node_rewards_client: NodeRewardsCanisterWrapper = canister_agent.clone().into(); let governance_client: GovernanceCanisterWrapper = canister_agent.into(); @@ -108,8 +104,15 @@ impl ExecutableCommand for NodeRewards { let gov_rewards_list = governance_client.list_node_provider_rewards(None).await?; // Run the selected subcommand and populate self attributes match &self.mode { - NodeRewardsMode::PushToVictoria { .. } => { - unreachable!("PushToVictoria should have been handled earlier") + NodeRewardsMode::PushToVictoria { date, victoria_url } => { + let url_string = victoria_url + .clone() + .or_else(|| std::env::var("VICTORIA_METRICS_URL").ok()) + .unwrap_or_else(|| "http://localhost:9090".to_string()); + + let victoria_url = Url::parse(&url_string).map_err(|e| anyhow!("Invalid VictoriaMetrics URL '{}': {}", url_string, e))?; + + return self.push_rewards_metrics_to_victoria(ctx, date.clone(), victoria_url).await; } NodeRewardsMode::Ongoing { csv_detailed_output_path, @@ -945,16 +948,10 @@ impl NodeRewards { Ok(()) } - async fn push_to_victoria(&self, ctx: crate::ctx::DreContext, date_str: Option, victoria_url: Option) -> anyhow::Result<()> { + async fn push_rewards_metrics_to_victoria(&self, ctx: crate::ctx::DreContext, date: Option, victoria_url: Url) -> anyhow::Result<()> { use prometheus::{GaugeVec, Opts, Registry}; - - // Get VictoriaMetrics configuration - let vm_url = victoria_url - .or_else(|| std::env::var("VICTORIA_METRICS_URL").ok()) - .unwrap_or_else(|| "http://localhost:9090".to_string()); - // Parse or default to yesterday - let target_date = if let Some(date) = date_str { + let target_date = if let Some(date) = date { chrono::NaiveDate::parse_from_str(&date, "%Y-%m-%d")? } else { let today = chrono::Utc::now().date_naive(); @@ -973,36 +970,36 @@ impl NodeRewards { // Create Prometheus registry and metrics let registry = Registry::new(); - let timestamp_millis = target_date + let noon_timestamp_millis = target_date .and_hms_opt(12, 0, 0) .ok_or_else(|| anyhow!("Invalid date noon"))? .and_utc() .timestamp_millis(); // Define metrics - let nodes_count = GaugeVec::new(Opts::new("latest_nodes_count", "Number of nodes per provider"), &["provider_id"])?; + let nodes_count = GaugeVec::new(Opts::new("nodes_count", "Number of nodes per provider"), &["provider_id"])?; registry.register(Box::new(nodes_count.clone()))?; let base_rewards = GaugeVec::new( - Opts::new("latest_total_base_rewards_xdr_permyriad", "Total base rewards in XDR permyriad"), + Opts::new("total_base_rewards_xdr_permyriad", "Total base rewards in XDR permyriad"), &["provider_id"], )?; registry.register(Box::new(base_rewards.clone()))?; let adjusted_rewards = GaugeVec::new( - Opts::new("latest_total_adjusted_rewards_xdr_permyriad", "Total adjusted rewards in XDR permyriad"), + Opts::new("total_adjusted_rewards_xdr_permyriad", "Total adjusted rewards in XDR permyriad"), &["provider_id"], )?; registry.register(Box::new(adjusted_rewards.clone()))?; let original_failure_rate = GaugeVec::new( - Opts::new("latest_original_failure_rate", "Original failure rate per node"), + Opts::new("original_failure_rate", "Original failure rate per node"), &["provider_id", "node_id", "subnet_id"], )?; registry.register(Box::new(original_failure_rate.clone()))?; let relative_failure_rate = GaugeVec::new( - Opts::new("latest_relative_failure_rate", "Relative failure rate per node"), + Opts::new("relative_failure_rate", "Relative failure rate per node"), &["provider_id", "node_id", "subnet_id"], )?; registry.register(Box::new(relative_failure_rate.clone()))?; @@ -1069,7 +1066,6 @@ impl NodeRewards { // Gather metrics and manually format with timestamps let metric_families = registry.gather(); let mut buffer = String::new(); - let num_families = metric_families.len(); // Manually construct Prometheus format with timestamps for mf in &metric_families { @@ -1099,20 +1095,16 @@ impl NodeRewards { }; // Format: metric_name{labels} value timestamp_ms - buffer.push_str(&format!("{}{} {} {}\n", metric_name, label_str, value, timestamp_millis)); + buffer.push_str(&format!("{}{} {} {}\n", metric_name, label_str, value, noon_timestamp_millis)); } } // Push to VictoriaMetrics via import API let client = reqwest::Client::new(); - let import_url = format!("{}/api/v1/import/prometheus", vm_url.trim_end_matches('/')); - - info!( - "Pushing {} metrics to VictoriaMetrics for timestamp {}...", - num_families, timestamp_millis - ); - - let response = client.post(&import_url).header("Content-Type", "text/plain").body(buffer).send().await?; + let import_url = victoria_url + .join("/api/v1/import/prometheus") + .map_err(|e| anyhow!("Failed to construct VictoriaMetrics import URL: {}", e))?; + let response = client.post(import_url).header("Content-Type", "text/plain").body(buffer).send().await?; if response.status().is_success() { info!("Successfully pushed node rewards data for {} to VictoriaMetrics", target_date); From 42dc213c8193b594fafb765221518833a8c8125a Mon Sep 17 00:00:00 2001 From: Pietro Date: Wed, 12 Nov 2025 15:47:18 +0100 Subject: [PATCH 5/6] remove influx dep --- Cargo.lock | 511 ++++++---------------------------------------- rs/cli/Cargo.toml | 2 - 2 files changed, 64 insertions(+), 449 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 80f59d5af..ff9a84770 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -543,7 +543,7 @@ dependencies = [ "bytes", "futures-util", "http 1.3.1", - "http-body 1.0.1", + "http-body", "http-body-util", "itoa", "matchit 0.7.3", @@ -553,7 +553,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper 1.0.2", + "sync_wrapper", "tower 0.5.2", "tower-layer", "tower-service", @@ -571,9 +571,9 @@ dependencies = [ "form_urlencoded", "futures-util", "http 1.3.1", - "http-body 1.0.1", + "http-body", "http-body-util", - "hyper 1.7.0", + "hyper", "hyper-util", "itoa", "matchit 0.8.4", @@ -586,7 +586,7 @@ dependencies = [ "serde_path_to_error", "serde_urlencoded", "sha1", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", "tokio-tungstenite", "tower 0.5.2", @@ -605,12 +605,12 @@ dependencies = [ "bytes", "futures-util", "http 1.3.1", - "http-body 1.0.1", + "http-body", "http-body-util", "mime", "pin-project-lite", "rustversion", - "sync_wrapper 1.0.2", + "sync_wrapper", "tower-layer", "tower-service", ] @@ -624,11 +624,11 @@ dependencies = [ "bytes", "futures-core", "http 1.3.1", - "http-body 1.0.1", + "http-body", "http-body-util", "mime", "pin-project-lite", - "sync_wrapper 1.0.2", + "sync_wrapper", "tower-layer", "tower-service", "tracing", @@ -643,7 +643,7 @@ dependencies = [ "axum 0.8.6", "futures-util", "http 1.3.1", - "http-body 1.0.1", + "http-body", "opentelemetry", "opentelemetry-semantic-conventions", "opentelemetry_sdk", @@ -694,12 +694,6 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -1113,7 +1107,7 @@ dependencies = [ "humantime", "log", "pretty_env_logger", - "reqwest 0.12.24", + "reqwest", "serde", "serde_json", "tokio", @@ -1536,7 +1530,7 @@ dependencies = [ "bitflags 2.10.0", "crossterm_winapi", "document-features", - "parking_lot 0.12.5", + "parking_lot", "rustix 1.1.2", "winapi", ] @@ -1817,7 +1811,7 @@ dependencies = [ "hashbrown 0.14.5", "lock_api", "once_cell", - "parking_lot_core 0.9.12", + "parking_lot_core", ] [[package]] @@ -2144,12 +2138,6 @@ dependencies = [ "syn 2.0.110", ] -[[package]] -name = "doc-comment" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "780955b8b195a21ab8e4ac6b60dd1dbdcec1dc6c51c0617964b08c81785e12c9" - [[package]] name = "document-features" version = "0.2.12" @@ -2228,8 +2216,6 @@ dependencies = [ "ic-types", "icp-ledger", "indexmap 2.12.0", - "influxdb2", - "influxdb2-structmap", "itertools 0.13.0", "keyring", "log", @@ -2239,7 +2225,7 @@ dependencies = [ "prost", "regex", "registry-canister", - "reqwest 0.12.24", + "reqwest", "rosetta-core", "rust_decimal", "self_update", @@ -2590,21 +2576,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.2" @@ -2826,12 +2797,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "go-parse-duration" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558b88954871f5e5b2af0e62e2e176c8bde7a6c2c4ed41b13d138d96da2e2cbd" - [[package]] name = "group" version = "0.13.0" @@ -2843,25 +2808,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "h2" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap 2.12.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "h2" version = "0.4.12" @@ -3030,17 +2976,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - [[package]] name = "http-body" version = "1.0.1" @@ -3060,7 +2995,7 @@ dependencies = [ "bytes", "futures-core", "http 1.3.1", - "http-body 1.0.1", + "http-body", "pin-project-lite", ] @@ -3088,30 +3023,6 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" -[[package]] -name = "hyper" -version = "0.14.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.3.27", - "http 0.2.12", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.5.10", - "tokio", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "1.7.0" @@ -3122,9 +3033,9 @@ dependencies = [ "bytes", "futures-channel", "futures-core", - "h2 0.4.12", + "h2", "http 1.3.1", - "http-body 1.0.1", + "http-body", "httparse", "httpdate", "itoa", @@ -3142,7 +3053,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ "http 1.3.1", - "hyper 1.7.0", + "hyper", "hyper-util", "log", "rustls", @@ -3160,26 +3071,13 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ - "hyper 1.7.0", + "hyper", "hyper-util", "pin-project-lite", "tokio", "tower-service", ] -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper 0.14.32", - "native-tls", - "tokio", - "tokio-native-tls", -] - [[package]] name = "hyper-util" version = "0.1.17" @@ -3192,14 +3090,14 @@ dependencies = [ "futures-core", "futures-util", "http 1.3.1", - "http-body 1.0.1", - "hyper 1.7.0", + "http-body", + "hyper", "ipnet", "libc", "percent-encoding", "pin-project-lite", "socket2 0.6.1", - "system-configuration 0.6.1", + "system-configuration", "tokio", "tower-service", "tracing", @@ -3278,7 +3176,7 @@ dependencies = [ "futures-util", "hex", "http 1.3.1", - "http-body 1.0.1", + "http-body", "ic-certification 3.0.3", "ic-transport-types 0.39.3", "ic-verify-bls-signature", @@ -3289,7 +3187,7 @@ dependencies = [ "pkcs8", "rand 0.8.5", "rangemap", - "reqwest 0.12.24", + "reqwest", "sec1", "serde", "serde_bytes", @@ -3326,7 +3224,7 @@ dependencies = [ "futures-util", "hex", "http 1.3.1", - "http-body 1.0.1", + "http-body", "ic-certification 3.0.3", "ic-transport-types 0.40.1", "ic-verify-bls-signature", @@ -3337,7 +3235,7 @@ dependencies = [ "pkcs8", "rand 0.8.5", "rangemap", - "reqwest 0.12.24", + "reqwest", "ring", "sec1", "serde", @@ -3408,7 +3306,7 @@ dependencies = [ "backoff", "futures-util", "http-body-util", - "hyper 1.7.0", + "hyper", "hyper-rustls", "hyper-util", "ic-canister-client-sender", @@ -3493,7 +3391,7 @@ dependencies = [ "icrc-ledger-types", "log", "prost", - "reqwest 0.12.24", + "reqwest", "rewards-calculation 0.6.9", "serde", "sha2 0.10.9", @@ -3776,7 +3674,7 @@ dependencies = [ "ic-crypto-secrets-containers", "ic-crypto-sha2", "ic-types", - "parking_lot 0.12.5", + "parking_lot", "rand 0.8.5", "rand_chacha 0.3.1", "serde", @@ -4024,7 +3922,7 @@ dependencies = [ "bytes", "futures", "futures-util", - "hyper 1.7.0", + "hyper", "ic-logger", "slog", "tokio", @@ -4344,7 +4242,7 @@ dependencies = [ "prometheus-http-query", "regex", "registry-canister", - "reqwest 0.12.24", + "reqwest", "serde", "serde_json", "serde_yaml", @@ -4403,7 +4301,7 @@ dependencies = [ "ic-types", "indexmap 2.12.0", "registry-canister", - "reqwest 0.12.24", + "reqwest", "serde", "serde_json", "strum 0.26.3", @@ -4421,7 +4319,7 @@ dependencies = [ "futures", "ic-adapter-metrics-client", "libc", - "parking_lot 0.12.5", + "parking_lot", "procfs 0.9.1", "prometheus", "tokio", @@ -6036,55 +5934,6 @@ dependencies = [ "web-time", ] -[[package]] -name = "influxdb2" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24cc9f9d9fee9ebda1a77b61769cde513e03ad09607b347602f4ea887657689e" -dependencies = [ - "base64 0.13.1", - "bytes", - "chrono", - "csv", - "fallible-iterator", - "futures", - "go-parse-duration", - "influxdb2-derive", - "influxdb2-structmap", - "ordered-float", - "parking_lot 0.11.2", - "reqwest 0.11.27", - "secrecy 0.8.0", - "serde", - "serde_json", - "snafu 0.6.10", - "url", -] - -[[package]] -name = "influxdb2-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990f899841aa30130fc06f7938e3cc2cbc3d5b92c03fd4b5d79a965045abcf16" -dependencies = [ - "itertools 0.10.5", - "proc-macro2", - "quote", - "regex", - "syn 1.0.109", -] - -[[package]] -name = "influxdb2-structmap" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1408e712051787357e99ff732e44e8833e79cea0fabc9361018abfbff72b6265" -dependencies = [ - "chrono", - "num-traits", - "ordered-float", -] - [[package]] name = "instant" version = "0.1.13" @@ -6137,15 +5986,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.11.0" @@ -6409,7 +6249,7 @@ checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" dependencies = [ "bitflags 2.10.0", "libc", - "redox_syscall 0.5.18", + "redox_syscall", ] [[package]] @@ -6476,7 +6316,7 @@ dependencies = [ "clap", "log", "pretty_env_logger", - "reqwest 0.12.24", + "reqwest", "serde", "serde_json", "tokio", @@ -6506,7 +6346,7 @@ dependencies = [ "anyhow", "clap", "log-noise-filter-backend", - "reqwest 0.12.24", + "reqwest", "serde", "serde_json", "slog", @@ -6722,7 +6562,7 @@ dependencies = [ "opentelemetry-prometheus", "opentelemetry_sdk", "prometheus", - "reqwest 0.12.24", + "reqwest", "retry", "serde", "serde_json", @@ -6747,7 +6587,7 @@ dependencies = [ "humantime", "multiservice-discovery-shared", "regex", - "reqwest 0.12.24", + "reqwest", "serde_json", "service-discovery", "slog", @@ -6770,23 +6610,6 @@ dependencies = [ "service-discovery", ] -[[package]] -name = "native-tls" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework 2.11.1", - "security-framework-sys", - "tempfile", -] - [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -6962,7 +6785,7 @@ dependencies = [ "candid", "ic-agent 0.39.3", "rand 0.9.2", - "reqwest 0.12.24", + "reqwest", "serde", "url", ] @@ -6983,9 +6806,9 @@ dependencies = [ "futures", "futures-util", "http 1.3.1", - "http-body 1.0.1", + "http-body", "http-body-util", - "hyper 1.7.0", + "hyper", "hyper-rustls", "hyper-timeout", "hyper-util", @@ -6998,7 +6821,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "snafu 0.8.9", + "snafu", "tokio", "tower 0.5.2", "tower-http", @@ -7038,50 +6861,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" -[[package]] -name = "openssl" -version = "0.10.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" -dependencies = [ - "bitflags 2.10.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - [[package]] name = "openssl-probe" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" -[[package]] -name = "openssl-sys" -version = "0.9.111" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "opentelemetry" version = "0.28.0" @@ -7141,15 +6926,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" -[[package]] -name = "ordered-float" -version = "3.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" -dependencies = [ - "num-traits", -] - [[package]] name = "p256" version = "0.13.2" @@ -7199,17 +6975,6 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] - [[package]] name = "parking_lot" version = "0.12.5" @@ -7217,21 +6982,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", - "parking_lot_core 0.9.12", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -7242,7 +6993,7 @@ checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.18", + "redox_syscall", "smallvec", "windows-link 0.2.1", ] @@ -7675,7 +7426,7 @@ dependencies = [ "lazy_static", "libc", "memchr", - "parking_lot 0.12.5", + "parking_lot", "procfs 0.16.0", "protobuf", "thiserror 1.0.69", @@ -7716,7 +7467,7 @@ checksum = "0fcebfa99f03ae51220778316b37d24981e36322c82c24848f48c5bd0f64cbdb" dependencies = [ "enum-as-inner", "mime", - "reqwest 0.12.24", + "reqwest", "serde", "time", "url", @@ -8035,15 +7786,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.5.18" @@ -8173,48 +7915,6 @@ dependencies = [ "bytecheck", ] -[[package]] -name = "reqwest" -version = "0.11.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" -dependencies = [ - "base64 0.21.7", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2 0.3.27", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.32", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper 0.1.2", - "system-configuration 0.5.1", - "tokio", - "tokio-native-tls", - "tokio-util", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-streams", - "web-sys", - "winreg", -] - [[package]] name = "reqwest" version = "0.12.24" @@ -8227,9 +7927,9 @@ dependencies = [ "futures-core", "futures-util", "http 1.3.1", - "http-body 1.0.1", + "http-body", "http-body-util", - "hyper 1.7.0", + "hyper", "hyper-rustls", "hyper-util", "js-sys", @@ -8242,7 +7942,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", "tokio-rustls", "tokio-util", @@ -8497,15 +8197,6 @@ dependencies = [ "security-framework 3.5.1", ] -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - [[package]] name = "rustls-pki-types" version = "1.13.0" @@ -8672,12 +8363,12 @@ version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469a3970061380c19852269f393e74c0fe607a4e23d85267382cf25486aa8de5" dependencies = [ - "hyper 1.7.0", + "hyper", "indicatif", "log", "quick-xml", "regex", - "reqwest 0.12.24", + "reqwest", "self-replace", "semver", "serde_json", @@ -8840,7 +8531,7 @@ dependencies = [ "futures", "lazy_static", "log", - "parking_lot 0.12.5", + "parking_lot", "serial_test_derive", ] @@ -9013,7 +8704,7 @@ dependencies = [ "log", "regex", "registry-canister", - "reqwest 0.12.24", + "reqwest", "retry", "serde", "serde_json", @@ -9098,34 +8789,13 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" -[[package]] -name = "snafu" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7" -dependencies = [ - "doc-comment", - "snafu-derive 0.6.10", -] - [[package]] name = "snafu" version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e84b3f4eacbf3a1ce05eac6763b4d629d60cbc94d632e4092c54ade71f1e1a2" dependencies = [ - "snafu-derive 0.8.9", -] - -[[package]] -name = "snafu-derive" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "snafu-derive", ] [[package]] @@ -9152,7 +8822,7 @@ dependencies = [ "humantime", "ic-canisters", "multiservice-discovery-shared", - "reqwest 0.12.24", + "reqwest", "serde_json", "slog", "slog-async", @@ -9268,7 +8938,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" dependencies = [ "new_debug_unreachable", - "parking_lot 0.12.5", + "parking_lot", "phf_shared", "precomputed-hash", ] @@ -9363,12 +9033,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "sync_wrapper" version = "1.0.2" @@ -9389,17 +9053,6 @@ dependencies = [ "syn 2.0.110", ] -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "system-configuration-sys 0.5.0", -] - [[package]] name = "system-configuration" version = "0.6.1" @@ -9408,17 +9061,7 @@ checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.10.0", "core-foundation 0.9.4", - "system-configuration-sys 0.6.0", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", + "system-configuration-sys", ] [[package]] @@ -9683,7 +9326,7 @@ dependencies = [ "bytes", "libc", "mio", - "parking_lot 0.12.5", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2 0.6.1", @@ -9724,16 +9367,6 @@ dependencies = [ "tokio-stream", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.26.4" @@ -9821,11 +9454,11 @@ dependencies = [ "axum 0.7.9", "base64 0.22.1", "bytes", - "h2 0.4.12", + "h2", "http 1.3.1", - "http-body 1.0.1", + "http-body", "http-body-util", - "hyper 1.7.0", + "hyper", "hyper-timeout", "hyper-util", "percent-encoding", @@ -9886,7 +9519,7 @@ dependencies = [ "indexmap 2.12.0", "pin-project-lite", "slab", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", "tokio-util", "tower-layer", @@ -9906,7 +9539,7 @@ dependencies = [ "futures-core", "futures-util", "http 1.3.1", - "http-body 1.0.1", + "http-body", "http-body-util", "iri-string", "pin-project-lite", @@ -10135,12 +9768,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.5" @@ -10718,16 +10345,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "wiremock" version = "0.6.4" @@ -10741,7 +10358,7 @@ dependencies = [ "futures", "http 1.3.1", "http-body-util", - "hyper 1.7.0", + "hyper", "hyper-util", "log", "once_cell", diff --git a/rs/cli/Cargo.toml b/rs/cli/Cargo.toml index 6f3990b57..793282e5e 100644 --- a/rs/cli/Cargo.toml +++ b/rs/cli/Cargo.toml @@ -90,8 +90,6 @@ url = { workspace = true } hex = { workspace = true } ic-registry-common-proto = { workspace = true } base64 = { version = "0.22" } -influxdb2 = "0.5" -influxdb2-structmap = "0.2" prometheus = "0.13" [dev-dependencies] From 3e3ce6332696ef6ac334cdb650578c4b96c79e7c Mon Sep 17 00:00:00 2001 From: Pietro Date: Wed, 12 Nov 2025 14:53:38 +0000 Subject: [PATCH 6/6] repin: --- Cargo.Bazel.lock | 6 +++++- Cargo.lock | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Cargo.Bazel.lock b/Cargo.Bazel.lock index 1b2f865e6..bd8c8c022 100644 --- a/Cargo.Bazel.lock +++ b/Cargo.Bazel.lock @@ -1,5 +1,5 @@ { - "checksum": "c314e0d98e718728f62fcf5ba7112841a0a20cc4fb816e5eaaafd31a23a8bc82", + "checksum": "453c7d22d591a20f7c0289edbecf6681a0d22b8e8f4c6755e992892a1a9ff426", "crates": { "actix-codec 0.5.2": { "name": "actix-codec", @@ -12928,6 +12928,10 @@ "id": "pretty_env_logger 0.5.0", "target": "pretty_env_logger" }, + { + "id": "prometheus 0.13.4", + "target": "prometheus" + }, { "id": "prost 0.13.5", "target": "prost" diff --git a/Cargo.lock b/Cargo.lock index ff9a84770..913e1a361 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3291,7 +3291,7 @@ version = "0.9.0" source = "git+https://github.com/dfinity/ic.git?rev=79ca6c4c6907acb74ea658b05fcb3706787b810f#79ca6c4c6907acb74ea658b05fcb3706787b810f" dependencies = [ "candid", - "ic-error-types 0.2.0 (git+https://github.com/dfinity/ic.git?rev=79ca6c4c6907acb74ea658b05fcb3706787b810f)", + "ic-error-types 0.2.0", "ic-interfaces-adapter-client", "ic-protobuf", "serde", @@ -3410,7 +3410,7 @@ dependencies = [ "ic-canonical-state-tree-hash", "ic-certification-version", "ic-crypto-tree-hash", - "ic-error-types 0.2.0 (git+https://github.com/dfinity/ic.git?rev=79ca6c4c6907acb74ea658b05fcb3706787b810f)", + "ic-error-types 0.2.0", "ic-protobuf", "ic-registry-routing-table", "ic-registry-subnet-type", @@ -3446,7 +3446,7 @@ dependencies = [ "candid", "ic-cdk-executor", "ic-cdk-macros", - "ic-error-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ic-error-types 0.2.0", "ic-management-canister-types", "ic0", "serde", @@ -4080,7 +4080,7 @@ source = "git+https://github.com/dfinity/ic.git?rev=79ca6c4c6907acb74ea658b05fcb dependencies = [ "ic-base-types", "ic-crypto-interfaces-sig-verification", - "ic-error-types 0.2.0 (git+https://github.com/dfinity/ic.git?rev=79ca6c4c6907acb74ea658b05fcb3706787b810f)", + "ic-error-types 0.2.0", "ic-heap-bytes", "ic-interfaces-state-manager", "ic-management-canister-types-private", @@ -4272,7 +4272,7 @@ dependencies = [ "ic-base-types", "ic-btc-interface", "ic-btc-replica-types", - "ic-error-types 0.2.0 (git+https://github.com/dfinity/ic.git?rev=79ca6c4c6907acb74ea658b05fcb3706787b810f)", + "ic-error-types 0.2.0", "ic-protobuf", "ic-utils 0.9.0", "num-traits", @@ -4374,7 +4374,7 @@ dependencies = [ "dfn_candid", "dfn_core", "ic-base-types", - "ic-error-types 0.2.0 (git+https://github.com/dfinity/ic.git?rev=79ca6c4c6907acb74ea658b05fcb3706787b810f)", + "ic-error-types 0.2.0", "ic-ledger-core", "ic-management-canister-types-private", "ic-nervous-system-canisters", @@ -4822,7 +4822,7 @@ dependencies = [ "ic-base-types", "ic-nervous-system-proto", "ic-protobuf", - "rewards-calculation 0.9.0", + "rewards-calculation 0.9.0 (git+https://github.com/dfinity/ic.git?rev=79ca6c4c6907acb74ea658b05fcb3706787b810f)", "rust_decimal", "serde", ] @@ -4835,7 +4835,7 @@ dependencies = [ "bincode", "candid", "erased-serde 0.3.31", - "ic-error-types 0.2.0 (git+https://github.com/dfinity/ic.git?rev=79ca6c4c6907acb74ea658b05fcb3706787b810f)", + "ic-error-types 0.2.0", "prost", "serde", "serde_json", @@ -5106,7 +5106,7 @@ dependencies = [ "ic-certification-version", "ic-config", "ic-crypto-sha2", - "ic-error-types 0.2.0 (git+https://github.com/dfinity/ic.git?rev=79ca6c4c6907acb74ea658b05fcb3706787b810f)", + "ic-error-types 0.2.0", "ic-interfaces", "ic-limits", "ic-logger", @@ -5522,7 +5522,7 @@ dependencies = [ "ic-crypto-internal-types", "ic-crypto-sha2", "ic-crypto-tree-hash", - "ic-error-types 0.2.0 (git+https://github.com/dfinity/ic.git?rev=79ca6c4c6907acb74ea658b05fcb3706787b810f)", + "ic-error-types 0.2.0", "ic-heap-bytes", "ic-limits", "ic-management-canister-types-private",