Handle event streaming when entity does not exist
What does this MR do and why?
- Stops errors (Sentry link for exceptions on staging) occuring when attempting to stream audit events that have no entity.
- We cannot stream audit events without an entity as we deduce the root ancestor from the entity.
How to set up and validate locally
-
Enable the flag globally.
Feature.enable(:ff_external_audit_events_namespace)
-
Follow the documentation to set up an audit streaming destination for a group. (Use something like requestbin to setup and endpoint.)
-
Create a project within that group and generate an audit event. (Try adding a member to that group.)
-
Note that the event was sent as expected.
-
In the console, delete the project! (This is the entity)
-
Execute the background job manually inline using the audit event created, assert that no exceptions are raised. (I'm assuming that the last audit event created is the correct one.)
AuditEvents::AuditEventStreamingWorker.new.perform(AuditEvent.last)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Huzaifa Iftikhar