Skip to content

Feature: Sentry Error Tracking Integration

Overview

Sentry Error Tracking Integration provides error monitoring for both frontend and backend components of the Teams application. This feature complements existing Pino structured logging by providing a dedicated error tracking system with rich context, aggregation, and alerting capabilities.

Feature Purpose

The Sentry integration enables the operations and development teams to proactively identify, diagnose, and resolve errors in production environments. It provides real-time visibility into application health without replacing existing logging infrastructure.

User Value Proposition

For Operations Teams:

  • Real-time alerts when errors occur in production
  • Aggregate similar errors to identify patterns
  • Track error frequency and impact across deployments

For Development Teams:

  • Rich error context (stack traces, breadcrumbs, user actions)
  • Identify which releases introduced regressions
  • Prioritize fixes based on error frequency and user impact
  • Debug production issues with full context

Key Capabilities

1. Backend Error Tracking

Description: Capture and report all unhandled exceptions and errors from the Fastify backend server.

User Experience:

  • Errors automatically captured and sent to Sentry
  • No impact on application performance
  • Stack traces and request context included
  • Database queries and API calls tracked as breadcrumbs

Acceptance Criteria:

  • All unhandled backend exceptions appear in Sentry
  • Request context (URL, method, headers) is captured
  • User ID is included when available
  • Performance overhead < 5ms per request
  • Errors include full stack traces
  • Only 5xx errors captured (not client errors)

2. Frontend Error Tracking

Description: Capture and report all unhandled exceptions and Vue errors from the frontend application.

User Experience:

  • JavaScript errors automatically captured
  • Vue component errors tracked with component tree
  • Network failures and API errors reported
  • No user-visible impact

Acceptance Criteria:

  • All unhandled JavaScript errors appear in Sentry
  • Vue component errors include component hierarchy
  • User actions (clicks, navigation) captured as breadcrumbs
  • Network errors (failed API calls) are tracked
  • No impact on application load time

3. Environment and Release Tracking

Description: Tag errors with environment (dev/staging/production) and release version for accurate tracking across deployments.

User Experience:

  • Operations team can filter errors by environment
  • Identify which releases introduced new errors
  • Track error trends across releases

Acceptance Criteria:

  • All errors tagged with correct environment
  • Release version matches deployed version
  • Errors can be filtered by environment in Sentry UI
  • Frontend and backend errors tagged consistently

4. User Context

Description: Include user information with error reports for better debugging while respecting privacy.

User Experience:

  • Development team can identify which users are affected
  • Filter errors by user to understand user-specific issues
  • Privacy-compliant user identification

Acceptance Criteria:

  • User ID included in all error reports
  • Email addresses included for context
  • No sensitive data sent to Sentry (passwords, tokens, API keys)
  • User context can be disabled via configuration

5. Runtime Configuration

Description: Dynamic configuration system that allows Sentry settings to be changed without rebuilding or redeploying the application.

User Experience:

  • Operations team can enable/disable Sentry without code changes
  • Configuration managed through Helm values
  • Frontend fetches configuration at runtime from /api/config endpoint
  • No application restart required for frontend configuration changes

Acceptance Criteria:

  • Sentry can be enabled/disabled via Helm chart
  • Separate DSNs supported for frontend and backend
  • Sample rates configurable per environment
  • Frontend configuration served dynamically (no rebuild required)
  • Configuration validated during Helm deployment

Technical Architecture

Overview

Sentry integration uses a dual-layer approach:

  • Backend: Initialized before the Fastify application starts, capturing 5xx server errors through the logging plugin
  • Frontend: Dynamically configured at runtime by fetching settings from /api/config endpoint, capturing all unhandled JavaScript and Vue errors

Configuration is managed through environment variables injected by Helm, with frontend settings served dynamically to avoid rebuilds.

API Endpoints

EndpointMethodAuthDescriptionResponse
/api/configGETRequiredReturns runtime configuration for frontend including Sentry settings{ sentry: { enabled, dsn, environment, release } }

Configuration

Sentry is configured through Helm chart values (helm/teams/values.yaml) and injected as environment variables. Key settings:

  • DSN (Data Source Name): Separate DSNs for backend and frontend (frontend falls back to backend DSN if not specified)
  • Environment: Tags errors with deployment environment (dev/staging/production)
  • Release: Associates errors with application version (defaults to chart appVersion)
  • Sample Rate: Control percentage of errors captured

Dependencies

  • @sentry/node - Backend SDK (^10.0.0)
  • @sentry/vue - Frontend SDK (^10.0.0)
  • Sentry SaaS account or self-hosted Sentry instance

UI/UX Design

Sentry operates transparently without user-facing UI components. Error tracking happens automatically:

  • End Users: No visible impact; errors captured silently in the background
  • Operations Teams: Access Sentry dashboard externally to view errors, metrics, and alerts
  • Development Teams: View error details, stack traces, and user context in Sentry's web interface

Privacy and Security Considerations

  1. Data Minimization: Only essential data sent to Sentry
  2. User Privacy: Email addresses included for debugging context
  3. Secrets: No passwords, tokens, or API keys in error reports
  4. GDPR Compliance: User context can be disabled via configuration
  5. Data Retention: Configurable in Sentry project settings

Known Limitations

  • External Dependency: Requires Sentry SaaS or self-hosted instance
  • Quota Management: Sentry pricing based on events captured; requires monitoring and sample rate tuning
  • Data Residency: Data sent to Sentry servers (location depends on Sentry plan)
  • Backend Errors Only 5xx: Client errors (4xx) not captured to avoid noise
  • Async Frontend Init: Sentry initializes after authentication; errors during initial page load may be missed

Future Enhancements

  • Custom Error Filters: Define project-specific error patterns to ignore
  • Alert Integration: Connect Sentry alerts to team notification channels (Slack, email)
  • Source Maps: Upload source maps for better stack traces in production
  • Release Tracking: Automatic release creation and deployment tracking
  • Performance Monitoring: Track API response times and database query performance (if needed in future iterations)

Success Metrics

  • All critical production errors captured in Sentry or GitLab error tracking
  • Mean time to detection (MTTD) for errors < 5 minutes
  • 90% of errors include full context (stack trace, user, breadcrumbs)
  • No sensitive data (passwords, tokens) leaked
  • Performance overhead < 5ms per request