Skip to content

Handle event streaming when entity does not exist

Max Woolf requested to merge mw/handle-null-entity-audit-event-streaming into master

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

  1. Enable the flag globally.

    Feature.enable(:ff_external_audit_events_namespace)
  2. Follow the documentation to set up an audit streaming destination for a group. (Use something like requestbin to setup and endpoint.)

  3. Create a project within that group and generate an audit event. (Try adding a member to that group.)

  4. Note that the event was sent as expected.

  5. In the console, delete the project! (This is the entity)

  6. 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.

Edited by Huzaifa Iftikhar

Merge request reports