Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

feat: Add metrics about subnet usage on the state tree #191

Merged
merged 31 commits into from
Oct 4, 2023

Conversation

dsarlis
Copy link
Member

@dsarlis dsarlis commented Jun 28, 2023

Motivation

The Internet Computer dashboard exposes various metrics that it retrieves from internal prometheus endpoints, including but not limited to: number of canisters on a subnet, memory used on a subnet, cycles burned, transactions made, etc.

The information shown in the dashboard cannot be verified by 3rd parties as it requires access to internally available only endpoints. As such, people must trust DFINITY who is building the dashboard that they provide correct information. We would like to expose some of these key metrics that show case the usage and capabilities of the IC in a way that is verifiable from external 3rd parties to foster a much more trustworthy ecosystem.

Proposal

The proposed solution is to expose these metrics through the system state tree. The gist of the proposal is to add a path such as:

/subnet/<subnet_id>/metrics

which would return a blob of encoded data capturing the metrics that we would like to expose (could also consider a path per metric but might come with downsides, see my inline comment). This path would be exposed through a new api/v2/subnet/<subnet_id>/read_state endpoint. Having this endpoint allows us to move all other subtree paths under /subnet to be served through this endpoint as well as the /time path.

@netlify
Copy link

netlify bot commented Jun 28, 2023

Deploy Preview for ic-interface-spec ready!

Name Link
🔨 Latest commit 41ae5bf
🔍 Latest deploy log https://app.netlify.com/sites/ic-interface-spec/deploys/64bfe0d591713000082d8ef4
😎 Deploy Preview https://deploy-preview-191--ic-interface-spec.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

spec/index.md Show resolved Hide resolved
@dsarlis dsarlis marked this pull request as ready for review June 28, 2023 13:38
@dsarlis dsarlis requested a review from a team as a code owner June 28, 2023 13:38
@dsarlis
Copy link
Member Author

dsarlis commented Jun 28, 2023

This is modelled a lot after #94. Main difference is that I'm not changing anything about the provisional apis -- does not seem necessary for the metrics case and seemed to be the most contentious point back then.

@Dfinity-Bjoern

This comment was marked as resolved.

@dsarlis

This comment was marked as resolved.

@dsarlis

This comment was marked as resolved.

@dsarlis

This comment was marked as resolved.

@mraszyk

This comment was marked as resolved.

@dsarlis

This comment was marked as resolved.

@mraszyk

This comment was marked as resolved.

dsarlis

This comment was marked as resolved.

spec/index.md Outdated Show resolved Hide resolved
spec/index.md Outdated Show resolved Hide resolved
spec/index.md Outdated Show resolved Hide resolved
spec/index.md Outdated Show resolved Hide resolved
spec/index.md Show resolved Hide resolved
spec/index.md Show resolved Hide resolved
spec/index.md Outdated Show resolved Hide resolved
spec/index.md Show resolved Hide resolved
dsarlis and others added 3 commits July 18, 2023 11:35
Co-authored-by: mraszyk <31483726+mraszyk@users.noreply.github.com>
@netlify
Copy link

netlify bot commented Aug 4, 2023

Deploy Preview for ic-interface-spec ready!

Name Link
🔨 Latest commit 68d301a
🔍 Latest deploy log https://app.netlify.com/sites/ic-interface-spec/deploys/64db36b31e18cd00087e82c9
😎 Deploy Preview https://deploy-preview-191--ic-interface-spec.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions
Copy link

github-actions bot commented Aug 23, 2023

🤖 Here's your preview: https://pjpim-riaaa-aaaak-qckja-cai.icp0.io/docs

spec/index.md Outdated Show resolved Hide resolved
gitlab-dfinity pushed a commit to dfinity/ic that referenced this pull request Aug 31, 2023
feat: EXC-1468: Add subnet metrics to state tree

This MR adds the subnet metrics specified in dfinity/interface-spec#191 in the replicated state as well as exposing them in the state tree under the `subnet/<subnet_id>/metrics` path. This MR only adds the metrics and encodes them in the tree conditionally as long as replicas are running on the corresponding certification version. Follow up MRs will actually bump the certification version and eventually expose the metrics through the proposed new endpoint as per the spec PR. 

See merge request dfinity-lab/public/ic!14438
spec/index.md Outdated Show resolved Hide resolved
Copy link
Contributor

@alin-at-dfinity alin-at-dfinity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you.

gitlab-dfinity pushed a commit to dfinity/ic that referenced this pull request Sep 6, 2023
chore: Rename subnet metrics

This MR updates the subnet metrics included in the state tree according to the latest names agreed to in the [spec](dfinity/interface-spec#191). 

See merge request dfinity-lab/public/ic!14540
spec/index.md Outdated Show resolved Hide resolved
gitlab-dfinity pushed a commit to dfinity/ic that referenced this pull request Sep 27, 2023
feat: EXC-1469: Expose subnet metrics through the http api

This MR implements the new http endpoint to retrieve subnet specific information from the system state tree as specified in dfinity/interface-spec#191. As noted in the spec PR, the canister endpoint supports the existing subnet related paths for backward compatibility reasons. Eventually, these paths will only be accessible through the new subnet endpoint.

The key changes included:
1. Introducing a new `SubnetReadStateService` service modelled similarly to the existing `ReadStateService` which is now named `CanisterReadStateService`.
2. Moving the two services in a sub-module of read_state while keeping some common functions under `read_state.rs`.
3. The new service differs mainly in `verify_paths` and has some other small differences in `call` compared to the existing service due to certain checks that are not relevant.

There are some unit tests included to make sure `SubnetReadStateService` correctly responds only to subnet paths requested and end to end tests will be in a follow up MR. 

See merge request dfinity-lab/public/ic!15000
@mraszyk mraszyk merged commit 30f729b into master Oct 4, 2023
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants