Skip to content

Commit

Permalink
feature: introduce /load endpoint for self-reported quantised NymNode…
Browse files Browse the repository at this point in the history
… load
  • Loading branch information
jstuczyn committed Jan 9, 2025
1 parent 11d6ee2 commit 26b1133
Show file tree
Hide file tree
Showing 22 changed files with 472 additions and 62 deletions.
81 changes: 65 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ aes-gcm = "0.10.1"
aes-gcm-siv = "0.11.1"
aead = "0.5.2"
anyhow = "1.0.95"
arc-swap = "1.7.1"
argon2 = "0.5.0"
async-trait = "0.1.84"
axum-client-ip = "0.6.1"
Expand Down Expand Up @@ -324,7 +325,7 @@ strum = "0.26"
strum_macros = "0.26"
subtle-encoding = "0.5"
syn = "1"
sysinfo = "0.30.13"
sysinfo = "0.33.0"
tap = "1.0.1"
tar = "0.4.43"
tempfile = "3.14"
Expand Down
2 changes: 1 addition & 1 deletion common/statistics/src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Default for ClientStatsReport {
pub struct OsInformation {
pub(crate) os_type: String,
pub(crate) os_version: Option<String>,
pub(crate) os_arch: Option<String>,
pub(crate) os_arch: String,
}

impl OsInformation {
Expand Down
22 changes: 11 additions & 11 deletions contracts/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nym-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ license = "GPL-3.0"
[dependencies]
async-trait = { workspace = true }
anyhow.workspace = true
arc-swap = { workspace = true }
bip39 = { workspace = true, features = ["zeroize"] }
bs58.workspace = true
celes = { workspace = true } # country codes
Expand Down
2 changes: 1 addition & 1 deletion nym-node/nym-node-requests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ license.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
base64 = { workspace = true }
celes = { workspace = true } # country codes
humantime = { workspace = true }
humantime-serde = { workspace = true }
schemars = { workspace = true, features = ["preserve_order"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
strum = { workspace = true, features = ["derive"] }
time = { workspace = true, features = ["serde", "formatting", "parsing"] }
thiserror = { workspace = true }

Expand Down
10 changes: 7 additions & 3 deletions nym-node/nym-node-requests/src/api/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ use async_trait::async_trait;
use nym_bin_common::build_information::BinaryBuildInformationOwned;
use nym_http_api_client::{ApiClient, HttpClientError};

use super::v1::gateway::models::Wireguard;
use super::v1::metrics::models::SessionStats;
use crate::api::v1::authenticator::models::Authenticator;
use crate::api::v1::health::models::NodeHealth;
use crate::api::v1::ip_packet_router::models::IpPacketRouter;
use crate::api::v1::network_requester::exit_policy::models::UsedExitPolicy;
use crate::api::v1::network_requester::models::NetworkRequester;
use crate::api::v1::node_load::models::NodeLoad;
pub use nym_http_api_client::Client;

use super::v1::gateway::models::Wireguard;
use super::v1::metrics::models::SessionStats;

pub type NymNodeApiClientError = HttpClientError<ErrorResponse>;

#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
Expand All @@ -30,6 +30,10 @@ pub trait NymNodeApiClientExt: ApiClient {
self.get_json_from(routes::api::v1::health_absolute()).await
}

async fn get_node_load(&self) -> Result<NodeLoad, NymNodeApiClientError> {
self.get_json_from(routes::api::v1::load_absolute()).await
}

async fn get_host_information(&self) -> Result<SignedHostInformation, NymNodeApiClientError> {
self.get_json_from(routes::api::v1::host_info_absolute())
.await
Expand Down
1 change: 1 addition & 0 deletions nym-node/nym-node-requests/src/api/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ pub mod metrics;
pub mod mixnode;
pub mod network_requester;
pub mod node;
pub mod node_load;
4 changes: 4 additions & 0 deletions nym-node/nym-node-requests/src/api/v1/node_load/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright 2025 - Nym Technologies SA <[email protected]>
// SPDX-License-Identifier: Apache-2.0

pub mod models;
Loading

0 comments on commit 26b1133

Please sign in to comment.