mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-07-25 16:03:48 +00:00
29 lines
726 B
Ruby
29 lines
726 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Gitlab
|
|
module CircuitBreaker
|
|
class Notifier
|
|
CircuitBreakerError = Class.new(RuntimeError)
|
|
|
|
def notify(service_name, event)
|
|
return unless event == 'failure'
|
|
|
|
exception = CircuitBreakerError.new("Service #{service_name}: #{event}")
|
|
exception.set_backtrace(Gitlab::BacktraceCleaner.clean_backtrace(caller))
|
|
|
|
Gitlab::ErrorTracking.track_exception(exception)
|
|
end
|
|
|
|
def notify_warning(_service_name, _message)
|
|
# no-op
|
|
end
|
|
|
|
def notify_run(_service_name, &_block)
|
|
# This gets called by Circuitbox::CircuitBreaker#run to actually execute
|
|
# the block passed.
|
|
yield
|
|
end
|
|
end
|
|
end
|
|
end
|