Skip to content

feat: Sentry error tracking, API errors, and user context#596

Merged
ldyrmishiritech merged 6 commits intoRitechSolutions:origin/developmentfrom
edritech:edyrkaj/feat-error-track-system
Apr 8, 2026
Merged

feat: Sentry error tracking, API errors, and user context#596
ldyrmishiritech merged 6 commits intoRitechSolutions:origin/developmentfrom
edritech:edyrkaj/feat-error-track-system

Conversation

@edritech
Copy link
Copy Markdown
Contributor

@edritech edritech commented Apr 2, 2026

Description

  • Bootstrap (main.tsx): async bootstrap() dynamically imports @/plugins/instrument only when VITE_SENTRY_DSN is defined, then mounts the app.
  • Initialization (plugins/instrument.js): Sentry.init with DSN, sendDefaultPii, browser tracing, console logging integration, full trace sample rate, trace propagation targets for known app hosts, and beforeSend that dispatches a custom SENTRY_CLIENT_ERROR_EVENT for client exceptions. In development, showReportDialog is used and the event is dropped from upload (return null).
  • User / tenant (plugins/sentryUserSync.ts): applySentryUserFromMeResponse sets Sentry.setUser from /auth/me (id, username, email) and tenant_id tag from existing auth helpers. Used from persistAuthMe, PermissionProvider (after successful /auth/me), and logout path.
  • Auth types (auth.ts): AuthMeResponse extended with optional id, username, email for Sentry.
  • API layer (config/api.ts): response interceptor calls captureSentryIfApiHttpError for Axios HTTP errors in the 400–599 range when Sentry is configured.
  • Env / types: VITE_SENTRY_DSN documented in frontend/.env.template and declared in vite-env.d.ts.
  • Dependencies: @sentry/react added (lockfiles updated).

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 🏗️ Core implementation (refactoring, architectural changes)
  • 💡 Improvement (enhancement to existing functionality)
  • 📚 Documentation update
  • 🔧 Configuration change
  • 🧪 Test update
  • 💬 New release chat plugin
  • 🚀 New platform release

Note: This PR follows Ritech's contribution guidelines for GenAssist. For questions, refer to CONTRIBUTING.md or contact the Ritech team.

edritech added 3 commits April 2, 2026 14:09
- Added Sentry for error tracking in the application, including initialization based on the VITE_SENTRY_DSN environment variable.
- Implemented a test button in the Index component to trigger Sentry error logging.
- Updated package.json and package-lock.json to include the @sentry/react dependency.
- Enhanced main.tsx to support asynchronous bootstrapping for Sentry integration.
- Added Sentry DSN configuration to the .env.template for error tracking.
- Implemented error capturing in API requests using Sentry.
- Integrated user context synchronization with Sentry upon successful authentication.
- Introduced a new event for Sentry error handling in the instrument plugin.
- Created utility functions for managing Sentry user data based on authentication responses.
@edritech edritech self-assigned this Apr 2, 2026
@github-actions github-actions bot added frontend Means, the <frontend> folder is changed in the work progress size/medium enhancement New feature or request labels Apr 2, 2026
- Replaced the import of the `instrument` plugin with `sentryInit.js` for better clarity and organization.
- Updated documentation comment to reflect the change in event dispatching from `sentryInit`.
- Introduced a new `sentryInit.js` file to handle Sentry configuration and error capturing logic.
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 3, 2026
@edritech
Copy link
Copy Markdown
Contributor Author

edritech commented Apr 3, 2026

cc: @ldyrmishiritech When we deploy on our environments we should have:

  • new env
VITE_SENTRY_DSN=xxx

VITE => MODE = development | test | production

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 3, 2026
@edritech edritech marked this pull request as ready for review April 7, 2026 07:53
@edritech edritech requested a review from a team April 7, 2026 07:53
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 7, 2026
@ldyrmishiritech ldyrmishiritech merged commit b432598 into RitechSolutions:origin/development Apr 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request frontend Means, the <frontend> folder is changed in the work progress size/medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants