Skip to content

feat: canister logs extension#6106

Closed
mraszyk wants to merge 9 commits into
masterfrom
mraszyk/canister-log-memory-limit
Closed

feat: canister logs extension#6106
mraszyk wants to merge 9 commits into
masterfrom
mraszyk/canister-log-memory-limit

Conversation

@mraszyk
Copy link
Copy Markdown
Contributor

@mraszyk mraszyk commented Oct 9, 2025

This PR specifies extensions to the canister logs feature:

  • the management canister endpoint fetch_canister_logs can be called by canisters (via replicated calls), cycles to cover the work to fetch canister logs need to be attached to such a call;
  • log_memory_limit field of canister settings to specify the maximum amount of memory used by canister logs (can be set up to 2 MiB);
  • log_memory_store_size field of memory metrics reported by the canister_status endpoint of the management canister containing the actual amount of memory used by canister logs.

@mraszyk mraszyk requested review from a team as code owners October 9, 2025 06:28
@github-actions github-actions Bot added interface-spec Changes to the IC Interface Specification documentation Changes to Developer Docs labels Oct 9, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 9, 2025

🤖 Here's your preview: https://6ke4v-3aaaa-aaaam-abc3q-cai.icp0.io

freezing_threshold : opt nat;
reserved_cycles_limit : opt nat;
log_visibility : opt log_visibility;
log_memory_limit : opt nat;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This PR should be merged when the roll-out is complete and changelog should be updated (shortly) before merging (to avoid merge conflicts).

Copy link
Copy Markdown
Contributor

@Dfinity-Bjoern Dfinity-Bjoern left a comment

Choose a reason for hiding this comment

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

Looks good please merge when appropriate!

@mraszyk mraszyk requested review from a team as code owners March 6, 2026 13:45
@mraszyk mraszyk changed the title feat: canister log memory limit in canister settings feat: improved canister logs Mar 6, 2026
@mraszyk mraszyk changed the title feat: improved canister logs feat: canister logs extension Mar 6, 2026
lwshang added a commit to dfinity/icp-cli that referenced this pull request Apr 2, 2026
fetch_canister_logs is not yet available in replicated mode, so hide the
--proxy flag from --help and mark the test as #[ignore] until the IC
spec change lands (dfinity/portal#6106).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lwshang added a commit to dfinity/icp-cli that referenced this pull request Apr 8, 2026
* refactor: add proxy_management module with create_canister wrapper

Extract the proxied management canister create_canister call into a
dedicated proxy_management module, keeping raw IC types as the interface.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: route all management canister calls through proxy_management

Replace every `ManagementCanister::create` / `ic_utils` builder call
with the corresponding `proxy_management::*` wrapper that dispatches
via `update_or_proxy`. Each call site now accepts an optional proxy
principal, currently passed as `None`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: set effective_canister_id for direct management canister calls

Management canister calls routed through `update_or_proxy` were missing
the effective_canister_id, causing the IC HTTP endpoint to fail with
"canister_not_found" when routing the request. The old `ic_utils::ManagementCanister`
set this automatically; the new raw `agent.update()` path needs it explicitly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: use Candid-encoded empty args for install_code default

When no init args are provided, the old ic_utils builder serialized
an empty Candid message (DIDL\x00\x00) via `Encode!()`. The refactored
code used `unwrap_or_default()` producing raw empty bytes, which the
management canister cannot parse as valid Candid.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: use query call for direct fetch_canister_logs

fetch_canister_logs is a query method on the management canister, not an
update. When no proxy is provided, make a direct query call instead of
routing through update_or_proxy. Introduce FetchCanisterLogsError to
model the distinct direct-query and proxied-update error paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add --proxy flag to canister subcommands

Add a --proxy CLI flag to all `icp canister` subcommands that involve
management canister calls via proxy_management, allowing users to route
these calls through a proxy canister.

Commands updated: start, stop, delete, install, status, logs,
migrate-id, settings update, settings sync, snapshot create/restore/
list/delete.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: update changelog and CLI reference for --proxy flag

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add --proxy flag to icp deploy command

Route management canister calls through a proxy canister during deploy.
Includes a TODO for the known limitation where sync steps (asset uploads)
fail for newly created frontend canisters when using --proxy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: add integration tests for --proxy flag across canister commands

Cover deploy, install, delete, status, stop, start, settings update,
settings sync, and the full snapshot workflow through a proxy canister.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: add ignored integration test for canister logs --proxy

fetch_canister_logs is not yet available in replicated mode, so hide the
--proxy flag from --help and mark the test as #[ignore] until the IC
spec change lands (dfinity/portal#6106).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: warn on effective controller removal in canister settings update

When --proxy is set, the proxy canister is the effective controller
making management calls. The self-removal warning now checks the proxy
principal instead of the caller's identity, preventing false prompts
(and "not a terminal" errors in tests) when adding controllers to
proxy-deployed canisters. Warning messages are also updated to be
accurate for each case.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: add --proxy flag to snapshot download and upload commands

Thread proxy through all snapshot transfer operations so that
snapshot download/upload can be routed through a proxy canister.
Also extend the proxy workflow integration test to cover these commands.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: update CLI reference for snapshot download/upload --proxy flag

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mraszyk
Copy link
Copy Markdown
Contributor Author

mraszyk commented May 13, 2026

Superseded by dfinity/developer-docs#252

@mraszyk mraszyk closed this May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Changes to Developer Docs interface-spec Changes to the IC Interface Specification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants