mirror of
https://github.com/discourse/discourse.git
synced 2025-07-11 13:46:26 +08:00

introduces comprehensive statistics tracking for the Discourse Automation plugin, allowing users to monitor the performance and execution patterns of their automations: - Add `discourse_automation_stats` table to track execution metrics including run counts, execution times, and performance data - Create a new `Stat` model to handle tracking and retrieving automation statistics - Update the admin UI to display automation stats (runs today/this week/month and last run time) - Modernize the automation list interface using Glimmer components - Replace the older enable/disable icon with a toggle switch for better UX - Add schema annotations to existing models for better code documentation - Include extensive test coverage for the new statistics functionality This helps administrators understand how their automations are performing and identify potential bottlenecks or optimization opportunities. --------- Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com> Co-authored-by: Ted Johansson <ted@discourse.org>
18 lines
575 B
Ruby
18 lines
575 B
Ruby
# frozen_string_literal: true
|
|
class AddAutomationStats < ActiveRecord::Migration[7.2]
|
|
def change
|
|
create_table :discourse_automation_stats do |t|
|
|
t.bigint :automation_id, null: false
|
|
t.date :date, null: false
|
|
t.datetime :last_run_at, null: false
|
|
t.float :total_time, null: false
|
|
t.float :average_run_time, null: false
|
|
t.float :min_run_time, null: false
|
|
t.float :max_run_time, null: false
|
|
t.integer :total_runs, null: false
|
|
end
|
|
|
|
add_index :discourse_automation_stats, %i[automation_id date], unique: true
|
|
end
|
|
end
|