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: Add instruction stats tracking to #[update] attribute. #1830

Merged

Conversation

daniel-wong-dfinity-org
Copy link
Contributor

@daniel-wong-dfinity-org daniel-wong-dfinity-org commented Oct 3, 2024

This is generic enough that it can be applied to all ic-cdk-based canisters that use ic-metrics-encoder to expose Prometheus metrics.

Usage

Suppose you already have a main canister file that does this:

use ic_cdk::update;

To apply this throughout that canister, you would simply replace that line with this:

use ic_nervous_system_instruction_stats_update_attribute::update;

Once you do that, instruction stats will be collected for all of your canister methods. To expose that data, you simply need add this call to your encode_metrics function:

ic_instruction_stats::encode_instruction_stats(&mut metrics_encoder)?;

Future Work

In later PRs, the intention is for this to be gradually applied to all NNS and SNS canisters.

👈 Previous PR

@github-actions github-actions bot added the feat label Oct 3, 2024
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the instruction-stats-update-attribute-daniel-wong branch 2 times, most recently from 3b1bde9 to 75df2a8 Compare October 3, 2024 14:21
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the instruction-stats-update-attribute-daniel-wong branch from 3f22418 to da92148 Compare October 4, 2024 17:54
@daniel-wong-dfinity-org daniel-wong-dfinity-org changed the base branch from master to instruction-stats-daniel-wong October 4, 2024 17:55
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the instruction-stats-update-attribute-daniel-wong branch from da92148 to dd956dc Compare October 4, 2024 18:01
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the instruction-stats-update-attribute-daniel-wong branch from dd956dc to 4392bfc Compare October 4, 2024 18:06
@daniel-wong-dfinity-org daniel-wong-dfinity-org marked this pull request as ready for review October 4, 2024 18:45
@daniel-wong-dfinity-org daniel-wong-dfinity-org requested a review from a team as a code owner October 4, 2024 18:45
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the instruction-stats-update-attribute-daniel-wong branch from 4392bfc to 25110e1 Compare October 4, 2024 19:00
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the instruction-stats-update-attribute-daniel-wong branch from 25110e1 to f45f0bc Compare October 14, 2024 16:51
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the instruction-stats-daniel-wong branch 2 times, most recently from 9ac1122 to 233a00c Compare October 21, 2024 15:44
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the instruction-stats-update-attribute-daniel-wong branch from f989b36 to 67f5b74 Compare October 21, 2024 16:01
github-merge-queue bot pushed a commit that referenced this pull request Oct 21, 2024
In the next PR, this is used to come up with an enhanced `#[update]`
attribute.

[👈 Previous PR] | [Next PR 👉]

[👈 Previous PR]: #1828
[Next PR 👉]: #1830
Base automatically changed from instruction-stats-daniel-wong to master October 21, 2024 16:33
…ame thing as the one in ic_cdk. The difference is that this adds instruction stats tracking to canister methods.
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the instruction-stats-update-attribute-daniel-wong branch from 67f5b74 to 4e31b66 Compare October 21, 2024 16:34
@daniel-wong-dfinity-org daniel-wong-dfinity-org added this pull request to the merge queue Oct 21, 2024
Merged via the queue into master with commit 08c6312 Oct 21, 2024
25 checks passed
@daniel-wong-dfinity-org daniel-wong-dfinity-org deleted the instruction-stats-update-attribute-daniel-wong branch October 21, 2024 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants