Class: ScoutApm::InstantReporting
- Inherits:
-
Object
- Object
- ScoutApm::InstantReporting
- Defined in:
- lib/scout_apm/instant_reporting.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(trace, instant_key) ⇒ InstantReporting
constructor
trace is an instance of SlowTransaction instant_key is what was passed in from the browser to trigger the instant trace.
Constructor Details
#initialize(trace, instant_key) ⇒ InstantReporting
trace is an instance of SlowTransaction instant_key is what was passed in from the browser to trigger the instant trace
8 9 10 11 |
# File 'lib/scout_apm/instant_reporting.rb', line 8 def initialize(trace, instant_key) @trace = trace @instant_key = instant_key end |
Instance Method Details
#call ⇒ Object
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 |
# File 'lib/scout_apm/instant_reporting.rb', line 13 def call Thread.new do # Serialize that trace. We reuse the PayloadSerializer, but only provide the metadata and traces. # In this case, the traces array will always have just one element. = { :app_root => ScoutApm::Agent.instance.context.environment.root.to_s, :unique_id => ScoutApm::Utils::UniqueId.simple, :agent_version => ScoutApm::VERSION, :agent_time => Time.now.iso8601, :agent_pid => Process.pid, :platform => "ruby", } metrics = [] traces = [@trace] jobs = [] slow_jobs = [] payload = ScoutApm::Serializers::PayloadSerializer.serialize(, metrics, traces, jobs, slow_jobs) # Hand it off to the reporter for POST to our servers reporter = Reporter.new(context, :instant_trace, @instant_key) reporter.report(payload, {'Content-Type' => 'application/json'} ) end end |