-
Notifications
You must be signed in to change notification settings - Fork 232
Closed
Labels
Description
Describe the bug:
Whenever running on a Linux environment where the file /sys/fs/cgroup/memory/memory.usage_in_bytes
is not available (e.g. Google App Engine), a FileNotFoundError is raised when loading elasticapm installed to a Django web application.
To Reproduce
- Create a Django application.
- Add elasticapm.contrib.django as an INSTALLED_APP configured with a SERVICE_NAME, SECRET_TOKEN, and SERVER_URL.
- Run the application in Google App Engine.
- Load a web page.
Environment (please complete the following information)
- OS: Linux
- Python version: Python 3.8
- Framework and version: Django 3.1
- APM Server version: 7
- Agent version: 5.10.0
Additional context
Here is a copy of the error:
FileNotFoundError: [Errno 2] No such file or directory: '/sys/fs/cgroup/memory/memory.usage_in_bytes'
at read_system_stats (/layers/google.python.pip/pip/lib/python3.8/site-packages/elasticapm/metrics/sets/cpu_linux.py:233)
at __init__ (/layers/google.python.pip/pip/lib/python3.8/site-packages/elasticapm/metrics/sets/cpu_linux.py:91)
at register (/layers/google.python.pip/pip/lib/python3.8/site-packages/elasticapm/metrics/base_metrics.py:70)
at __init__ (/layers/google.python.pip/pip/lib/python3.8/site-packages/elasticapm/base.py:191)
at __init__ (/layers/google.python.pip/pip/lib/python3.8/site-packages/elasticapm/contrib/django/client.py:88)
at get_client (/layers/google.python.pip/pip/lib/python3.8/site-packages/elasticapm/contrib/django/client.py:72)
at ready (/layers/google.python.pip/pip/lib/python3.8/site-packages/elasticapm/contrib/django/apps.py:65)
at populate (/layers/google.python.pip/pip/lib/python3.8/site-packages/django/apps/registry.py:122)
at setup (/layers/google.python.pip/pip/lib/python3.8/site-packages/django/__init__.py:24)
at get_wsgi_application (/layers/google.python.pip/pip/lib/python3.8/site-packages/django/core/wsgi.py:12)
at <module> (/srv/****omitted***/wsgi.py:16)
at <module> (/srv/main.py:1)
at _call_with_frames_removed (<frozen importlib._bootstrap>:219)
at exec_module (<frozen importlib._bootstrap_external>:783)
at _load_unlocked (<frozen importlib._bootstrap>:671)
at _find_and_load_unlocked (<frozen importlib._bootstrap>:975)
at _find_and_load (<frozen importlib._bootstrap>:991)
at _gcd_import (<frozen importlib._bootstrap>:1014)
at import_module (/opt/python3.8/lib/python3.8/importlib/__init__.py:127)
at import_app (/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/util.py:358)
at load_wsgiapp (/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py:39)
at load (/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py:49)
at wsgi (/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/app/base.py:67)
at load_wsgi (/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/workers/base.py:144)
at init_process (/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/workers/base.py:119)
at init_process (/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/workers/gthread.py:92)
at spawn_worker (/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/arbiter.py:583)