You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(tracing): Test add_query_source with modules outside of project root
When packages added in `in_app_include` are installed to a location
outside of the project root directory, span from those packages are not
extended with OTel compatible source code information. Cases include
running Python from virtualenv created outside of the project root
directory or Python packages installed into the system using package
managers. This results in an inconsistency: spans from the same project
are be different, depending on the deployment method.
The change extends `test_query_source_with_in_app_include` to test the
simulation of Django installed outside of the project root.
The steps to manually reproduce the issue are as follows
(case: a virtual environment created outside of the project root):
```bash
docker run --replace --rm --detach \
--name sentry-postgres \
--env POSTGRES_USER=sentry \
--env POSTGRES_PASSWORD=sentry \
--publish 5432:5432 \
postgres
distrobox create \
--image ubuntu:24.04 \
--name sentry-test-in_app_include-venv
distrobox enter sentry-test-in_app_include-venv
python3 -m venv /tmp/.venv-test-in_app_include
source /tmp/.venv-test-in_app_include/bin/activate
pytest tests/integrations/django/test_db_query_data.py \
-k test_query_source_with_in_app_include # FAIL
```
The steps to manually reproduce the issue are as follows
(case: Django is installed through system packages):
```bash
docker run --replace --rm --detach \
--name sentry-postgres \
--env POSTGRES_USER=sentry \
--env POSTGRES_PASSWORD=sentry \
--publish 5432:5432 \
postgres
distrobox create \
--image ubuntu:24.04 \
--name sentry-test-in_app_include-os
distrobox enter sentry-test-in_app_include-os
sudo apt install \
python3-django python3-pytest python3-pytest-cov \
python3-pytest-django python3-jsonschema python3-urllib3 \
python3-certifi python3-werkzeug python3-psycopg2
pytest tests/integrations/django/test_db_query_data.py \
-k test_query_source_with_in_app_include # FAIL
```
0 commit comments