Skip to content

Implement circuit breaker for audit event streaming

What does this MR do and why?

Implement circuit breaker for audit event streaming using existing GitLab circuit breaker library

  • Based on exception/error code, automatically use thresholds / timeouts

Need to see how I can bubble up the status is failing

References

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Enable the feature flag audit_events_external_destination_streamer_consolidation_refactor
  2. Create a destination of category of any type with invalid credentials/information
  3. Get the object in rails console (AuditEvents::Group::ExternalStreamingDestination or AuditEvents::Instance::ExternalStreamingDestination) and check its config, observe its active key and circuit_breaker object key: destination.active? or destination.circuit_breaker_status
  4. After the circuit status becomes 'open', it should no longer make requests.
  5. You can test this by grabbing an audit event like AuditEvent.last and instantiating the streamer class
  6. AuditEvents::Streaming::Group::Streamer.new('test', audit_event).execute
  7. streamer.execute basically becomes a no-op. You can add print lines here to double-check:

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Andrew Jung

Merge request reports

Loading