Class: NewRelic::Starter

Inherits:
Object
  • Object
show all
Defined in:
lib/new_relic/starter.rb,
lib/new_relic/starter/rack.rb,
lib/new_relic/starter/rails.rb,
lib/new_relic/starter/version.rb,
ext/new_relic_starter/new_relic_starter.c

Overview

NewRelic::Starter starts the New Relic agent by calling Agent.manual_start.

Defined Under Namespace

Classes: Error, Latch, Rack, Railtie

Constant Summary collapse

VERSION =
'0.2.0'

Instance Method Summary collapse

Constructor Details

#initialize(latch) ⇒ NewRelic::Starter

Return a new NewRelic::Starter object.

Parameters:



19
20
21
22
# File 'lib/new_relic/starter.rb', line 19

def initialize(latch)
  @latch = latch
  @started = false
end

Instance Method Details

#start(options = {}) ⇒ Boolean

Starts the new Relic agent if the agent is not started and the latch is opened.

Parameters:

  • options (Hash) (defaults to: {})

    The options passed through to Agent.manual_start

Returns:

  • (Boolean)

    true if the new Relic agent is started



30
31
32
33
34
35
# File 'lib/new_relic/starter.rb', line 30

def start(options = {})
  return false if @started || !@latch.opened?

  NewRelic::Agent.manual_start(options)
  @started = true
end