mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
chore: use container memory if containerised for oom notifications (#17062)
Currently we query only the underlying host's memory usage for our memory resource monitor. This PR changes that to check if the workspace is in a container, and if so it queries the container's memory usage, falling back to the host's memory usage if not.
This commit is contained in:
@ -965,7 +965,10 @@ func (a *agent) run() (retErr error) {
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to create resources fetcher: %w", err)
|
||||
}
|
||||
resourcesFetcher := resourcesmonitor.NewFetcher(statfetcher)
|
||||
resourcesFetcher, err := resourcesmonitor.NewFetcher(statfetcher)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("new resource fetcher: %w", err)
|
||||
}
|
||||
|
||||
resourcesmonitor := resourcesmonitor.NewResourcesMonitor(logger, clk, config, resourcesFetcher, aAPI)
|
||||
return resourcesmonitor.Start(ctx)
|
||||
|
Reference in New Issue
Block a user