module ElasticAPM::Grape

def start(app, config = {})

Returns:
  • (true, nil) - true if the agent was started, nil otherwise.

Parameters:
  • config (Config, Hash) -- An instance of Config or a Hash config.
  • app (Grape::API) -- A Grape app.
def start(app, config = {})
  config = Config.new(config) unless config.is_a?(Config)
  configure_app(app, config)
  ElasticAPM.start(config).tap do |agent|
    attach_subscriber(agent)
  end
  ElasticAPM.running?
rescue StandardError => e
  config.logger.error format('Failed to start: %s', e.message)
  config.logger.debug "Backtrace:\n" + e.backtrace.join("\n")
end