Commit 5844ca7
authored
feat(dashboard): add structured logging and error filtering for Sentry (#4584)
* feat(dashboard): add structured logging and error filtering for Sentry
- Add structured logger module with specialized methods for tRPC and user action logging
- Create error classification utilities to categorize and map tRPC errors to appropriate log levels
- Implement Sentry error filters to prevent expected tRPC errors from being reported as incidents
- Add logging index module to export logging utilities and error classification functions
- Update Sentry client and server configurations to use new error filtering
- Update tRPC client configuration to integrate structured logging
- Update instrumentation client to apply error filtering on client-side Sentry initialization
- Provides consistent attribute naming and context tracking across all log entries
- Improves observability by distinguishing between expected errors and actual issues
* feat(dashboard): implement dynamic trace sampling across Sentry configs
- Replace static tracesSampleRate with dynamic tracesSampler in client, edge, and server Sentry configurations
- Prioritize 100% sampling for error-prone operations (auth, payment, api/key, tRPC, HTTP 4xx/5xx)
- Reduce sampling to 1% for health checks and monitoring endpoints (healthcheck, health, ping, metrics)
- Eliminate sampling (0%) for static assets (_next/static, favicon, robots.txt, sitemap)
- Set default 10% sampling rate for general operations to reduce noise while maintaining observability
- Add null-safety check for transaction names with 10% fallback sampling
- Reduces Sentry quota usage while ensuring critical errors and operations are fully captured
* Make a reusable trace-sampler1 parent 33d4d6e commit 5844ca7
File tree
10 files changed
+1260
-36
lines changed- web/apps/dashboard
- lib
- logging
- sentry
- trpc
- utils
10 files changed
+1260
-36
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
45 | | - | |
46 | | - | |
| 49 | + | |
| 50 | + | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments