Skip to content

Commit

Permalink
Merge pull request #9027 from aufi/fix_openstack_ceilometer_reconnect
Browse files Browse the repository at this point in the history
Fix openstack ceilometer reconnection-storm in log
  • Loading branch information
blomquisg authored Jun 21, 2016
2 parents a87cb17 + 231c902 commit e2f1bf8
Showing 1 changed file with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,17 @@ def provider_connection

def each_batch
while @monitor_events
begin
$log.info("Querying Openstack Ceilometer for events newer than #{latest_event_timestamp}...") if $log
events = list_events(query_options).sort_by(&:generated)
@since = events.last.generated unless events.empty?
$log.info("Querying Openstack Ceilometer for events newer than #{latest_event_timestamp}...") if $log
events = list_events(query_options).sort_by(&:generated)
@since = events.last.generated unless events.empty?

amqp_events = filter_unwanted_events(events).map do |event|
converted_event = OpenstackCeilometerEventConverter.new(event)
$log.debug("Openstack Ceilometer is processing a new event: #{event.inspect}") if $log
openstack_event(nil, converted_event.metadata, converted_event.payload)
end

yield amqp_events
rescue => ex
$log.info("Reseting Openstack Ceilometer connection after #{ex}.") if $log
@provider_connection = nil
provider_connection
amqp_events = filter_unwanted_events(events).map do |event|
converted_event = OpenstackCeilometerEventConverter.new(event)
$log.debug("Openstack Ceilometer is processing a new event: #{event.inspect}") if $log
openstack_event(nil, converted_event.metadata, converted_event.payload)
end

yield amqp_events
end
end

Expand Down

0 comments on commit e2f1bf8

Please sign in to comment.