pulse-meter 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +30 -4
- data/examples/basic.ru +9 -0
- data/examples/basic_sensor_data.rb +9 -0
- data/examples/full/client.rb +8 -0
- data/examples/full/server.ru +19 -0
- data/lib/pulse-meter/version.rb +1 -1
- data/lib/pulse-meter/visualize/public/js/application.coffee +3 -2
- data/lib/pulse-meter/visualize/public/js/application.js +3 -2
- data/lib/pulse-meter/visualize/sensor.rb +1 -1
- data/lib/pulse-meter/visualize/widgets/timeline.rb +10 -1
- data/spec/pulse_meter/visualize/widgets/area_spec.rb +1 -0
- data/spec/pulse_meter/visualize/widgets/line_spec.rb +1 -0
- metadata +3 -3
data/README.md
CHANGED
@@ -344,6 +344,12 @@ at project root and visit
|
|
344
344
|
ttl: 60 * 60 * 24,
|
345
345
|
p: 0.9
|
346
346
|
}
|
347
|
+
},
|
348
|
+
cpu: {
|
349
|
+
sensor_type: 'indicator',
|
350
|
+
args: {
|
351
|
+
annotation: 'CPU%'
|
352
|
+
}
|
347
353
|
}
|
348
354
|
)
|
349
355
|
|
@@ -377,6 +383,8 @@ at project root and visit
|
|
377
383
|
agent_counter = sensors.sensor(agent_names.shuffle.first)
|
378
384
|
agent_counter.event(1)
|
379
385
|
|
386
|
+
sensors.cpu(Random.rand(100))
|
387
|
+
|
380
388
|
sleep(Random.rand / 10)
|
381
389
|
end
|
382
390
|
|
@@ -396,7 +404,7 @@ A more complicated visualization
|
|
396
404
|
|
397
405
|
# Transfer some global parameters to Google Charts
|
398
406
|
l.gchart_options({
|
399
|
-
|
407
|
+
background_color: '#CCC'
|
400
408
|
})
|
401
409
|
|
402
410
|
# Add some pages
|
@@ -428,7 +436,7 @@ A more complicated visualization
|
|
428
436
|
|
429
437
|
# Transfer page-wide (and page-specific) options to Google Charts
|
430
438
|
p.gchart_options({
|
431
|
-
height:
|
439
|
+
height: 500
|
432
440
|
})
|
433
441
|
end
|
434
442
|
|
@@ -469,7 +477,6 @@ A more complicated visualization
|
|
469
477
|
w.sensor sensor
|
470
478
|
end
|
471
479
|
|
472
|
-
w.timespan 24 * 60 * 60
|
473
480
|
w.redraw_interval 10
|
474
481
|
w.show_last_point true
|
475
482
|
w.values_label "Request count"
|
@@ -477,11 +484,30 @@ A more complicated visualization
|
|
477
484
|
|
478
485
|
end
|
479
486
|
|
480
|
-
p.
|
487
|
+
p.gchart_options({
|
481
488
|
height: 500
|
482
489
|
})
|
483
490
|
end
|
484
491
|
|
492
|
+
l.page "Gauge" do |p|
|
493
|
+
|
494
|
+
p.gauge "CPU Load" do |g|
|
495
|
+
g.redraw_interval 5
|
496
|
+
g.values_label '%'
|
497
|
+
g.width 5
|
498
|
+
|
499
|
+
g.red_from 90
|
500
|
+
g.red_to 100
|
501
|
+
g.yellow_from 75
|
502
|
+
g.yellow_to 90
|
503
|
+
g.minor_ticks 5
|
504
|
+
g.height 200
|
505
|
+
|
506
|
+
g.sensor :cpu
|
507
|
+
end
|
508
|
+
|
509
|
+
end
|
510
|
+
|
485
511
|
end
|
486
512
|
|
487
513
|
run layout.to_app
|
data/examples/basic.ru
CHANGED
@@ -19,6 +19,15 @@ layout = PulseMeter::Visualizer.draw do |l|
|
|
19
19
|
c.timespan 1200
|
20
20
|
end
|
21
21
|
|
22
|
+
p.line "Lama count 1 min" do |c|
|
23
|
+
c.sensor :lama_count_1min, color: '#FA295C'
|
24
|
+
c.redraw_interval 5
|
25
|
+
c.values_label 'Count'
|
26
|
+
c.width 5
|
27
|
+
c.show_last_point true
|
28
|
+
c.timespan 1200
|
29
|
+
end
|
30
|
+
|
22
31
|
p.area "Rhino count", sensor: :rhino_count do |c|
|
23
32
|
c.redraw_interval 5
|
24
33
|
c.values_label 'Count'
|
@@ -14,6 +14,15 @@ cfg = PulseMeter::Sensor::Configuration.new(
|
|
14
14
|
}
|
15
15
|
},
|
16
16
|
|
17
|
+
lama_count_1min: {
|
18
|
+
sensor_type:'timelined/counter',
|
19
|
+
args: {
|
20
|
+
annotation: 'Lama Count (1 min)',
|
21
|
+
interval: 60,
|
22
|
+
ttl: 3600
|
23
|
+
}
|
24
|
+
},
|
25
|
+
|
17
26
|
lama_average_age: {
|
18
27
|
sensor_type:'timelined/average',
|
19
28
|
args: {
|
data/examples/full/client.rb
CHANGED
@@ -64,6 +64,12 @@ sensors = PulseMeter::Sensor::Configuration.new(
|
|
64
64
|
ttl: 60 * 60 * 24,
|
65
65
|
p: 0.9
|
66
66
|
}
|
67
|
+
},
|
68
|
+
cpu: {
|
69
|
+
sensor_type: 'indicator',
|
70
|
+
args: {
|
71
|
+
annotation: 'CPU%'
|
72
|
+
}
|
67
73
|
}
|
68
74
|
)
|
69
75
|
|
@@ -97,5 +103,7 @@ while true
|
|
97
103
|
agent_counter = sensors.sensor(agent_names.shuffle.first)
|
98
104
|
agent_counter.event(1)
|
99
105
|
|
106
|
+
sensors.cpu(Random.rand(100))
|
107
|
+
|
100
108
|
sleep(Random.rand / 10)
|
101
109
|
end
|
data/examples/full/server.ru
CHANGED
@@ -99,6 +99,25 @@ layout = PulseMeter::Visualizer.draw do |l|
|
|
99
99
|
})
|
100
100
|
end
|
101
101
|
|
102
|
+
l.page "Gauge" do |p|
|
103
|
+
|
104
|
+
p.gauge "CPU Load" do |g|
|
105
|
+
g.redraw_interval 5
|
106
|
+
g.values_label '%'
|
107
|
+
g.width 5
|
108
|
+
|
109
|
+
g.red_from 90
|
110
|
+
g.red_to 100
|
111
|
+
g.yellow_from 75
|
112
|
+
g.yellow_to 90
|
113
|
+
g.minor_ticks 5
|
114
|
+
g.height 200
|
115
|
+
|
116
|
+
g.sensor :cpu
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
102
121
|
end
|
103
122
|
|
104
123
|
run layout.to_app
|
data/lib/pulse-meter/version.rb
CHANGED
@@ -153,10 +153,11 @@ document.startApp = ->
|
|
153
153
|
|
154
154
|
class SeriesPresenter extends TimelinePresenter
|
155
155
|
options: ->
|
156
|
+
secondPart = if @get('interval') % 60 == 0 then '' else ':ss'
|
156
157
|
format = if @model.timespan() > 24 * 60 * 60
|
157
|
-
|
158
|
+
"yyyy.MM.dd HH:mm#{secondPart}"
|
158
159
|
else
|
159
|
-
|
160
|
+
"HH:mm#{secondPart}"
|
160
161
|
|
161
162
|
$.extend true, super(), {
|
162
163
|
lineWidth: 1
|
@@ -214,8 +214,9 @@
|
|
214
214
|
}
|
215
215
|
|
216
216
|
SeriesPresenter.prototype.options = function() {
|
217
|
-
var format;
|
218
|
-
|
217
|
+
var format, secondPart;
|
218
|
+
secondPart = this.get('interval') % 60 === 0 ? '' : ':ss';
|
219
|
+
format = this.model.timespan() > 24 * 60 * 60 ? "yyyy.MM.dd HH:mm" + secondPart : "HH:mm" + secondPart;
|
219
220
|
return $.extend(true, SeriesPresenter.__super__.options.call(this), {
|
220
221
|
lineWidth: 1,
|
221
222
|
chartArea: {
|
@@ -19,7 +19,8 @@ module PulseMeter
|
|
19
19
|
super().merge({
|
20
20
|
values_title: values_label,
|
21
21
|
series: series_data(real_timespan),
|
22
|
-
timespan: timespan
|
22
|
+
timespan: timespan,
|
23
|
+
interval: interval
|
23
24
|
})
|
24
25
|
end
|
25
26
|
|
@@ -72,6 +73,14 @@ module PulseMeter
|
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
76
|
+
def interval
|
77
|
+
if sensors.empty?
|
78
|
+
nil
|
79
|
+
else
|
80
|
+
sensors.first.interval
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
75
84
|
end
|
76
85
|
|
77
86
|
class Area < Timeline; end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pulse-meter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-07-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: gon-sinatra
|
@@ -482,7 +482,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
482
482
|
version: '0'
|
483
483
|
segments:
|
484
484
|
- 0
|
485
|
-
hash:
|
485
|
+
hash: -1244879308775683986
|
486
486
|
requirements: []
|
487
487
|
rubyforge_project:
|
488
488
|
rubygems_version: 1.8.24
|