bipbip 0.6.24 → 0.6.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d84a0714c3feadc7135952068cd7e840862b57a3
4
- data.tar.gz: a60be602facabc2e5e2708687b5fece64c37a707
3
+ metadata.gz: 7c214fa8211b3521ed029da86e49dcaceb2cf5f3
4
+ data.tar.gz: fa940fdb99439a7c6a7a1085c3af8187a38310db
5
5
  SHA512:
6
- metadata.gz: e47333bd8964340f6995954a9ada78f9bed04ec8422024b64ef6716a073232b90ef232f71c9ea27c2fd310d06dc8eb5fb4583dec05f2ae3b077e962f1a3e47c2
7
- data.tar.gz: 93e187100344e589c90f59b820c2da9f0b7ae14241247c906d00d3d91c74627d912f86617319d968d02af860c3fa751bef62d2d3a112aa5c6c4561fba18fb7cd
6
+ metadata.gz: c7465ea4c04c1c33ed64fef7358cfa676bc2161e15d9356da3275d5b8a2622d9a0902c1843d6a6766a6f94ce9fcbe1ad7544f1e67b5a379af5aaff6193d3a4b4
7
+ data.tar.gz: dd0dfe7e2468d091da1be72560bb72835cae0adf7a066b1e5ef9b8535bf7c3414b4b10485551e1a88b5f8628c6f03695eac9524289813d87c0338afe7af8a3f5
@@ -80,7 +80,7 @@ module Bipbip
80
80
  def stats_sum(keys)
81
81
  sum = 0
82
82
  (@stats ||= nodes_stats)['nodes'].each do |_node, stats|
83
- sum += keys.inject(stats) { |a, e| (a.is_a?(Hash) && !a[e].nil?) ? a[e] : 0 }
83
+ sum += keys.inject(stats) { |a, e| a.is_a?(Hash) && !a[e].nil? ? a[e] : 0 }
84
84
  end
85
85
  sum
86
86
  end
@@ -54,7 +54,7 @@ module Bipbip
54
54
  delta_misses = current_stats['misses'].to_f - previous_stats['misses'].to_f
55
55
 
56
56
  delta_total = delta_hits + delta_misses
57
- hit_rate = delta_total == 0 ? 0 : (delta_hits / delta_total) * 100
57
+ hit_rate = delta_total.zero? ? 0 : (delta_hits / delta_total) * 100
58
58
  hit_rate.round(2)
59
59
  end
60
60
  end
@@ -17,7 +17,7 @@ module Bipbip
17
17
  {
18
18
  'room_count' => audiorooms.count,
19
19
  'participant_count' => audiorooms.map { |room| room['num_participants'] }.reduce(0, :+),
20
- 'room_zero_participant_count' => audiorooms.count { |room| room['num_participants'] == 0 }
20
+ 'room_zero_participant_count' => audiorooms.count { |room| (room['num_participants']).zero? }
21
21
  }
22
22
  end
23
23
 
@@ -25,8 +25,8 @@ module Bipbip
25
25
  mountpoints = data['data']['list']
26
26
  streams = mountpoints.map { |mp| mp['streams'] }.flatten
27
27
 
28
- packet_loss_audio_avg = streams.count != 0 ? streams.map { |s| s['stats']['audio']['packet-loss-rate'] || 0 }.reduce(0, :+) / streams.count : 0
29
- packet_loss_video_avg = streams.count != 0 ? streams.map { |s| s['stats']['video']['packet-loss-rate'] || 0 }.reduce(0, :+) / streams.count : 0
28
+ packet_loss_audio_avg = streams.count.nonzero? ? streams.map { |s| s['stats']['audio']['packet-loss-rate'] || 0 }.reduce(0, :+) / streams.count : 0
29
+ packet_loss_video_avg = streams.count.nonzero? ? streams.map { |s| s['stats']['video']['packet-loss-rate'] || 0 }.reduce(0, :+) / streams.count : 0
30
30
 
