fix(handler): add synthetic logger stacktrace#152
Conversation
posthog-elixir Compliance ReportDate: 2026-07-02 08:45:44 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
|
Reviews (1): Last reviewed commit: "refactor(handler): use case for syntheti..." | Re-trigger Greptile |
|
Updated the code your suggestion @martosaur, thanks for the review ! |
| "$exception_list": [ | ||
| %{ | ||
| type: "Error with metadata", | ||
| type: "Logger.error", |
There was a problem hiding this comment.
I switched to Logger.#{level} here, because the error message could be dynamic and cause undergrouping as we always use the exception type in fp.
There was a problem hiding this comment.
Oof, that's a whole different topic to be honest. Perhaps it's be best to keep this PR focused on synthetic stacktrace and not change error type logic here?
There was a problem hiding this comment.
Sure, I don't mind splitting the PR. Just to understand, do you capture a lot of exception without crash_reason?
There was a problem hiding this comment.
Exceptions specifically usually have it, but error level logs usually don't, and they are pretty common
|
Reviews (2): Last reviewed commit: "fix(handler): avoid unused reporter help..." | Re-trigger Greptile |
|
@PostHog/team-error-tracking should we get this merged? |
💡 Motivation and Context
Plain Logger messages do not have exception stacktraces, but Logger metadata includes source location information. This adds a synthetic single-frame stacktrace from Logger metadata so error tracking can point plain log messages back to their file, line, and function.
💚 How did you test it?
mix test📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented with pi/coding-agent assistance. The change reuses Logger event metadata (
file,line, andmfa) to create a synthetic raw stacktrace frame only when a real exception stacktrace is absent, and keeps source context enrichment compatible with the current main branch.