Skip to content

feat(logging-controller): Add expiration to logs - #9839

Merged
FrederikBolding merged 4 commits into
mainfrom
fb/add-log-expiry
Aug 12, 2026
Merged

feat(logging-controller): Add expiration to logs#9839
FrederikBolding merged 4 commits into
mainfrom
fb/add-log-expiry

Conversation

@FrederikBolding

@FrederikBolding FrederikBolding commented Aug 12, 2026

Copy link
Copy Markdown
Member

Explanation

Add expiryTime constructor argument to LoggingController, 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

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes persisted log retention by auto-deleting old entries on add, which can remove historical support/debug data. Scope is limited to LoggingController and the new constructor option is backward-compatible.

Overview
Adds an optional expiryTime constructor argument to LoggingController (default 7 days). On each add, 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-utils dependency in favor of @metamask/utils for duration helpers.

Reviewed by Cursor Bugbot for commit 5e0a54e. Bugbot is set up for automated code reviews on this repo. Configure here.

@FrederikBolding
FrederikBolding marked this pull request as ready for review August 12, 2026 12:04
@FrederikBolding
FrederikBolding requested review from a team as code owners August 12, 2026 12:04

@GuillaumeRx GuillaumeRx Aug 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about also doing it when we initialize the controller ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, we could

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Though it probably doesn't matter much as I think we wouldn't persist until an actual change happens 🤔 WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes that makes sense !

@matthewwalsh0
matthewwalsh0 requested a review from OGPoyraz August 12, 2026 12:08
@FrederikBolding
FrederikBolding added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit a3655ec Aug 12, 2026
769 of 868 checks passed
@FrederikBolding
FrederikBolding deleted the fb/add-log-expiry branch August 12, 2026 13:01
@cursor cursor Bot mentioned this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants