FEATURE: Add WebHookEventsDailyAggregate report page (#27573)

* FEATURE: Add WebHookEventsDailyAggregate

Add WebHookEventsDailyAggregate model to store daily aggregates of web hook events.
Add AggregateWebHooksEvents job to aggregate web hook events daily.
Add spec for WebHookEventsDailyAggregate model.

* DEV: Update annotations for web_hook_events_daily_aggregate.rb

* DEV: Update app/jobs/scheduled/aggregate_web_hooks_events.rb

Co-authored-by: Martin Brennan <martin@discourse.org>

* DEV: Address review feedback

Solves:
- https://github.com/discourse/discourse/pull/27542#discussion_r1646961101
- https://github.com/discourse/discourse/pull/27542#discussion_r1646958890
- https://github.com/discourse/discourse/pull/27542#discussion_r1646976808
- https://github.com/discourse/discourse/pull/27542#discussion_r1646979846
- https://github.com/discourse/discourse/pull/27542#discussion_r1646981036

* A11Y: Add translation to retain_web_hook_events_aggregate_days key

* FEATURE: Purge old web hook events daily aggregate

Solves: https://github.com/discourse/discourse/pull/27542#discussion_r1646961101

* DEV:  Update tests for web_hook_events_daily_aggregate

Update WebHookEventsDailyAggregate to not use save! at the end
Solves: https://github.com/discourse/discourse/pull/27542#discussion_r1646984601

* PERF: Change job query to use WebHook table instead of WebHookEvent table

* DEV: Update tests to use `fab!`

* DEV: Address code review feedback.

Add idempotency to job
Add has_many to WebHook

* FEATURE: Add WebHookEventsDailyAggregate report page

Add locales for the new report page
Reorder imports in the report.rb

* DEV: Remove logger line

* FEATURE: Add `auto_insert_none_item` option to `report-filters` components

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
This commit is contained in:
Gabriel Grubba
2024-06-27 10:26:42 -03:00
committed by GitHub
parent 580bad3c02
commit 8d28038666
6 changed files with 109 additions and 36 deletions

View File

@@ -5038,6 +5038,8 @@ en:
label: Category
include_subcategories:
label: "Include Subcategories"
type_of_web_hook_event:
label: "Type of event"
flags:
title: "Moderation Flags"
description: "Description"

View File

@@ -1570,6 +1570,11 @@ en:
user_agent: "User Agent"
page_views: "Pageviews"
description: "List of web crawler user agents, sorted by pageviews."
web_hook_events_daily_aggregate:
title: "Web Hook Events"
xaxis: "Day"
yaxis: "Number of events"
description: "Number of web hook events triggered or their mean duration."
suspicious_logins:
title: "Suspicious Logins"
labels: