Skip to content

Commit

Permalink
Report heap size on /metrics (#2468)
Browse files Browse the repository at this point in the history
Currently, there is no reporting of the heap size and that metric has
to be obtained from the respective replica dashboard. This PR makes the
heap size more easily accessible so that we can put it onto the Grafana
dashboard too.
  • Loading branch information
Frederik Rothenberger authored May 8, 2024
1 parent 92ef76e commit b56f605
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/internet_identity/src/http/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ fn encode_metrics(w: &mut MetricsEncoder<Vec<u8>>) -> std::io::Result<()> {
stable64_size() as f64,
"Number of stable memory pages used by this canister.",
)?;
#[cfg(target_arch = "wasm32")]
w.encode_gauge(
"internet_identity_heap_pages",
core::arch::wasm32::memory_size::<0>() as f64,
"Number of heap memory pages used by this canister.",
)?;
w.encode_gauge(
"internet_identity_temp_keys_count",
state::with_temp_keys(|temp_keys| temp_keys.num_temp_keys()) as f64,
Expand Down
1 change: 1 addition & 0 deletions src/internet_identity/tests/integration/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ fn ii_canister_serves_http_metrics() -> Result<(), CallError> {
"internet_identity_max_user_number",
"internet_identity_signature_count",
"internet_identity_stable_memory_pages",
"internet_identity_heap_pages",
"internet_identity_last_upgrade_timestamp",
"internet_identity_inflight_challenges",
"internet_identity_users_in_registration_mode",
Expand Down

0 comments on commit b56f605

Please sign in to comment.