# Update the SNS Root's canister\_status API

**URL:** <https://forum.dfinity.org/t/update-the-sns-roots-canister-status-api/28500>\
**Category:** Developers\
**Tags:** sns\
**Created:** [March 16, 2024, 12:10am UTC](https://forum.dfinity.org/t/update-the-sns-roots-canister-status-api/28500 "2024-03-16T00:10:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![icme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/icme/32/4327_2.png) [@icme](https://forum.dfinity.org/u/icme)\
**Post date:** [March 16, 2024, 12:10am UTC](https://forum.dfinity.org/t/update-the-sns-roots-canister-status-api/28500/1 "2024-03-16T00:10:41Z")

</div>

Currently, the SNS root has a `canister_status` API with the following interface

```auto
canister_status: (record {canister_id:principal}) → (record {
  status:variant {stopped; stopping; running};
  memory_size:nat;
  cycles:nat;
  settings:record {
    controllers:vec principal
  };
  module_hash:opt vec nat8
})

```

This lacks data when compared to the management canister’s `canister_status` API

```auto
canister_status : (record {canister_id:principal}) -> (record {
    status : variant { running; stopping; stopped };
    settings : record {
      controllers : vec principal;
      compute_allocation : nat;
      memory_allocation : nat;
      freezing_threshold : nat;
      reserved_cycles_limit : nat;
    };
    module_hash : opt blob;
    memory_size : nat;
    cycles : nat;
    reserved_cycles : nat;
    idle_cycles_burned_per_day : nat;
});

```

If there isn’t a specific reason for these interfaces to be so different, I’d imagine that the data is all there and just needs to be exposed by the SNS Root canister, so hopefully this would be an easy code change & improvement.

Essentially this `CanisterStatusResult` type just needs to be updated to what is currently coming back from the management canister.

> <https://github.com/dfinity/ic/blob/51a5d78e88742d151d3917839666ba0a699992d2/rs/nervous_system/clients/src/canister_status.rs#L61>

---

<div class="post-metadata">

**Author:** ![icme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/icme/32/4327_2.png) [@icme](https://forum.dfinity.org/u/icme)\
**Post date:** [March 24, 2024, 5:18pm UTC](https://forum.dfinity.org/t/update-the-sns-roots-canister-status-api/28500/2 "2024-03-24T17:18:16Z")

</div>

@DanielThurau @lara

Bumping this for visibility’s sake.

---

<div class="post-metadata">

**Author:** ![diegop](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/diegop/32/569_2.png) [@diegop](https://forum.dfinity.org/u/diegop)\
**Post date:** [March 24, 2024, 9:25pm UTC](https://forum.dfinity.org/t/update-the-sns-roots-canister-status-api/28500/3 "2024-03-24T21:25:42Z")

</div>

Let me ping folks as wel

---

<div class="post-metadata">

**Author:** ![lara](https://avatars.discourse-cdn.com/v4/letter/l/e274bd/32.png) [@lara](https://forum.dfinity.org/u/lara)\
**Post date:** [March 25, 2024, 8:30am UTC](https://forum.dfinity.org/t/update-the-sns-roots-canister-status-api/28500/4 "2024-03-25T08:30:36Z")

</div>

Hi @icme , thanks for tagging, this was helpful to make sure we see it!

While I am collecting pros and cons of adding this, could you maybe explain why you would like to have the additional information there? Is there some use case that you cannot meet without this information or were you just generally wondering why it is not the same?

Thanks and have a good start into the new week!

---

<div class="post-metadata">

**Author:** ![icme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/icme/32/4327_2.png) [@icme](https://forum.dfinity.org/u/icme)\
**Post date:** [March 25, 2024, 8:41am UTC](https://forum.dfinity.org/t/update-the-sns-roots-canister-status-api/28500/5 "2024-03-25T08:41:07Z")

</div>

Sure!

Pros:

- Makes additional metric information about SNS canisters available to SNS developers, or those who wish to help monitor SNS canisters (achieves parity with non-SNS canisters). Many SNS canisters have frozen in the past, so I’m building a solution that will help monitor SNS canisters and provide additional visibility for their DAOs.
- Being able to see the `memory_allocation` metric could have helped to prevent [this issue](https://forum.dfinity.org/t/openchat-proposal-to-temporarily-unregister-the-userindex-canister-from-the-sns/27087)
- Freezing threshold & idle cycles burn are important stats in order to determine at what amount of cycles the canister will freeze
- Cycle balance is already public via the current API, so there is no additional attack vector that isn’t already (potentially) exposed by the current API.
- Having more canister data metrics is generally good?

Cons:

- Development time is required (albeit very little dev time)
- You probably want to keep this up to date as the `canister_status` API evolves (i.e. adding query metrics)

---

<div class="post-metadata">

**Author:** ![lara](https://avatars.discourse-cdn.com/v4/letter/l/e274bd/32.png) [@lara](https://forum.dfinity.org/u/lara)\
**Post date:** [March 27, 2024, 5:29pm UTC](https://forum.dfinity.org/t/update-the-sns-roots-canister-status-api/28500/6 "2024-03-27T17:29:10Z")

</div>

Thanks a lot for the extensive lists!  
We discussed this internally and agree that it would make sense to include the same fields in root as are available on the management canister.  
We will consider the individual fields when we pick up the work, but currently don’t see a reason for any of them not to be copied over.

Thanks for the suggestion!

---

<div class="post-metadata">

**Author:** ![daniel-wong](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/daniel-wong/32/6248_2.png) [@daniel-wong](https://forum.dfinity.org/u/daniel-wong)\
**Post date:** [April 8, 2024, 12:42pm UTC](https://forum.dfinity.org/t/update-the-sns-roots-canister-status-api/28500/7 "2024-04-08T12:42:12Z")

</div>

**Status update** : [Commit 9d5e046](https://sourcegraph.com/github.com/dfinity/ic/-/commit/9d5e046fb5fe618256170ba4cf29d45cf23c2c33?visible=8#diff-6a1790a2ffa68c9ecc1ff0a693aed9b9) adds the following fields to the canister\_status response of SNS root (and NNS root):

- reserved\_cycles
- idle\_cycles\_burned\_per\_day
- within settings:
  - compute\_allocation
  - memory\_allocation
  - freezing\_threshold
  - reserved\_cycles\_limit

IIUC, this fulfills the request being made here. Please, lmk if something is missing.

**Next step(s)**: Most likely, we will make a proposal this Friday to publish a new SNS root WASM with those code changes.

(Of course, SNSs will then have to upgrade to that version in order to run the new behavior.)

---

<div class="post-metadata">

**Author:** ![icme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/icme/32/4327_2.png) [@icme](https://forum.dfinity.org/u/icme)\
**Post date:** [October 25, 2024, 3:42am UTC](https://forum.dfinity.org/t/update-the-sns-roots-canister-status-api/28500/8 "2024-10-25T03:42:25Z")

</div>

@lara @daniel-wong

The `canister_status` API now provides a few additional fields, specifically the interface spec on the management canister has been updated to include:

[`log_visiblity`](https://github.com/dfinity/interface-spec/blob/bed36d9a7a75efe2ad7cd17c132fa7dc59f4d574/spec/_attachments/ic.did#L26) and [`query_stats`](https://github.com/dfinity/interface-spec/blob/bed36d9a7a75efe2ad7cd17c132fa7dc59f4d574/spec/_attachments/ic.did#L253).

These query stats are useful in understanding how much query traffic a canister is receiving.
