lib/elastic_apm/agent.rb in elastic-apm-2.4.0 vs lib/elastic_apm/agent.rb in elastic-apm-2.5.0
- old
+ new
@@ -20,20 +20,30 @@
def self.instance # rubocop:disable Style/TrivialAccessors
@instance
end
+ # rubocop:disable Metrics/MethodLength
def self.start(config)
return @instance if @instance
config = Config.new(config) unless config.is_a?(Config)
LOCK.synchronize do
return @instance if @instance
+ unless config.active?
+ config.logger.debug format(
+ '%sAgent disabled with active: false',
+ Logging::PREFIX
+ )
+ return
+ end
+
@instance = new(config).start
end
end
+ # rubocop:enable Metrics/MethodLength
def self.stop
LOCK.synchronize do
return unless @instance