-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(error-notifications): workspace-level configuration of slack, email, webhook notifications for workflow execution #2157
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile OverviewGreptile SummaryThis PR implements a comprehensive migration from per-workflow webhook notifications to a workspace-level multi-channel notification system. The changes introduce support for webhook, email, and Slack notifications for workflow executions with sophisticated alerting rules including consecutive failure detection and failure rate monitoring. The new system includes a 1-hour cooldown mechanism to prevent notification spam and enforces limits of10 notifications per type with a maximum of 10 email recipients. Key architectural changes include removing the legacy Important Files Changed
Confidence score: 3/5
Sequence DiagramsequenceDiagram
participant User
participant LogsPage as "Logs Page"
participant NotificationSettings as "Notification Settings Modal"
participant WorkspaceAPI as "Workspace Notifications API"
participant Database as "Database"
participant EventSystem as "Log Event System"
participant DeliveryTask as "Notification Delivery Task"
participant ExternalService as "External Service (Webhook/Email/Slack)"
User->>LogsPage: "Click 3-dot menu → Configure Notifications"
LogsPage->>NotificationSettings: "Open notification settings modal"
NotificationSettings->>WorkspaceAPI: "GET /api/workspaces/{id}/notifications"
WorkspaceAPI->>Database: "Query existing notification subscriptions"
Database-->>WorkspaceAPI: "Return subscription list"
WorkspaceAPI-->>NotificationSettings: "Return existing notifications"
User->>NotificationSettings: "Configure new notification (webhook/email/slack)"
User->>NotificationSettings: "Set alert rules (consecutive failures/failure rate)"
User->>NotificationSettings: "Select workflows and filters"
NotificationSettings->>WorkspaceAPI: "POST /api/workspaces/{id}/notifications"
WorkspaceAPI->>Database: "Insert workspace notification subscription"
Database-->>WorkspaceAPI: "Return created subscription"
WorkspaceAPI-->>NotificationSettings: "Return success response"
Note over EventSystem: "When workflow execution completes with error"
EventSystem->>Database: "Query matching notification subscriptions"
Database-->>EventSystem: "Return active subscriptions for workspace"
EventSystem->>EventSystem: "Check alert conditions (consecutive failures/failure rate)"
EventSystem->>Database: "Update lastAlertAt if alert triggered"
EventSystem->>Database: "Insert notification delivery record"
EventSystem->>DeliveryTask: "Trigger notification delivery task"
DeliveryTask->>Database: "Claim delivery record"
DeliveryTask->>DeliveryTask: "Build notification payload with execution details"
alt Webhook Notification
DeliveryTask->>ExternalService: "POST webhook with HMAC signature"
ExternalService-->>DeliveryTask: "HTTP response"
else Email Notification
DeliveryTask->>ExternalService: "Send formatted email"
ExternalService-->>DeliveryTask: "Email delivery status"
else Slack Notification
DeliveryTask->>ExternalService: "Post message to Slack channel"
ExternalService-->>DeliveryTask: "Slack API response"
end
DeliveryTask->>Database: "Update delivery status (success/failed)"
Note over DeliveryTask: "If delivery fails, retry with exponential backoff"
alt Delivery Failed
DeliveryTask->>Database: "Schedule retry with backoff delay"
DeliveryTask->>DeliveryTask: "Wait for retry window"
DeliveryTask->>ExternalService: "Retry delivery (up to 5 attempts)"
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
17 files reviewed, 10 comments
Summary
Adds multi-channel notifications for workflow executions with alerting capabilities.
Alerts system
Consecutive failures: Alert after X failures in a row (resets on success)
Failure rate: Alert when error rate exceeds X% over Y hours (requires full window of data)
Latency threshold: Alert when execution duration exceeds X seconds
Latency spike: Alert when execution is X% slower than average (requires 5+ executions for baseline)
Cost threshold: Alert when single execution cost exceeds $X
No activity: Alert when no executions occur within X hours (checked hourly via cron)
Error count: Alert when total errors exceed X within Y hours
Type of Change
Testing
IN PROGRESS
Checklist