Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Health monitor status for admin panel #10186

Merged
merged 43 commits into from
Feb 18, 2025

Conversation

ehconitin
Copy link
Contributor

@ehconitin ehconitin commented Feb 13, 2025

Health Monitoring for Self-Hosted Instances

This PR implements basic health monitoring for self-hosted instances in the admin panel.

Service Status Checks

We're adding real-time health checks for:

  • Redis Connection
  • Database Connection
  • Worker Status
  • Message Sync Status

Existing Functionality

We already have message sync and captcha counters that store aggregated metrics in cache within a configurable time window (default: 5 minutes).

New Endpoints

  1. /healthz - Basic server health check for Kubernetes pod monitoring
  2. /healthz/{serviceName} - Individual service health checks (returns 200 if healthy)
  3. /metricsz/{metricName} - Time-windowed metrics (message sync, captcha)
  4. GraphQL resolver in admin panel for UI consumption

All endpoints use the same underlying service, with different presentation layers for infrastructure and UI needs.

@ehconitin ehconitin marked this pull request as ready for review February 13, 2025 11:48
@ehconitin ehconitin self-assigned this Feb 13, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR implements a comprehensive health monitoring system for the admin panel, adding detailed status checks for core services and message synchronization with proper error handling and caching.

  • Added three new health indicators in /packages/twenty-server/src/engine/core-modules/health/indicators/ for database, Redis, and worker status monitoring
  • Implemented /healthz/system-status endpoint in health.controller.ts returning detailed service statuses with typed responses
  • Added HealthCacheService with time-windowed monitoring for message sync jobs and invalid captcha attempts
  • Introduced worker health monitoring in worker.health.ts that checks active workers across all BullMQ queues
  • Added proper TypeScript types and enums in /types directory for consistent health status reporting

10 file(s) reviewed, 10 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

@etiennejouan etiennejouan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice ! I don't have all the context Felix and you can have. Feel free to ignore comment if it's not pertinent.

@ehconitin ehconitin changed the title BACKEND - Health monitor status admin for admin panel Health monitor status admin for admin panel Feb 13, 2025
@ehconitin ehconitin changed the title Health monitor status admin for admin panel Health monitor status for admin panel Feb 13, 2025
@FelixMalfait FelixMalfait merged commit d6655a2 into twentyhq:main Feb 18, 2025
46 of 49 checks passed
Copy link
Contributor

Thanks @ehconitin for your contribution!
This marks your 102nd PR on the repo. You're top 1% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants