Class: Skywalking::Reporter::Report
- Inherits:
-
Object
- Object
- Skywalking::Reporter::Report
- Defined in:
- lib/skywalking/reporter/report.rb
Class Method Summary collapse
Instance Method Summary collapse
- #init_proto ⇒ Object
- #init_reporter ⇒ Object
- #init_worker_loop ⇒ Object
-
#initialize(config) ⇒ Report
constructor
A new instance of Report.
- #report_heartbeat ⇒ Object
- #report_segment ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(config) ⇒ Report
Returns a new instance of Report.
23 24 25 26 |
# File 'lib/skywalking/reporter/report.rb', line 23 def initialize(config) @config = config init_proto end |
Class Method Details
.trigger ⇒ Object
54 55 56 |
# File 'lib/skywalking/reporter/report.rb', line 54 def self.trigger @@trigger end |
Instance Method Details
#init_proto ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/skywalking/reporter/report.rb', line 28 def init_proto return if @protocol case @config[:report_protocol] when 'grpc' @protocol = Grpc.new(@config) else raise "Unsupported report protocol: #{@config[:report_protocol]}" end end |
#init_reporter ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/skywalking/reporter/report.rb', line 39 def init_reporter @daemon_loop = [] @scheduler_loop = Scheduler.new @daemon_loop << Thread.new do init_worker_loop @scheduler_loop.run end @@trigger = BufferTrigger.new(@config) @daemon_loop << Thread.new do report_segment end end |
#init_worker_loop ⇒ Object
58 59 60 |
# File 'lib/skywalking/reporter/report.rb', line 58 def init_worker_loop @scheduler_loop.subscribe(:report_heartbeat, @config[:collector_heartbeat_period]) { report_heartbeat } end |
#report_heartbeat ⇒ Object
73 74 75 |
# File 'lib/skywalking/reporter/report.rb', line 73 def report_heartbeat @protocol.report_heartbeat end |
#report_segment ⇒ Object
77 78 79 |
# File 'lib/skywalking/reporter/report.rb', line 77 def report_segment @protocol.report_segment(@@trigger.stream_data) until @@trigger.closed? end |
#stop ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/skywalking/reporter/report.rb', line 62 def stop @scheduler_loop.shutdown @@trigger.close_queue @daemon_loop.each do |daemon| if daemon.alive? daemon.wakeup daemon.join end end end |