feat(logging-controller): Add expiration to logs - #9839
Merged
Conversation
FrederikBolding
marked this pull request as ready for review
August 12, 2026 12:04
FrederikBolding
temporarily deployed
to
default-branch
August 12, 2026 12:04 — with
GitHub Actions
Inactive
GuillaumeRx
reviewed
Aug 12, 2026
Contributor
There was a problem hiding this comment.
What about also doing it when we initialize the controller ?
Member
Author
There was a problem hiding this comment.
Though it probably doesn't matter much as I think we wouldn't persist until an actual change happens 🤔 WDYT?
Contributor
There was a problem hiding this comment.
Yes that makes sense !
OGPoyraz
approved these changes
Aug 12, 2026
GuillaumeRx
approved these changes
Aug 12, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Add
expiryTimeconstructor argument toLoggingController, it defaults to 7 days.When adding a new log entry, we iterate through the existing logs and discard any that were logged before the expiry cutoff.
Additionally simplifies the controller by using UUID v4, not checking for conflicts and removing an unused dependency on
controller-utils.References
N/A
Checklist
Note
Medium Risk
Changes persisted log retention by auto-deleting old entries on
add, which can remove historical support/debug data. Scope is limited toLoggingControllerand the new constructor option is backward-compatible.Overview
Adds an optional
expiryTimeconstructor argument toLoggingController(default 7 days). On eachadd, expired entries are removed before the new log is stored, so persisted logs no longer grow indefinitely.Also simplifies ID generation by switching from UUID v1 with collision retries to UUID v4, and drops the unused
@metamask/controller-utilsdependency in favor of@metamask/utilsfor duration helpers.Reviewed by Cursor Bugbot for commit 5e0a54e. Bugbot is set up for automated code reviews on this repo. Configure here.