Module: Trailblazer::Pro::Trace::Wtf

Defined in:
lib/trailblazer/pro/trace/wtf.rb

Class Method Summary collapse

Class Method Details

.call(*args, present_options: {}, **options) ⇒ Object Also known as: invoke

DISCUSS: this is called inside the monkey-patch for Activity/Operation.() in Pro::Call.call.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/trailblazer/pro/trace/wtf.rb', line 7

def call(*args, present_options: {}, **options)
  global_present_options =  Session.wtf_present_options
  raise "[Trailblazer] Please configure your PRO API key." if global_present_options.nil?

  present_options =
    global_present_options
      .merge(present_options)
      .merge(session: Session.session)

  returned = Trailblazer::Developer::Wtf.invoke( # identical to {Developer.wtf?}.
    *args,
    present_options: present_options,
    **options
  )

  (session, _trace_id, _debugger_url, _trace_envelope, session_updated) = returned[-1]

  update_session!(session) if session_updated # DISCUSS: this is a hook for pro-rails, not a massive fan.

  returned
end

.update_session!(session) ⇒ Object



33
34
35
# File 'lib/trailblazer/pro/trace/wtf.rb', line 33

def update_session!(session)
  Session.session = session
end