Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added query stats to canister status endpoint #432

Merged
merged 11 commits into from
Nov 20, 2023
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ opt-level = 'z'

[workspace.dependencies]
ic0 = { path = "src/ic0", version = "0.21.1" }
ic-cdk = { path = "src/ic-cdk", version = "0.11.3" }
ic-cdk = { path = "src/ic-cdk", version = "0.11.4" }
ic-cdk-timers = { path = "src/ic-cdk-timers", version = "0.5.1" }

candid = "0.9.6"
Expand Down
4 changes: 3 additions & 1 deletion scripts/download_state_machine_binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ cd "$SCRIPTS_DIR/.."

uname_sys=$(uname -s | tr '[:upper:]' '[:lower:]')
echo "uname_sys: $uname_sys"
commit_sha="15e69667ae983fa92c33794a3954d9ca87518af6"
# Check https://gitlab.com/dfinity-lab/public/ic/-/commits/master
# Find the most recent commit with a green check mark (the artifacts were built successfully)
commit_sha="f3216c1d7d83a366b4af0cf24708f84819880246"

curl -sLO "https://download.dfinity.systems/ic/$commit_sha/binaries/x86_64-$uname_sys/ic-test-state-machine.gz"
gzip -d ic-test-state-machine.gz
Expand Down
16 changes: 11 additions & 5 deletions src/ic-cdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.11.4] - 2023-11-20

### Added

- `query_stats` in `canister_status` response. (#432)

## [0.11.3] - 2023-10-12

### Added
Expand Down Expand Up @@ -203,7 +209,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- `StableWriter` and `StableReader` are now wrappers around `StableIO`.
- `StableWriter` and `StableReader` are now wrappers around `StableIO`.

## [0.6.5] - 2022-11-04

Expand Down Expand Up @@ -309,14 +315,14 @@ BREAKING CHANGE of experimental API:
- Add Clone and Copy to RejectionCode (#202)

### Fixed
- Do not call done() in stable_restore() (#216)
- Do not call done() in stable_restore() (#216)
- Remove out-of-bounds vulnerability (#208)
- Run inter-canister calls without awaiting (#233)

## [0.4.0] - 2022-01-26
### Changed
- `candid` is required to be included in `[dependencies]` to use the `#[import]` macro (#190)
- Deprecate block_on in favour of the new spawn function (#189)
- `candid` is required to be included in `[dependencies]` to use the `#[import]` macro (#190)
- Deprecate block_on in favour of the new spawn function (#189)
- Trap in setup panic hook (#172)

## [0.3.3] - 2021-11-17
Expand All @@ -325,5 +331,5 @@ BREAKING CHANGE of experimental API:

## [0.3.2] - 2021-09-16
### Added
- Add support for 64 bit stable memory (#137)
- Add support for 64 bit stable memory (#137)
- Add support for 'heartbeat' and 'inspect_message' (#129)
2 changes: 1 addition & 1 deletion src/ic-cdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ic-cdk"
version = "0.11.3"
version = "0.11.4"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
13 changes: 13 additions & 0 deletions src/ic-cdk/src/api/management_canister/main/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,17 @@ pub struct DefiniteCanisterSettings {
pub freezing_threshold: Nat,
}

/// Query statistics, returned by [canister_status](super::canister_status).
#[derive(
CandidType, Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize,
)]
pub struct QueryStats {
num_calls_total: candid::Nat,
num_instructions_total: candid::Nat,
request_payload_bytes_total: candid::Nat,
response_payload_bytes_total: candid::Nat,
}

/// Argument type of [canister_status](super::canister_status).
#[derive(
CandidType, Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone,
Expand All @@ -181,6 +192,8 @@ pub struct CanisterStatusResponse {
pub cycles: Nat,
/// Amount of cycles burned per day.
pub idle_cycles_burned_per_day: Nat,
/// Query statistics
pub query_stats: QueryStats,
}

/// Details about a canister change initiated by a user.
Expand Down