Skip to content

fix(error-tracking): always use arity when formatting stacktrace frames#122

Merged
rafaeelaudibert merged 1 commit into
PostHog:mainfrom
martosaur:am-anon-functions-arity
May 28, 2026
Merged

fix(error-tracking): always use arity when formatting stacktrace frames#122
rafaeelaudibert merged 1 commit into
PostHog:mainfrom
martosaur:am-anon-functions-arity

Conversation

@martosaur
Copy link
Copy Markdown
Contributor

@martosaur martosaur commented May 27, 2026

💡 Motivation and Context

This PR replaces #119

The problem is that PostHog Error Tracking uses resolved function name as part of the fingerprint for issue grouping. This is fine, but in Elixir SDK function name comes from the stacktrace frames, which are formatted using Exception.format_mfa(module, function, arity_or_args). arity_or_args is exactly that: arity or args. When it's arity, it's a simple integer that is stable across all calls. But when it's args, it's a dynamic value. So when included in the fingerprint, it prevents errors from grouping.

The solution in this PR is to always use arity for formatting, even if we are passed arguments.

💚 How did you test it?

Unit and integration tests

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran sampo add to generate a changeset file

Closes #119

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 27, 2026

Reviews (1): Last reviewed commit: "fix(error-tracking): always use arity wh..." | Re-trigger Greptile

Copy link
Copy Markdown
Member

@rafaeelaudibert rafaeelaudibert left a comment

Choose a reason for hiding this comment

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

Excellent as always! ty

@rafaeelaudibert rafaeelaudibert merged commit 98f1308 into PostHog:main May 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants