Skip to content
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

Improve in_app detection #3682

Open
sentrivana opened this issue Oct 22, 2024 · 2 comments
Open

Improve in_app detection #3682

sentrivana opened this issue Oct 22, 2024 · 2 comments

Comments

@sentrivana
Copy link
Contributor

sentrivana commented Oct 22, 2024

When viewing a stacktrace in Sentry, frames are marked as either in_app or not in_app. Non-in-app frames are collapsed by default. The original in_app decision comes from the SDK; however, at the moment Sentry can't rely on the in_app decision from the SDK and has rules for overriding it.

Two things we can do about this:

  1. On the Sentry side, remove the redundant checks that set a frame as not in-app if the package is in site-packages or dist-packages. We already check this on the SDK side. Having this rule on the server side means that it sometimes overrides a higher prio decision (e.g., the user explicitly set their in_app_include to include the module). Tracked in Tweak in_app rules for events from Python SDK sentry#79482
  2. On the SDK side, look into frames with unexpected in_app values and fix the underlying issues. (Tracked by this issue.)

Supersedes #3671

@sentrivana
Copy link
Contributor Author

sentrivana commented Oct 22, 2024

Example: in_app_include contains ['mypackage'] in this scenario:

  • Why does the SDK not mark as in-app the /app/.heroku/python/lib/python3.11/site-packages/mypackage/__main__.py frame?
  • Should the SDK mark /app/<frozen runpy> as not in-app?
{
  "exception": {
    "values": [
      {
        "stacktrace": {
          "frames": [
            {
              "abs_path": "/app/<frozen runpy>",
              "in_app": true   # why?
            },
            {
              "abs_path": "/app/.heroku/python/lib/python3.11/site-packages/mypackage/__main__.py",
              "in_app": false  # why?
            },
            {
              "abs_path": "/app/.heroku/python/lib/python3.11/site-packages/click/core.py",
              "in_app": false
            },
            {
              "abs_path": "/app/.heroku/python/lib/python3.11/site-packages/click/decorators.py",
              "in_app": false
            },
            {
              "abs_path": "/app/.heroku/python/lib/python3.11/site-packages/mypackage/__main__.py",
              "in_app": false  # why?
            },
            {
              "abs_path": "/app/.heroku/python/lib/python3.11/site-packages/mypackage/dir/some_python_file.py",
              "in_app": false,
              "data": {
                "orig_in_app": 1
              }
            },
            {
              "abs_path": "/app/.heroku/python/lib/python3.11/site-packages/mypackage/another_dir/another_python_file.py",
              "in_app": false,
              "data": {
                "orig_in_app": 1
              }
            }
          ]
        }
      }
    ]
  }
}

@lobsterkatie
Copy link
Member

lobsterkatie commented Oct 24, 2024

Left a comment on #3671, but TL;DR I think this logic should live server-side (which doesn't mean that if we're making wrong decisions there we shouldn't perform this same investigation, of course!).

Meta: Right now, we're having this conversation in four places: here, in getsentry/sentry#79482, in #3671, and in #3672. Can we centralize to one spot as we continue to discuss this? (And/or just hop on a call with you, me, @armenzg , and anyone else who's interested, and just hash it out?)

nijel added a commit to WeblateOrg/weblate that referenced this issue Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants