Module: Oboe::Grape::Endpoint

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



19
20
21
# File 'lib/oboe/frameworks/grape.rb', line 19

def self.included(klass)
  ::Oboe::Util.method_alias(klass, :run, ::Grape::Endpoint)
end

Instance Method Details

#run_with_oboe(env) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/oboe/frameworks/grape.rb', line 23

def run_with_oboe(env)
  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('grape', {})

    begin
      run_without_oboe(env)
    ensure
      ::Oboe::API.log_exit('grape', report_kvs)
    end
  else
    run_without_oboe(env)
  end
end