Class: Bipbip::Plugin::JanusAudioroom
- Inherits:
-
Bipbip::Plugin
- Object
- Bipbip::Plugin
- Bipbip::Plugin::JanusAudioroom
- Defined in:
- lib/bipbip/plugin/janus_audioroom.rb
Instance Attribute Summary
Attributes inherited from Bipbip::Plugin
#config, #frequency, #metric_group, #name, #tags
Instance Method Summary collapse
Methods inherited from Bipbip::Plugin
factory, factory_from_plugin, #initialize, #metrics_names, #run, #source_identifier
Methods included from InterruptibleSleep
#interrupt_sleep, #interruptible_sleep
Constructor Details
This class inherits a constructor from Bipbip::Plugin
Instance Method Details
#metrics_schema ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/bipbip/plugin/janus_audioroom.rb', line 6 def metrics_schema [ { name: 'room_count', type: 'gauge', unit: 'Rooms' }, { name: 'participant_count', type: 'gauge', unit: 'Participants' }, { name: 'room_zero_participant_count', type: 'gauge', unit: 'Rooms' } ] end |
#monitor ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/bipbip/plugin/janus_audioroom.rb', line 14 def monitor data = _fetch_data audiorooms = data['data']['list'] { 'room_count' => audiorooms.count, 'participant_count' => audiorooms.map { |room| room['num_participants'] }.reduce(0, :+), 'room_zero_participant_count' => audiorooms.count { |room| (room['num_participants']).zero? } } end |