Skip to content

Commit d640d4a

Browse files
feat: Added query stats to canister status output (#3551)
1 parent 8f6fc48 commit d640d4a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
# UNRELEASED
44

5+
### feat: query stats support
6+
7+
When using `dfx canister status`, the output now includes the new query statistics. Those might initially be 0, if the feature is not yet enabled on the subnet the canister is installed in.
8+
59
# 0.17.0
610

711
### fix!: always fetch did file from canister when making canister calls

src/dfx/src/commands/canister/status.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async fn canister_status(
4747
"Not Set".to_string()
4848
};
4949

50-
info!(log, "Canister status call result for {}.\nStatus: {}\nControllers: {}\nMemory allocation: {}\nCompute allocation: {}\nFreezing threshold: {}\nMemory Size: {:?}\nBalance: {} Cycles\nReserved: {} Cycles\nReserved Cycles Limit: {}\nModule hash: {}",
50+
info!(log, "Canister status call result for {}.\nStatus: {}\nControllers: {}\nMemory allocation: {}\nCompute allocation: {}\nFreezing threshold: {}\nMemory Size: {:?}\nBalance: {} Cycles\nReserved: {} Cycles\nReserved Cycles Limit: {}\nModule hash: {}\nNumber of queries: {}\nInstructions spent in queries: {}\nTotal query request paylod size (bytes): {}\nTotal query response payload size (bytes): {}",
5151
canister,
5252
status.status,
5353
controllers.join(" "),
@@ -58,7 +58,11 @@ async fn canister_status(
5858
status.cycles,
5959
status.reserved_cycles,
6060
reserved_cycles_limit,
61-
status.module_hash.map_or_else(|| "None".to_string(), |v| format!("0x{}", hex::encode(v)))
61+
status.module_hash.map_or_else(|| "None".to_string(), |v| format!("0x{}", hex::encode(v))),
62+
status.query_stats.num_calls_total,
63+
status.query_stats.num_instructions_total,
64+
status.query_stats.request_payload_bytes_total,
65+
status.query_stats.response_payload_bytes_total,
6266
);
6367
Ok(())
6468
}

0 commit comments

Comments
 (0)