Class: ManageEngine::Instrumentation::SinatraFramework

Inherits:
Object
  • Object
show all
Defined in:
lib/agent/server/instrument/sinatra.rb

Instance Method Summary collapse

Instance Method Details

#envObject



16
17
18
# File 'lib/agent/server/instrument/sinatra.rb', line 16

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

#instrumentObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/agent/server/instrument/sinatra.rb', line 24

def instrument
  ManageEngine::APMObjectHolder.instance.log.info "Instrumenting Sinatra framework. Version: #{version}"
  ::Sinatra::Base.class_eval do
    include ManageEngine::Instrumentation::APMInsightSinatra
    
    alias original_route_eval route_eval
    alias route_eval apminsight_route_eval
    
#          alias sinatra_exception_handler! handle_exception!
#          alias handle_exception! apminsight_exception_handler!
    
  end # class_eval
end

#nameObject



20
21
22
# File 'lib/agent/server/instrument/sinatra.rb', line 20

def name
  'Sinatra'
end

#present?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/agent/server/instrument/sinatra.rb', line 8

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

#versionObject



12
13
14
# File 'lib/agent/server/instrument/sinatra.rb', line 12

def version
  ::Sinatra::VERSION
end