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
- Enable the feature flag
audit_events_external_destination_streamer_consolidation_refactor - Create a destination of category of any type with invalid credentials/information
- Get the object in rails console (
AuditEvents::Group::ExternalStreamingDestinationorAuditEvents::Instance::ExternalStreamingDestination) and check its config, observe itsactivekey andcircuit_breakerobject key:destination.active?ordestination.circuit_breaker_status - After the circuit status becomes 'open', it should no longer make requests.
- You can test this by grabbing an audit event like
AuditEvent.lastand instantiating the streamer class AuditEvents::Streaming::Group::Streamer.new('test', audit_event).execute- 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