Commit 1ed2c30
authored
feat: add Sentry error tracking adapter with enterprise features (#63)
Implements comprehensive Sentry integration for production error monitoring and observability.
## Core Features
- Automatic error capture with stack traces and breadcrumbs
- Transaction tracking for distributed tracing
- Message template interpolation preserved in Sentry UI
- Thread-safe metrics collection with atomic counters
- Environment variable support for DSN configuration
## Performance Optimizations
- Stack trace caching with LRU eviction (60.74 ns/op, 95% hit rate)
- String builder pooling for zero-allocation message rendering
- Retry calculation with exponential backoff (11.07 ns/op, 0 allocs)
- Metrics collection using atomics (7.11 ns/op)
## Sampling Strategies
- Fixed rate sampling for predictable overhead
- Adaptive sampling that adjusts to error volume
- Priority-based sampling by log level
- Burst detection with rate limiting
- Group-based sampling to prevent error flooding
- Predefined profiles for common scenarios
- Custom sampling functions for full control
## Production Features
- Retry logic with exponential backoff and jitter
- Real-time metrics and observability
- Breadcrumb buffer with automatic age eviction
- Context enrichment with user and request data
- Performance monitoring with transaction/span tracking
- Comprehensive test coverage (500+ lines)
- 7 example programs demonstrating all features
## Documentation
- Complete integration guide in docs/sinks.md
- Quick reference examples in docs/quick-reference
- README updates with Sentry examples
- Inline documentation for all public APIs
Fixes #4633 files changed
Lines changed: 7016 additions & 3 deletions
File tree
- .github/workflows
- adapters/sentry
- examples
- basic
- breadcrumbs
- context
- metrics
- performance
- retry
- sampling
- scripts
- docs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
67 | 73 | | |
68 | 74 | | |
69 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
727 | 728 | | |
728 | 729 | | |
729 | 730 | | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
730 | 762 | | |
731 | 763 | | |
732 | 764 | | |
| |||
963 | 995 | | |
964 | 996 | | |
965 | 997 | | |
966 | | - | |
| 998 | + | |
967 | 999 | | |
968 | 1000 | | |
969 | 1001 | | |
| |||
992 | 1024 | | |
993 | 1025 | | |
994 | 1026 | | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
995 | 1034 | | |
996 | 1035 | | |
997 | 1036 | | |
| |||
0 commit comments