31
31
  {
32
32
  'mountpoint_count' => mountpoints.count,
@@ -34,8 +34,8 @@ module Bipbip
34
34
  'streams_listener_count' => streams.map { |s| s['webrtc-endpoint']['listeners'] }.reduce(0, :+),
35
35
  'streams_waiter_count' => streams.map { |s| s['webrtc-endpoint']['waiters'] }.reduce(0, :+),
36
36
  'streams_bandwidth' => streams.map { |s| (s['stats']['video']['bitrate'] || 0) + (s['stats']['audio']['bitrate'] || 0) }.reduce(0, :+),
37
- 'streams_zero_fps_count' => streams.count { |s| s['frame']['fps'] == 0 },
38
- 'streams_zero_bitrate_count' => streams.count { |s| s['stats']['video']['bitrate'].nil? || s['stats']['video']['bitrate'] == 0 },
37
+ 'streams_zero_fps_count' => streams.count { |s| (s['frame']['fps']).zero? },
38
+ 'streams_zero_bitrate_count' => streams.count { |s| s['stats']['video']['bitrate'].nil? || (s['stats']['video']['bitrate']).zero? },
39
39
  'streams_packet_loss_audio_max' => streams.map { |s| (s['stats']['audio']['packet-loss-rate'] || 0) * 100 }.max,
40
40
  'streams_packet_loss_audio_avg' => packet_loss_audio_avg * 100,
41
41
  'streams_packet_loss_audio_count' => streams.map { |s| (s['stats']['audio']['packet-loss-count'] || 0) }.reduce(0, :+),
@@ -118,7 +118,7 @@ module Bipbip
118
118
 
119
119
  database_list.map do |database|
120
120
  results = database.command('dbstats' => 1)
121
- results.count == 0 ? 0 : results.documents.first['indexSize']
121
+ results.count.zero? ? 0 : results.documents.first['indexSize']
122
122
  end.reduce(:+)
123
123
  end
124
124
 
@@ -151,7 +151,7 @@ module Bipbip
151
151
  ]
152
152
  )
153
153
 
154
- unless results.count == 0
154
+ unless results.count.zero?
155
155
  result = results.first
156
156
  max_time = result['max_time'].to_f / 1000
157
157
 
@@ -32,7 +32,7 @@ module Bipbip
32
32
  data['All_Services_ok'] = status.services.any? do |service|
33
33
  error_flags_bitmap = service.status.to_i
34
34
  monitor_status = service.monitor.to_i
35
- (monitor_status == MONITOR_NOT) || (error_flags_bitmap != 0)
35
+ (monitor_status == MONITOR_NOT) || error_flags_bitmap.nonzero?
36
36
  end ? 0 : 1
37
37
  rescue
38
38
  data['Running'] = 0
@@ -67,7 +67,7 @@ module Bipbip
67
67
  name = metric[:name]
68
68
  unit = metric[:unit]
69
69
  data[name] = if 'Boolean' == unit
70
- (('ON' === stats[name] || 'Yes' === stats[name]) ? 1 : 0)
70
+ ('ON' === stats[name] || 'Yes' === stats[name] ? 1 : 0)
71
71
  else
72
72
  stats[name].to_i
73
73
  end
@@ -27,7 +27,7 @@ module Bipbip
27
27
  has_changes = puppet_report.key?('changes')
28
28
 
29
29
  metrics = {
30
- 'report_ok' => ((has_events && has_changes && has_resources) ? 1 : 0),
30
+ 'report_ok' => (has_events && has_changes && has_resources ? 1 : 0),
31
31
  'last_run_total_time' => puppet_report['time']['total'].to_i,
32
32
  'last_run_age' => report_age
33
33
  }
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.6.24'
2
+ VERSION = '0.6.25'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bipbip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.24
4
+ version: 0.6.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cargo Media
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-07-21 00:00:00.000000000 Z
13
+ date: 2016-08-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: copperegg-revealmetrics
@@ -96,6 +96,20 @@ dependencies:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
98
  version: '1.25'
99
+ - !ruby/object:Gem::Dependency
100
+ name: sinatra
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: 1.4.7
106
+ type: :runtime
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: 1.4.7
99
113
  - !ruby/object:Gem::Dependency
100
114
  name: monit
101
115
  requirement: !ruby/object:Gem::Requirement
@@ -242,14 +256,14 @@ dependencies:
242
256
  requirements:
243
257
  - - "~>"
244
258
  - !ruby/object:Gem::Version
245
- version: '0.35'
259
+ version: 0.41.2
246
260
  type: :development
247
261
  prerelease: false
248
262
  version_requirements: !ruby/object:Gem::Requirement
249
263
  requirements:
250
264
  - - "~>"
251
265
  - !ruby/object:Gem::Version
252
- version: '0.35'
266
+ version: 0.41.2
253
267
  description: Agent to collect data for common server programs and push them to CopperEgg
254
268
  email: hello@cargomedia.ch
255
269
  executables: