class TraceView::Reporter
Public Class Methods
clear_all_traces()
click to toggle source
Truncates the trace output file to zero
# File lib/oboe_metal.rb, line 59 def clear_all_traces File.truncate(TRACE_FILE, 0) end
get_all_traces()
click to toggle source
Retrieves all traces written to the trace file
# File lib/oboe_metal.rb, line 68 def get_all_traces io = File.open(TRACE_FILE, 'r') contents = io.readlines(nil) return contents if contents.empty? traces = [] # # We use Gem.loaded_spec because older versions of the bson # gem didn't even have a version embedded in the gem. If the # gem isn't in the bundle, it should rightfully error out # anyways. # if Gem.loaded_specs['bson'].version.to_s < '4.0' s = StringIO.new(contents[0]) until s.eof? traces << if ::BSON.respond_to? :read_bson_document BSON.read_bson_document(s) else BSON::Document.from_bson(s) end end else bbb = BSON::ByteBuffer.new(contents[0]) until bbb.length == 0 traces << Hash.from_bson(bbb) end end traces end
sendReport(evt)
click to toggle source
sendReport
Send the report for the given event
# File lib/oboe_metal.rb, line 50 def sendReport(evt) TraceView.reporter.sendReport(evt) end
start()
click to toggle source
start
# File lib/oboe_metal.rb, line 20 def start return unless TraceView.loaded begin Oboe_metal::Context.init if ENV.key?('TRACEVIEW_GEM_TEST') TraceView.reporter = TraceView::FileReporter.new(TRACE_FILE) else TraceView.reporter = TraceView::UdpReporter.new(TraceView::Config[:reporter_host], TraceView::Config[:reporter_port]) end # Only report __Init from here if we are not instrumenting a framework. # Otherwise, frameworks will handle reporting __Init after full initialization unless defined?(::Rails) || defined?(::Sinatra) || defined?(::Padrino) || defined?(::Grape) TraceView::API.report_init end rescue => e $stderr.puts e.message raise end end
Also aliased as: restart