diff --git a/backend/ee-repo-ref.txt b/backend/ee-repo-ref.txt index 44f2972329..5912afd498 100644 --- a/backend/ee-repo-ref.txt +++ b/backend/ee-repo-ref.txt @@ -1 +1 @@ -0f5f42d2f8f5f1af05c8086f3dc7ad38d83750df +8e3fbda05392e641c15262924dc0df47cc42d036 \ No newline at end of file diff --git a/backend/migrations/20241008155800_concurrency_lock_table.down.sql b/backend/migrations/20241008155800_concurrency_lock_table.down.sql new file mode 100644 index 0000000000..2c7ec9a8f8 --- /dev/null +++ b/backend/migrations/20241008155800_concurrency_lock_table.down.sql @@ -0,0 +1,2 @@ +-- Drop the alert_locks table +DROP TABLE IF EXISTS concurrency_locks; diff --git a/backend/migrations/20241008155800_concurrency_lock_table.up.sql b/backend/migrations/20241008155800_concurrency_lock_table.up.sql new file mode 100644 index 0000000000..8449de152a --- /dev/null +++ b/backend/migrations/20241008155800_concurrency_lock_table.up.sql @@ -0,0 +1,6 @@ +-- Create the alert_locks table +CREATE TABLE concurrency_locks ( + id VARCHAR PRIMARY KEY, + last_locked_at TIMESTAMP NOT NULL, + owner VARCHAR NULL +); diff --git a/backend/src/monitor.rs b/backend/src/monitor.rs index 92f69a0d64..576a38de72 100644 --- a/backend/src/monitor.rs +++ b/backend/src/monitor.rs @@ -27,7 +27,7 @@ use windmill_api::{ DEFAULT_BODY_LIMIT, IS_SECURE, OAUTH_CLIENTS, REQUEST_SIZE_LIMIT, SAML_METADATA, SCIM_TOKEN, }; #[cfg(feature = "enterprise")] -use windmill_common::ee::worker_groups_alerts; +use windmill_common::ee::{worker_groups_alerts, jobs_waiting_alerts}; use windmill_common::{ auth::JWT_SECRET, ee::CriticalErrorChannel, @@ -1061,12 +1061,20 @@ pub async fn monitor_db( } }; + let jobs_waiting_alerts_f = async { + #[cfg(feature = "enterprise")] + if server_mode { + jobs_waiting_alerts(&db).await; + } + }; + join!( expired_items_f, zombie_jobs_f, expose_queue_metrics_f, verify_license_key_f, - worker_groups_alerts_f + worker_groups_alerts_f, + jobs_waiting_alerts_f, ); } diff --git a/backend/windmill-common/src/ee.rs b/backend/windmill-common/src/ee.rs index d2b215a5ad..6df93aca78 100644 --- a/backend/windmill-common/src/ee.rs +++ b/backend/windmill-common/src/ee.rs @@ -81,3 +81,6 @@ pub async fn create_customer_portal_session( #[cfg(feature = "enterprise")] pub async fn worker_groups_alerts(_db: &DB) {} + +#[cfg(feature = "enterprise")] +pub async fn jobs_waiting_alerts(_db: &DB) {} diff --git a/frontend/src/lib/components/QueueMetricsDrawer.svelte b/frontend/src/lib/components/QueueMetricsDrawer.svelte index 613a75e716..677f53ea63 100644 --- a/frontend/src/lib/components/QueueMetricsDrawer.svelte +++ b/frontend/src/lib/components/QueueMetricsDrawer.svelte @@ -1,15 +1,418 @@ - + - +
+ {#if $enterpriseLicense} + {#if changesMade} +
Non applied changes
+
+ + +
+ {/if} + + {#if alerts.length > 0} +
+
+ + + + + + + + + + + + + {#each alerts as alert, index} + + + + + + + + + {/each} + +
+ Name + + + Queue Tags to Monitor + + + Jobs + + + Cooldown (s) + + + Time (s) + + Actions
+ {#if editingIndex === index} + + {:else} + {alert.name} + {/if} + + {#if editingIndex === index} +
+ {#each alert.tags_to_monitor as tag} + + {tag} + + + {/each} +
+
+ filterTags(e)} + class="p-1 flex-grow mr-1" + /> + +
+ + + {#if filteredTags.length > 0} +
    + {#each filteredTags as tag} +
  • + +
  • + {/each} +
+ {/if} + {:else} +
+ {#each alert.tags_to_monitor as tag} + {tag} + {/each} +
+ {/if} +
+ {#if editingIndex === index} + + {:else} + {alert.jobs_num_threshold} + {/if} + + {#if editingIndex === index} + + {:else} + {alert.alert_cooldown_seconds} + {/if} + + {#if editingIndex === index} + + {:else} + {alert.alert_time_threshold_seconds} + {/if} + +
+ {#if editingIndex === index} + + {:else} + + + {/if} +
+
+
+
+ {/if} + + +
+ +
+ {:else} +

+ Queue Metric Alerts are an enterprise feature allowing you to monitor queues for waiting jobs. Please upgrade to access this functionality. + Learn more about our plans. +

+ {/if} +
+
+ +
+ + \ No newline at end of file