Skip to content

Some system.swap.* metric states are not available in sandbox runtimes #3740

@dabico

Description

@dabico

Describe your environment

OS: Debian Bookworm Slim 12.11
Python version: 3.13.7
Package version: 1.36.0
Instrumentor version: 0.57b0

What happened?

I'm currently developing a FastAPI web application that I launch in Kubernetes pods. Given that they might require root access, I use the gVisor container runtime. I periodically get warnings in the console that metrics related to swap memory can't be computed, and are set to 0.

Steps to Reproduce

  • Launch a minikube local Kubernetes cluster with gvisor addon enabled.
  • Create a FastAPI server and instrument it with SystemMetricsInstrumentor.
  • Build an OCI-compliant image of this web service.
  • Create a pod from this image on the cluster, using gvisor as the runtimeClassName.

Expected Result

If the metrics can't be computed, then they shouldn't be included (this is already the case for some metrics). There should also be no errors in the console.

Actual Result

I periodically see the following warning in the console:

/home/app/.local/lib/python3.13/site-packages/psutil/__init__.py:2036: RuntimeWarning: 'sin' and 'sout' swap memory stats couldn't be determined and were set to 0 ([Errno 2] No such file or directory: '/proc/vmstat')
  return _psplatform.swap_memory()

Additional context

No response

Would you like to implement a fix?

Yes

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions