Commit e2e4e6d
committed
Add posthog-rails gem for automatic Rails exception tracking
This commit introduces the posthog-rails gem which provides automatic
exception tracking for Rails applications, including:
- Automatic capture of unhandled exceptions via Rails middleware
- Automatic capture of rescued exceptions (configurable)
- Automatic instrumentation of ActiveJob failures
- Integration with Rails 7.0+ error reporter
- Configurable exception exclusion list
- User context capture from controllers
Core library improvements:
- Added comprehensive logging throughout exception capture flow
- Added ExceptionCapture module for standardized exception parsing
- Fixed field handling in Transport to strip internal-only fields
(type, library, library_version, messageId) that are not part of
PostHog's RawEvent struct
- Fixed UUID field handling to avoid sending null values
- Added capture_exception method to Client for explicit exception tracking
The posthog-rails gem includes:
- Railtie for automatic initialization and middleware insertion
- Multiple middleware layers for capturing different exception types
- ErrorSubscriber for Rails 7.0+ error reporter integration
- ActiveJob extensions for job failure tracking
- Comprehensive configuration options1 parent 002c9db commit e2e4e6d
16 files changed
Lines changed: 1550 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
1 | 11 | | |
2 | 12 | | |
3 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
0 commit comments