lib/spectator/registry.rb in netflix-spectator-rb-0.3.0 vs lib/spectator/registry.rb in netflix-spectator-rb-0.3.1
- old
+ new
@@ -274,9 +274,15 @@
if ms.empty?
Spectator.logger.debug 'No measurements to send'
else
uri = @registry.config[:uri]
+ if uri.nil? || uri.empty?
+ Spectator.logger.info('Ignoring sending of metrics ' \
+ 'since Spectator registry has no valid uri')
+ return
+ end
+
ms.each_slice(@registry.batch_size) do |batch|
payload = payload_for_measurements(batch)
Spectator.logger.info "Sending #{batch.length} measurements to #{uri}"
@http.post_json(uri, payload)
end