Module: Oboe::Sinatra::Base

Defined in:
lib/oboe/frameworks/sinatra.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



7
8
9
10
# File 'lib/oboe/frameworks/sinatra.rb', line 7

def self.included(klass)
  ::Oboe::Util.method_alias(klass, :dispatch!,         ::Sinatra::Base)
  ::Oboe::Util.method_alias(klass, :handle_exception!, ::Sinatra::Base)
end

Instance Method Details

#dispatch_with_oboeObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/oboe/frameworks/sinatra.rb', line 12

def dispatch_with_oboe
  if Oboe.tracing?
    report_kvs = {}

    report_kvs[:Controller] = self.class
    report_kvs[:Action] = env['PATH_INFO']

    # Fall back to the raw tracing API so we can pass KVs
    # back on exit (a limitation of the Oboe::API.trace
    # block method) This removes the need for an info
    # event to send additonal KVs
    ::Oboe::API.log_entry('sinatra', {})

    begin
      dispatch_without_oboe
    ensure
      ::Oboe::API.log_exit('sinatra', report_kvs)
    end
  else
    dispatch_without_oboe
  end
end

#handle_exception_with_oboe(boom) ⇒ Object



35
36
37
38
# File 'lib/oboe/frameworks/sinatra.rb', line 35

def handle_exception_with_oboe(boom)
  Oboe::API.log_exception(nil, boom) if Oboe.tracing?
  handle_exception_without_oboe(boom)
end