Class: Oboe::Reporter
- Inherits:
-
Object
- Object
- Oboe::Reporter
- Defined in:
- lib/oboe_metal.rb
Class Method Summary collapse
-
.clear_all_traces ⇒ Object
clear_all_traces.
-
.get_all_traces ⇒ Object
get_all_traces.
- .sendReport(evt) ⇒ Object
-
.start ⇒ Object
Initialize the Oboe Context, reporter and report the initialization.
Class Method Details
.clear_all_traces ⇒ Object
clear_all_traces
Truncates the trace output file to zero
48 49 50 |
# File 'lib/oboe_metal.rb', line 48 def self.clear_all_traces File.truncate($trace_file, 0) end |
.get_all_traces ⇒ Object
get_all_traces
Retrieves all traces written to the trace file
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/oboe_metal.rb', line 57 def self.get_all_traces io = File.open($trace_file, 'r') contents = io.readlines(nil) return contents if contents.empty? s = StringIO.new(contents[0]) traces = [] until s.eof? if ::BSON.respond_to? :read_bson_document traces << BSON.read_bson_document(s) else traces << BSON::Document.from_bson(s) end end traces end |
.sendReport(evt) ⇒ Object
39 40 41 |
# File 'lib/oboe_metal.rb', line 39 def self.sendReport(evt) Oboe.reporter.sendReport(evt) end |
.start ⇒ Object
Initialize the Oboe Context, reporter and report the initialization
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/oboe_metal.rb', line 15 def self.start return unless Oboe.loaded begin Oboe_metal::Context.init if ENV.key?('OBOE_GEM_TEST') Oboe.reporter = Oboe::FileReporter.new('/tmp/trace_output.bson') else Oboe.reporter = Oboe::UdpReporter.new(Oboe::Config[:reporter_host], Oboe::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) Oboe::API.report_init unless ENV.key?('OBOE_GEM_TEST') end rescue => e $stderr.puts e. raise end end |