Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,38 @@ type UpdateCyclesManagement = record {
cycles_top_up_increment: opt nat;
};

type environment_variable = record {
name: text;
value: text;
};

type CanisterStatusResponse = record {
query_stats : QueryStats;
status : CanisterStatusType;
ready_for_migration : bool;
version : nat64;
memory_size : nat;
cycles : nat;
settings : DefiniteCanisterSettings;
idle_cycles_burned_per_day : nat;
module_hash : opt vec nat8;
query_stats : QueryStats;
reserved_cycles : nat;
memory_metrics : MemoryMetrics;
};

type CanisterStatusType = variant { stopped; stopping; running };

type MemoryMetrics = record {
wasm_memory_size : nat;
stable_memory_size : nat;
global_memory_size : nat;
wasm_binary_size : nat;
custom_sections_size : nat;
canister_history_size : nat;
wasm_chunk_store_size : nat;
snapshots_size : nat;
};

type DefiniteCanisterSettings = record {
freezing_threshold : nat;
controllers : vec principal;
Expand All @@ -227,6 +246,8 @@ type DefiniteCanisterSettings = record {
reserved_cycles_limit : nat;
log_visibility: LogVisibility;
wasm_memory_limit : nat;
wasm_memory_threshold : nat;
environment_variables : vec environment_variable;
};

type LogVisibility = variant {
Expand Down
16 changes: 6 additions & 10 deletions rs/ethereum/ledger-suite-orchestrator/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#![allow(deprecated)]
use ic_cdk::api::management_canister::main::{
CanisterIdRecord, CanisterStatusResponse, canister_status,
};
use ic_cdk::management_canister::{CanisterStatusArgs, CanisterStatusResult, canister_status};
use ic_cdk::{init, post_upgrade, query, update};
use ic_ledger_suite_orchestrator::candid::Erc20Contract as CandidErc20Contract;
use ic_ledger_suite_orchestrator::candid::{ManagedCanisterIds, OrchestratorArg, OrchestratorInfo};
Expand Down Expand Up @@ -96,13 +93,12 @@ fn post_upgrade(orchestrator_arg: Option<OrchestratorArg>) {
}

#[update]
async fn get_canister_status() -> CanisterStatusResponse {
canister_status(CanisterIdRecord {
canister_id: ic_cdk::id(),
async fn get_canister_status() -> CanisterStatusResult {
canister_status(&CanisterStatusArgs {
canister_id: ic_cdk::api::canister_self(),
})
.await
.expect("failed to fetch canister status")
.0
}

#[query(hidden = true)]
Expand Down Expand Up @@ -200,7 +196,7 @@ fn http_request(req: ic_http_types::HttpRequest) -> ic_http_types::HttpResponse

w.encode_gauge(
"stable_memory_bytes",
ic_cdk::api::stable::stable_size() as f64 * WASM_PAGE_SIZE_IN_BYTES,
ic_cdk::stable::stable_size() as f64 * WASM_PAGE_SIZE_IN_BYTES,
"Size of the stable memory allocated by this canister.",
)?;

Expand All @@ -213,7 +209,7 @@ fn http_request(req: ic_http_types::HttpRequest) -> ic_http_types::HttpResponse
w.gauge_vec("cycle_balance", "Cycle balance of this canister.")?
.value(
&[("canister", "ledger-suite-orchestrator")],
ic_cdk::api::canister_balance128() as f64,
ic_cdk::api::canister_cycle_balance() as f64,
)?;

read_state(|s| {
Expand Down
Loading
Loading