API access to "Recent Events" for webhooks
Proposal
Our organization maintains a webhook at our top-level group in GitLab SaaS. Periodically, transient errors occurring on the webhook ingress cause GitLab to temporarily disable the webhook. There are additional issues open regarding being able to accelerate re-enabling the webhook when we discover it's been disabled, but the purpose of this issue is to request API access to the list of "Recent Events" for the webhook. This list already exists within GitLab, as its data is presented in the UI; the ask is solely to allow access to that data via the API as well, in order to allow our automation to discover and record errors within our own data stores to be able to diagnose and hopefully correct those transient errors that are causing the webhook to become disabled.
As per Bojan's comment:
Recent events
in fetching the most recent webhook logs. From the app/controllers/concerns/web_hooks/hook_actions.rb
we can see what are the hook_logs
.
@hook_logs ||= hook.web_hook_logs.recent.page(params[:page]).without_count
We could create a new re-usable module inside the lib/api/hooks
, and mount it to:
project_hooks.rb
system_hooks.rb
group_hooks.rb
E.g.:
resource :hooks do
mount ::API::Hooks::RecentEvents
end
Related issues:
- Trigger test webhooks to cause GitLab to try the webhook again and re-enable it:
- Allow auto-disabled webhooks to self-heal