Module: TraceView::PadrinoInst::Routing

Defined in:
lib/traceview/frameworks/padrino.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



7
8
9
# File 'lib/traceview/frameworks/padrino.rb', line 7

def self.included(klass)
  ::TraceView::Util.method_alias(klass, :dispatch!, ::Padrino::Routing)
end

Instance Method Details

#dispatch_with_traceviewObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/traceview/frameworks/padrino.rb', line 11

def dispatch_with_traceview
  if TraceView.tracing?
    report_kvs = {}

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

    begin
      r = dispatch_without_traceview

      # Report Controller/Action as best possible
      if request.controller and not request.controller.empty?
        report_kvs[:Controller] = request.controller
      else
        report_kvs[:Controller] = self.class
      end

      report_kvs[:Action] = request.action
      r
    ensure
      ::TraceView::API.log_exit('padrino', report_kvs)
    end
  else
    dispatch_without_traceview
  end
end