Class: ScoutApm::FrameworkIntegrations::Sinatra

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/framework_integrations/sinatra.rb

Instance Method Summary collapse

Instance Method Details

#application_nameObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/scout_apm/framework_integrations/sinatra.rb', line 20

def application_name
  possible = ObjectSpace.each_object(Class).select { |klass| klass < ::Sinatra::Base } - [::Sinatra::Application]
  if possible.length == 1
    possible.first.name
  else
    "Sinatra"
  end
rescue => e
  ScoutApm::Agent.instance.context.logger.debug "Failed getting Sinatra Application Name: #{e.message}\n#{e.backtrace.join("\n\t")}"
  "Sinatra"
end

#database_engineObject

TODO: Figure out how to detect this smarter



37
38
39
# File 'lib/scout_apm/framework_integrations/sinatra.rb', line 37

def database_engine
  :mysql
end

#envObject



32
33
34
# File 'lib/scout_apm/framework_integrations/sinatra.rb', line 32

def env
  ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
end

#human_nameObject



8
9
10
# File 'lib/scout_apm/framework_integrations/sinatra.rb', line 8

def human_name
  "Sinatra"
end

#nameObject



4
5
6
# File 'lib/scout_apm/framework_integrations/sinatra.rb', line 4

def name
  :sinatra
end

#present?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/scout_apm/framework_integrations/sinatra.rb', line 16

def present?
  defined?(::Sinatra) && defined?(::Sinatra::Base)
end

#raw_database_adapterObject



41
42
43
# File 'lib/scout_apm/framework_integrations/sinatra.rb', line 41

def raw_database_adapter
  :mysql
end

#versionObject



12
13
14
# File 'lib/scout_apm/framework_integrations/sinatra.rb', line 12

def version
  ::Sinatra::VERSION
end