Skip to content

io counter package import causing startup failures #45283

@rads-1996

Description

@rads-1996

When I bumped azure-monitor-opentelemetry-exporter from 1.0.0b36 to 1.0.0b48 in my app, it failed to start. I am running a debian docker container in Azure App Service. With Supervisor and uwsgi. Here is parts of the stack trace:

...
File "/usr/src/app/.venv/lib/python3.13/site-packages/azure/monitor/opentelemetry/exporter/_performance_counters/init.py", line 4, in
from azure.monitor.opentelemetry.exporter._performance_counters._manager import (
enable_performance_counters,
)
File "/usr/src/app/.venv/lib/python3.13/site-packages/azure/monitor/opentelemetry/exporter/_performance_counters/_manager.py", line 52, in
_io_counters_initial = _PROCESS.io_counters()
File "/usr/src/app/.venv/lib/python3.13/site-packages/psutil/init.py", line 830, in io_counters
return self._proc.io_counters()

File "/usr/src/app/.venv/lib/python3.13/site-packages/psutil/_pslinux.py", line 1718, in wrapper
raise AccessDenied(self.pid, self._name)
psutil.AccessDenied: (pid=41)
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
--- no python application found, check your startup logs for errors ---

Added lazy loading, so it won't do this on import, and more robust handling for when psutil don't have the required access.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions