Sha256: 5495f6cf225c4823d0a311b86890618fb17dcc9f3fc005039967d87eed13bfa1
Contents?: true
Size: 1.42 KB
Versions: 18
Compression:
Stored size: 1.42 KB
Contents
module Skylight module Worker class Builder include Util::Logging attr_reader :config def initialize(config = Config.new) if Hash === config config = Config.new(config) end @config = config end def build s = strategy case s when 'embedded' trace "building embedded worker" Collector.new(config) when 'standalone' trace "building standalone worker" unless config[:'agent.sockfile_path'] raise ArgumentError, 'agent.sockfile_path config required' end Standalone.new( config, lockfile, server) else raise "unknown strategy: `#{strat}`" end end private def strategy config.get(:'agent.strategy') || default_strategy end def default_strategy ret = if jruby? 'embedded' else 'standalone' end ret.downcase.strip end def lockfile config.get(:'agent.lockfile') do name = [ 'skylight', config.environment ].compact.join('-') File.join(config[:'agent.sockfile_path'], "#{name}.pid") end.to_s end def server config.get(:'agent.server', Server) end def jruby? defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' end end end end
Version data entries
18 entries across 18 versions & 1 rubygems