-
Notifications
You must be signed in to change notification settings - Fork 142
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
Add new metrics to monitor memory #2650
Conversation
@frederikrothenberger please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I would just go with ii_archive_heap_pages
which is clearly missing. The rest can be deduced from pages
when processing the data.
src/archive/src/main.rs
Outdated
@@ -575,6 +575,7 @@ fn http_request(req: HttpRequest) -> HttpResponse { | |||
} | |||
|
|||
fn encode_metrics(w: &mut MetricsEncoder<Vec<u8>>) -> std::io::Result<()> { | |||
const WASM_PAGE_SIZE_IN_BYTES: f64 = 65536.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a constant for that in the cdk
. Also, as a side-note: I would not do floating point calculations unless absolutely necessary. Floating point calculations could introduce rounding errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Fixed!
Alarms for memory threshold will be added if we expose this metrics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Motivation
To introduce new metrics that will be used to monitor the memory usage as requested by security.
Changes
ii_archive_stable_memory_bytes
,ii_archive_heap_pages
andii_archive_heap_memory_bytes
metrics to the archive canister.internet_identity_heap_memory_bytes
andinternet_identity_stable_memory_bytes
metrics to main II canister.