lib/new_relic/agent/configuration/manager.rb in newrelic_rpm-3.5.5.540.dev vs lib/new_relic/agent/configuration/manager.rb in newrelic_rpm-3.5.6.42.beta
- old
+ new
@@ -18,14 +18,18 @@
@cache = Hash.new {|hash,key| hash[key] = self.fetch(key) }
@callbacks = Hash.new {|hash,key| hash[key] = [] }
end
def apply_config(source, level=0)
+ was_finished = finished_configuring?
+
invoke_callbacks(:add, source)
@config_stack.insert(level, source.freeze)
reset_cache
log_config(:add, source)
+
+ notify_finished_configuring if !was_finished && finished_configuring?
end
def remove_config(source=nil)
if block_given?
@config_stack.delete_if {|c| yield c }
@@ -82,9 +86,17 @@
proc.call(@cache[key])
end
end
end
end
+ end
+
+ def notify_finished_configuring
+ NewRelic::Agent.instance.events.notify(:finished_configuring)
+ end
+
+ def finished_configuring?
+ @config_stack.any? {|s| s.is_a?(ServerSource)}
end
def flattened
@config_stack.reverse.inject({}) do |flat,layer|
thawed_layer = layer.dup