Skip to content

Conversation

@dcantah
Copy link
Contributor

@dcantah dcantah commented Jan 9, 2026

It's possible a user doesn't want the full stats list, and only wants cpu/mem etc. This plumbs through the ability to filter to only what is requested. This, while we're already here, adds in memory.event output to the stats list. For that specifically, I think eventually we may want a streaming variant of this so you can get alerted of changes in the file immediately instead of polling/one off reads, but this is useful for now.

@dcantah
Copy link
Contributor Author

dcantah commented Jan 11, 2026

Ok, I changed my mind. I think the events should just come along the ride in the statistics call we already have. However, I think we should allow filtering what stats a user actually wants in the call too. I'll change this pr

@dcantah dcantah marked this pull request as draft January 11, 2026 20:42
@dcantah dcantah changed the title Expose cgroup memory events to core types Allow filtering container statistics Jan 12, 2026
@dcantah dcantah marked this pull request as ready for review January 12, 2026 20:04
Copy link
Contributor

@egernst egernst left a comment

Choose a reason for hiding this comment

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

Claude input:

  The proto defines GetMemoryEvents at SandboxContext.proto:50 and the server implements it at Server+GRPC.swift:1183-1211, but there's no client-side wrapper. VirtualMachineAgent.swift:97 only has containerStatistics, not getMemoryEvents.

  Memory events are already retrievable via containerStatistics(categories: .memoryEvents), so this dedicated RPC may be redundant. Either:
  - Add a client wrapper if the RPC is intended for direct use
  - Remove it if the category filtering approach supersedes it
  - Add a comment explaining future intent (e.g., streaming support mentioned in commit message)

It's possible a user doesn't want the full stats list,
and only wants cpu/mem etc. This plumbs through the
ability to filter to only what is requested. This, while
we're already here, adds in memory.event output to the
stats list. For that specifically, I think eventually we
may want a streaming variant of this so you can get alerted
of changes in the file immediately instead of polling/one
off reads, but this is useful for now.
Copy link
Contributor

@egernst egernst left a comment

Choose a reason for hiding this comment

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

needs a rebase. lgtm.

@dcantah dcantah merged commit 8446f89 into apple:main Jan 13, 2026
2 checks passed
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.

2 participants