-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better setting of in-app in stack frames #1894
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Zylphrex
reviewed
Feb 10, 2023
Zylphrex
approved these changes
Feb 13, 2023
sl0thentr0py
requested changes
Feb 13, 2023
sl0thentr0py
approved these changes
Feb 15, 2023
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Jul 18, 2024
Previously, in case packages added in `in_app_include` were installed into a location outside of the project root directory, stack frames from those packages were not marked as `in_app`. Cases include running Python from virtualenv, created outside of the project root directory, or Python packages installed into the system using package managers. This resulted in inconsistency: traces from the same project would have different `in_app` flags depending on the deployment method. Steps to reproduce (virtualenv outside of project root): ``` $ docker run --replace --rm --name sentry-postgres -e POSTGRES_USER=sentry -e POSTGRES_PASSWORD=sentry -d -p 5432:5432 postgres $ distrobox create -i ubuntu:24.04 -n 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::test_query_source_with_in_app_include # FAIL ``` Steps to reproduce (system packages): ``` $ docker run --replace --rm --name sentry-postgres -e POSTGRES_USER=sentry -e POSTGRES_PASSWORD=sentry -d -p 5432:5432 postgres $ distrobox create -i ubuntu:24.04 -n 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::test_query_source_with_in_app_include # FAIL ``` In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with `in_app` flag introduction: getsentry#1894 (comment). Note that the `_module_in_list` function returns `False` if `name` is `None`, hence extra check before function call can be omitted to simplify code.
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Jul 18, 2024
Previously, in case packages added in `in_app_include` were installed into a location outside of the project root directory, stack frames from those packages were not marked as `in_app`. Cases include running Python from virtualenv, created outside of the project root directory, or Python packages installed into the system using package managers. This resulted in inconsistency: traces from the same project would have different `in_app` flags depending on the deployment method. Steps to reproduce (virtualenv outside of project root): ``` $ docker run --replace --rm --name sentry-postgres -e POSTGRES_USER=sentry -e POSTGRES_PASSWORD=sentry -d -p 5432:5432 postgres $ distrobox create -i ubuntu:24.04 -n 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::test_query_source_with_in_app_include # FAIL ``` Steps to reproduce (system packages): ``` $ docker run --replace --rm --name sentry-postgres -e POSTGRES_USER=sentry -e POSTGRES_PASSWORD=sentry -d -p 5432:5432 postgres $ distrobox create -i ubuntu:24.04 -n 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::test_query_source_with_in_app_include # FAIL ``` In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with `in_app` flag introduction: getsentry#1894 (comment). Note that the `_module_in_list` function returns `False` if `name` is `None`, hence extra check before function call can be omitted to simplify code.
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Jul 18, 2024
Previously, in case packages added in `in_app_include` were installed into a location outside of the project root directory, stack frames from those packages were not marked as `in_app`. Cases include running Python from virtualenv, created outside of the project root directory, or Python packages installed into the system using package managers. This resulted in inconsistency: traces from the same project would have different `in_app` flags depending on the deployment method. Steps to reproduce (virtualenv outside of project root): ``` $ docker run --replace --rm --name sentry-postgres -e POSTGRES_USER=sentry -e POSTGRES_PASSWORD=sentry -d -p 5432:5432 postgres $ distrobox create -i ubuntu:24.04 -n 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::test_query_source_with_in_app_include # FAIL ``` Steps to reproduce (system packages): ``` $ docker run --replace --rm --name sentry-postgres -e POSTGRES_USER=sentry -e POSTGRES_PASSWORD=sentry -d -p 5432:5432 postgres $ distrobox create -i ubuntu:24.04 -n 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::test_query_source_with_in_app_include # FAIL ``` In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with `in_app` flag introduction: getsentry#1894 (comment). Note that the `_module_in_list` function returns `False` if `name` is `None`, hence extra check before function call can be omitted to simplify code.
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Jul 18, 2024
Previously, in case packages added in `in_app_include` were installed into a location outside of the project root directory, stack frames from those packages were 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 resulted in inconsistency: traces from the same project would have different `in_app` flags depending on the deployment method. Steps to reproduce (virtualenv outside of project root): ``` $ docker run --replace --rm --name sentry-postgres -e POSTGRES_USER=sentry -e POSTGRES_PASSWORD=sentry -d -p 5432:5432 postgres $ distrobox create -i ubuntu:24.04 -n 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::test_query_source_with_in_app_include # FAIL ``` Steps to reproduce (system packages): ``` $ docker run --replace --rm --name sentry-postgres -e POSTGRES_USER=sentry -e POSTGRES_PASSWORD=sentry -d -p 5432:5432 postgres $ distrobox create -i ubuntu:24.04 -n 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::test_query_source_with_in_app_include # FAIL ``` In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with better setting of in-app in stack frames: getsentry#1894 (comment). Note that the `_module_in_list` function returns `False` if `name` is `None` or `items` are falsy, hence extra check before function call can be omitted to simplify code.
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Jul 19, 2024
…root Fix: getsentry#3312 Previously, when packages added in `in_app_include` were installed to a location outside of the project root directory, span from those packages were 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 resulted in an inconsistency: spans from the same project would be different, depending on the deployment method. In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with better setting of in-app in stack frames: getsentry#1894 (comment). Note that the `_module_in_list` function returns `False` if `name` is `None` or `items` are falsy, hence extra check before function call can be omitted to simplify code.
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Jul 19, 2024
…root Fix: getsentry#3312 Previously, when packages added in `in_app_include` were installed to a location outside of the project root directory, span from those packages were 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 resulted in an inconsistency: spans from the same project would be different, depending on the deployment method. In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with better setting of in-app in stack frames: getsentry#1894 (comment). Note that the `_module_in_list` function returns `False` if `name` is `None` or `items` are falsy, hence extra check before function call can be omitted to simplify code.
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Jul 20, 2024
…root Fix: getsentry#3312 Previously, when packages added in `in_app_include` were installed to a location outside of the project root directory, span from those packages were 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 resulted in an inconsistency: spans from the same project would be different, depending on the deployment method. In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with better setting of in-app in stack frames: getsentry#1894 (comment). Note that the `_module_in_list` function returns `False` if `name` is `None` or `items` are falsy, hence extra check before function call can be omitted to simplify code.
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Jul 20, 2024
…root Fix: getsentry#3312 Previously, when packages added in `in_app_include` were installed to a location outside of the project root directory, span from those packages were 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 resulted in an inconsistency: spans from the same project would be different, depending on the deployment method. In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with better setting of in-app in stack frames: getsentry#1894 (comment). Note that the `_module_in_list` function returns `False` if `name` is `None` or `items` are falsy, hence extra check before function call can be omitted to simplify code.
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Jul 20, 2024
…root Fix: getsentry#3312 Previously, when packages added in `in_app_include` were installed to a location outside of the project root directory, span from those packages were 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 resulted in an inconsistency: spans from the same project would be different, depending on the deployment method. In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with better setting of in-app in stack frames: getsentry#1894 (comment). Note that the `_module_in_list` function returns `False` if `name` is `None` or `items` are falsy, hence extra check before function call can be omitted to simplify code.
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Jul 30, 2024
…root Fix: getsentry#3312 Previously, when packages added in `in_app_include` were installed to a location outside of the project root directory, span from those packages were 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 resulted in an inconsistency: spans from the same project would be different, depending on the deployment method. In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with better setting of in-app in stack frames: getsentry#1894 (comment). Note that the `_module_in_list` function returns `False` if `name` is `None` or `items` are falsy, hence extra check before function call can be omitted to simplify code.
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Aug 27, 2024
…root Fix: getsentry#3312 Previously, when packages added in `in_app_include` were installed to a location outside of the project root directory, span from those packages were 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 resulted in an inconsistency: spans from the same project would be different, depending on the deployment method. In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with better setting of in-app in stack frames: getsentry#1894 (comment).
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Aug 27, 2024
…root Fix: getsentry#3312 Previously, when packages added in `in_app_include` were installed to a location outside of the project root directory, span from those packages were 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 resulted in an inconsistency: spans from the same project would be different, depending on the deployment method. In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with better setting of in-app in stack frames: getsentry#1894 (comment).
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Aug 27, 2024
…root Fix: getsentry#3312 Previously, when packages added in `in_app_include` were installed to a location outside of the project root directory, span from those packages were 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 resulted in an inconsistency: spans from the same project would be different, depending on the deployment method. In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with better setting of in-app in stack frames: getsentry#1894 (comment).
rominf
added a commit
to rominf/sentry-python
that referenced
this pull request
Sep 5, 2024
…root Fix: getsentry#3312 Previously, when packages added in `in_app_include` were installed to a location outside of the project root directory, span from those packages were 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 resulted in an inconsistency: spans from the same project would be different, depending on the deployment method. In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with better setting of in-app in stack frames: getsentry#1894 (comment).
sentrivana
pushed a commit
that referenced
this pull request
Oct 1, 2024
…root (#3313) Fix: #3312 Previously, when packages added in `in_app_include` were installed to a location outside of the project root directory, span from those packages were 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 resulted in an inconsistency: spans from the same project would be different, depending on the deployment method. In this change, the logic was slightly changed to avoid these discrepancies and conform to the requirements, described in the PR with better setting of in-app in stack frames: #1894 (comment). --------- Co-authored-by: Daniel Szoke <daniel.szoke@sentry.io> Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
How the
in_app
flag is set in stack trace frames (inset_in_app_in_frames()
):in_app
set, it is left untouched.module
in the frame and it is in thein_app_includes
->in_app=True
module
in the frame and it is in thein_app_excludes
->in_app=False
abs_path
in the frame and the path is in/side-packages/
or/dist-packages/
->in_app=False
abs_path
in the frame and it starts with the current working directory of the process ->in_app=True
in_app
set.Fixes #1754
Fixes #320