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

ref(events): Add has_stacktrace property to BaseEvent class #79100

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lobsterkatie
Copy link
Member

This adds a new property, has_stacktrace, to the BaseEvent class. It does exactly what you'd expect, given the name, handling the obvious cases (a single stacktrace in either exception or threads) as well as the less obvious ones (top-level stacktraces, such as you might get by using attach_stacktrace with capture_exception, and cases where there are multiple stacktraces, such as with a chained exception).

Note: We currently have a similar utility function, event_content_has_stacktrace, which we use when deciding whether or not to send a given event to Seer. The reasons I chose not to just move that function to a more neutral location and use it are a) that function doesn't handle top-level stacktraces, and b) in cases where there are multiple exceptions, it only looks at the last one in the chain. These are things we probably want to fix, but we can't do that without also changing get_stacktrace_string and adding a bunch of new tests. At that point it felt like I would be straying too far afield from the core purpose of this PR, so instead I just left a TODO.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 15, 2024
@lobsterkatie lobsterkatie force-pushed the kmclb-add-has_stacktrace-to-event-class branch from 81d960a to d79899d Compare October 15, 2024 15:00
@lobsterkatie lobsterkatie marked this pull request as ready for review October 16, 2024 16:57
@lobsterkatie lobsterkatie requested a review from a team as a code owner October 16, 2024 16:57
)

threads = get_path(self.data, "threads", "values") or []
has_thread_frames = any(get_path(thread, "stacktrace", "frames") for thread in threads)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an example of where stack traces are extracted from threads?
So far, I have not seen stack traces being used to group mobile issues.

Copy link
Member Author

@@ -439,6 +440,63 @@ def test_get_hashes_gets_hashes_and_variants_if_none_on_event(self):
assert default_variant.component.values[0].id == "message"
assert default_variant.component.values[0].values == ["Dogs are great!"]

def test_has_stacktrace(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please split this into multiple cases?

Can you please pull these tests out of this class? I don't think we need DB support to run these tests and would make them faster.

@getsantry
Copy link
Contributor

getsantry bot commented Nov 7, 2024

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added Stale and removed Stale labels Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants