fnordmetric 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -19
- data/README.md +50 -20
- data/Rakefile +1 -23
- data/fnordmetric.gemspec +32 -156
- data/lib/fnordmetric.rb +2 -1
- data/lib/fnordmetric/api.rb +1 -2
- data/lib/fnordmetric/inbound_stream.rb +2 -2
- data/lib/fnordmetric/version.rb +3 -0
- data/lib/fnordmetric/worker.rb +8 -6
- data/spec/spec_helper.rb +1 -2
- metadata +8 -21
- data/.rspec +0 -2
- data/.travis.yml +0 -1
- data/Gemfile.lock +0 -75
- data/VERSION +0 -1
data/Gemfile
CHANGED
@@ -1,22 +1,7 @@
|
|
1
|
-
source
|
1
|
+
source :rubygems
|
2
|
+
|
3
|
+
gemspec
|
2
4
|
|
3
|
-
gem "bson_ext", ">= 1.4.0"
|
4
|
-
gem "sinatra", ">= 1.2.6"
|
5
|
-
gem "redis", ">= 2.2.2"
|
6
|
-
gem "eventmachine"
|
7
|
-
gem "em-hiredis"
|
8
|
-
gem "json"
|
9
|
-
gem "i18n"
|
10
|
-
gem "haml"
|
11
|
-
gem "rack"
|
12
|
-
gem "rack-test"
|
13
5
|
gem "yajl-ruby", :git => "git://github.com/brianmario/yajl-ruby.git"
|
14
|
-
gem "thin"
|
15
|
-
gem "activesupport"
|
16
6
|
|
17
|
-
|
18
|
-
gem "delorean", ">= 0"
|
19
|
-
gem "rspec", "~> 2.6.0"
|
20
|
-
gem "shoulda", ">= 0"
|
21
|
-
gem "jeweler", "~> 1.5.2"
|
22
|
-
end
|
7
|
+
gem "rake"
|
data/README.md
CHANGED
@@ -1,29 +1,34 @@
|
|
1
1
|
FnordMetric
|
2
2
|
===========
|
3
3
|
|
4
|
-
FnordMetric is a highly configurable (and pretty fast) realtime app/event
|
4
|
+
FnordMetric is a highly configurable (and pretty fast) realtime app/event
|
5
|
+
tracking thing based on ruby eventmachine and redis. You define your own
|
6
|
+
plotting and counting functions as ruby blocks!
|
5
7
|
|
6
|
-
[ ![Build status - Travis-ci]
|
8
|
+
[ ![Build status - Travis-ci][3] ][4]
|
7
9
|
|
8
|
-
[SCREENCAST]
|
10
|
+
[SCREENCAST][2]: the FnordMetric-instance we use to track our social dating app.
|
9
11
|
|
10
12
|
----
|
11
13
|
|
12
14
|
FnordMetric keeps track of your data and draws nice timeline plots.
|
13
15
|
|
14
|
-
[ ![Nice timeline plots]
|
16
|
+
[ ![Nice timeline plots][5] ][6]
|
15
17
|
|
16
|
-
FnordMetric gives you a live dashboard, that shows who is using your app in
|
18
|
+
FnordMetric gives you a live dashboard, that shows who is using your app in
|
19
|
+
realtime. You can select a single user and follow them step by step.
|
17
20
|
|
18
|
-
[ ![Live dashboard]
|
21
|
+
[ ![Live dashboard][7] ][8]
|
19
22
|
|
20
23
|
|
21
24
|
Getting Started
|
22
25
|
---------------
|
23
26
|
|
24
|
-
Copy `doc/full_example.rb` (that's the configuration from the screenshots
|
27
|
+
Copy `doc/full_example.rb` (that's the configuration from the screenshots
|
28
|
+
and screencast) or the simple example from below to `my_stats_app.rb`.
|
25
29
|
|
26
|
-
Simple Example: this will listen for json-events with `type=unicorn_seen`
|
30
|
+
Simple Example: this will listen for json-events with `type=unicorn_seen`
|
31
|
+
and render a timeline-plot showing the number of received events per hour.
|
27
32
|
|
28
33
|
```ruby
|
29
34
|
require "fnordmetric"
|
@@ -89,7 +94,8 @@ The slow way: HTTP-Post the json event to the fnordmetric webinterface.
|
|
89
94
|
|
90
95
|
curl -X POST -d "_type=unicorn_seen" http://localhost:4242/events
|
91
96
|
|
92
|
-
The easy way: Stream one ore more newline-seperated json encoded events
|
97
|
+
The easy way: Stream one ore more newline-seperated json encoded events
|
98
|
+
through a tcp connection.
|
93
99
|
|
94
100
|
echo "\{\"_type\": \"unicorn_seen\"\}\n" | nc localhost 2323
|
95
101
|
|
@@ -101,7 +107,7 @@ event = { :_type => "unicorn_seen" }.to_json
|
|
101
107
|
|
102
108
|
redis.set("fnordmetric-event-#{my_uuid}", event)
|
103
109
|
redis.expire("fnordmetric-event-#{my_uuid}", 60)
|
104
|
-
redis.lpush("fnordmetric-queue", uuid)
|
110
|
+
redis.lpush("fnordmetric-queue", uuid)
|
105
111
|
```
|
106
112
|
|
107
113
|
The Ruby way: Using the API.
|
@@ -139,16 +145,21 @@ api.event({:_type => "unicorn_seen"})
|
|
139
145
|
Call these methods from the event-handler block
|
140
146
|
|
141
147
|
incr(gauge_name, value=1):
|
142
|
-
Increment the given (two-dimensional) gauge by value
|
148
|
+
Increment the given (two-dimensional) gauge by value
|
149
|
+
at the tick specified by event-time
|
143
150
|
|
144
151
|
incr_field(gauge_name, field_name, value=1):
|
145
|
-
Increment the given field on a three-dimensional gauge
|
152
|
+
Increment the given field on a three-dimensional gauge
|
153
|
+
by value at the tick specified by event-time
|
146
154
|
|
147
155
|
set_value(gauge_name, value)
|
148
|
-
Set the given (two-dimensional) to value at the tick
|
156
|
+
Set the given (two-dimensional) to value at the tick
|
157
|
+
specified by event-time (overwrite existing value)
|
149
158
|
|
150
159
|
set_field(gauge_name, field_name, value)
|
151
|
-
Set the given field on a three-dimensional gauge to
|
160
|
+
Set the given field on a three-dimensional gauge to
|
161
|
+
value at the tick specified by event-time (overwrite
|
162
|
+
existing value)
|
152
163
|
|
153
164
|
----
|
154
165
|
|
@@ -250,9 +261,11 @@ FnordMetric.namespace :myapp do
|
|
250
261
|
incr :events_total
|
251
262
|
end
|
252
263
|
|
253
|
-
# on every event like
|
264
|
+
# on every event like
|
265
|
+
# { "_type": "_pageview", "_session": "sbz7jset", "url": "/page2" }
|
254
266
|
event :_pageview do
|
255
|
-
# increment the daily_uniques gauge by 1 if session_key hasn't been seen
|
267
|
+
# increment the daily_uniques gauge by 1 if session_key hasn't been seen
|
268
|
+
# in this tick yet
|
256
269
|
incr :pageviews_daily_unique
|
257
270
|
# increment the pageviews_per_url_daily gauge by 1 where key = 'page2'
|
258
271
|
incr_field :pageviews_per_url_daily, data[:url]
|
@@ -275,8 +288,9 @@ FnordMetric.namespace :myapp do
|
|
275
288
|
:autoupdate => 30
|
276
289
|
}
|
277
290
|
|
278
|
-
# draw the values of the messages_sent and messages_read gauge at the current
|
279
|
-
# the sum of the last 10 ticks, auto-refresh every
|
291
|
+
# draw the values of the messages_sent and messages_read gauge at the current
|
292
|
+
# tick, three ticks ago, and the sum of the last 10 ticks, auto-refresh every
|
293
|
+
# 20s
|
280
294
|
widget 'Overview', {
|
281
295
|
:title => "Messages Sent / Read",
|
282
296
|
:type => :numbers,
|
@@ -286,7 +300,8 @@ FnordMetric.namespace :myapp do
|
|
286
300
|
:gauges => [ :messages_sent, :messages_read ]
|
287
301
|
}
|
288
302
|
|
289
|
-
# draw a list of the most visited urls (url, visits + percentage),
|
303
|
+
# draw a list of the most visited urls (url, visits + percentage),
|
304
|
+
# auto-refresh every 20s
|
290
305
|
widget 'Overview', {
|
291
306
|
:title => "Top Pages",
|
292
307
|
:type => :toplist,
|
@@ -325,10 +340,14 @@ Contributors
|
|
325
340
|
+ Leo Lou (http://github.com/l4u)
|
326
341
|
+ Andy Lindeman (http://github.com/alindeman)
|
327
342
|
+ Jurriaan Pruis (http://github.com/jurriaan)
|
343
|
+
+ Kacper Bielecki (http://github.com/kazjote)
|
328
344
|
+ John Murray (http://github.com/JohnMurray)
|
329
345
|
+ Lars Gierth (http://github.com/lgierth)
|
330
346
|
|
331
|
-
To contribute, please fork this repository, make your changes and run the
|
347
|
+
To contribute, please fork this repository, make your changes and run the
|
348
|
+
specs, commit them to your github repository and send me a pull request.
|
349
|
+
Need help, head on over to our [Google Groups][1] page to discuss any ideas
|
350
|
+
that you might have.
|
332
351
|
|
333
352
|
|
334
353
|
License
|
@@ -366,3 +385,14 @@ Todos
|
|
366
385
|
+ the funnel-widget
|
367
386
|
+ timelinewidget + numberswidget => should use redis hmget
|
368
387
|
+ get multiple metrics in a single http get
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
[1]: http://groups.google.com/group/fnordmetric
|
392
|
+
[2]: http://www.screenr.com/KiJs
|
393
|
+
[3]: https://secure.travis-ci.org/paulasmuth/fnordmetric.png
|
394
|
+
[4]: http://travis-ci.org/paulasmuth/fnordmetric
|
395
|
+
[5]: https://raw.github.com/paulasmuth/fnordmetric/master/doc/preview1.png
|
396
|
+
[6]: https://raw.github.com/paulasmuth/fnordmetric/master/doc/preview1.png
|
397
|
+
[7]: https://raw.github.com/paulasmuth/fnordmetric/master/doc/preview2.png
|
398
|
+
[8]: https://raw.github.com/paulasmuth/fnordmetric/master/doc/preview2.png
|
data/Rakefile
CHANGED
@@ -1,28 +1,6 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'rake'
|
11
|
-
|
12
|
-
require 'jeweler'
|
13
|
-
Jeweler::Tasks.new do |gem|
|
14
|
-
gem.name = "fnordmetric"
|
15
|
-
gem.homepage = "http://github.com/paulasmuth/fnordmetric"
|
16
|
-
gem.license = "MIT"
|
17
|
-
gem.summary = "FnordMetric is a Ruby Event-Tracking gem on steroids"
|
18
|
-
gem.description = "FnordMetric is a Ruby Event-Tracking gem on steroids"
|
19
|
-
gem.email = "paul@paulasmuth.com"
|
20
|
-
gem.authors = ["Paul Asmuth"]
|
21
|
-
end
|
22
|
-
|
23
1
|
require 'rspec'
|
24
2
|
require 'rspec/core/rake_task'
|
25
3
|
desc "Run all examples"
|
26
4
|
task RSpec::Core::RakeTask.new('spec')
|
27
5
|
|
28
|
-
task :default => "spec"
|
6
|
+
task :default => "spec"
|
data/fnordmetric.gemspec
CHANGED
@@ -1,163 +1,39 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "fnordmetric/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
9
|
-
|
10
|
-
s.
|
11
|
-
s.authors
|
12
|
-
s.
|
6
|
+
s.name = "fnordmetric"
|
7
|
+
s.version = FnordMetric::VERSION
|
8
|
+
s.date = Date.today.to_s
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.authors = ["Paul Asmuth"]
|
11
|
+
s.email = ["paul@paulasmuth.com"]
|
12
|
+
s.homepage = "http://github.com/paulasmuth/fnordmetric"
|
13
|
+
s.summary = %q{FnordMetric is a Ruby Event-Tracking gem on steroids}
|
13
14
|
s.description = %q{FnordMetric is a Ruby Event-Tracking gem on steroids}
|
14
|
-
s.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
s.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
"doc/version",
|
30
|
-
"fnordmetric.gemspec",
|
31
|
-
"haml/app.haml",
|
32
|
-
"haml/widget.haml",
|
33
|
-
"lib/fnordmetric.rb",
|
34
|
-
"lib/fnordmetric/api.rb",
|
35
|
-
"lib/fnordmetric/app.rb",
|
36
|
-
"lib/fnordmetric/average_metric.rb",
|
37
|
-
"lib/fnordmetric/bars_widget.rb",
|
38
|
-
"lib/fnordmetric/cache.rb",
|
39
|
-
"lib/fnordmetric/combine_metric.rb",
|
40
|
-
"lib/fnordmetric/context.rb",
|
41
|
-
"lib/fnordmetric/count_metric.rb",
|
42
|
-
"lib/fnordmetric/dashboard.rb",
|
43
|
-
"lib/fnordmetric/event.rb",
|
44
|
-
"lib/fnordmetric/funnel_widget.rb",
|
45
|
-
"lib/fnordmetric/gauge.rb",
|
46
|
-
"lib/fnordmetric/gauge_calculations.rb",
|
47
|
-
"lib/fnordmetric/gauge_modifiers.rb",
|
48
|
-
"lib/fnordmetric/inbound_stream.rb",
|
49
|
-
"lib/fnordmetric/logger.rb",
|
50
|
-
"lib/fnordmetric/metric.rb",
|
51
|
-
"lib/fnordmetric/metric_api.rb",
|
52
|
-
"lib/fnordmetric/namespace.rb",
|
53
|
-
"lib/fnordmetric/numbers_widget.rb",
|
54
|
-
"lib/fnordmetric/pie_widget.rb",
|
55
|
-
"lib/fnordmetric/report.rb",
|
56
|
-
"lib/fnordmetric/session.rb",
|
57
|
-
"lib/fnordmetric/standalone.rb",
|
58
|
-
"lib/fnordmetric/sum_metric.rb",
|
59
|
-
"lib/fnordmetric/timeline_widget.rb",
|
60
|
-
"lib/fnordmetric/toplist_widget.rb",
|
61
|
-
"lib/fnordmetric/widget.rb",
|
62
|
-
"lib/fnordmetric/worker.rb",
|
63
|
-
"pub/fnordmetric.css",
|
64
|
-
"pub/fnordmetric.js",
|
65
|
-
"pub/loader.gif",
|
66
|
-
"pub/vendor/highcharts.js",
|
67
|
-
"pub/vendor/jquery-1.6.1.min.js",
|
68
|
-
"spec/api_spec.rb",
|
69
|
-
"spec/app_spec.rb",
|
70
|
-
"spec/context_spec.rb",
|
71
|
-
"spec/dashboard_spec.rb",
|
72
|
-
"spec/event_spec.rb",
|
73
|
-
"spec/gauge_modifiers_spec.rb",
|
74
|
-
"spec/gauge_spec.rb",
|
75
|
-
"spec/inbound_stream_spec.rb",
|
76
|
-
"spec/namespace_spec.rb",
|
77
|
-
"spec/session_spec.rb",
|
78
|
-
"spec/spec_helper.rb",
|
79
|
-
"spec/widget_spec.rb",
|
80
|
-
"spec/worker_spec.rb"
|
81
|
-
]
|
82
|
-
s.homepage = %q{http://github.com/paulasmuth/fnordmetric}
|
83
|
-
s.licenses = ["MIT"]
|
84
|
-
s.require_paths = ["lib"]
|
85
|
-
s.rubygems_version = %q{1.5.2}
|
86
|
-
s.summary = %q{FnordMetric is a Ruby Event-Tracking gem on steroids}
|
87
|
-
s.test_files = [
|
88
|
-
"spec/api_spec.rb",
|
89
|
-
"spec/app_spec.rb",
|
90
|
-
"spec/context_spec.rb",
|
91
|
-
"spec/dashboard_spec.rb",
|
92
|
-
"spec/event_spec.rb",
|
93
|
-
"spec/gauge_modifiers_spec.rb",
|
94
|
-
"spec/gauge_spec.rb",
|
95
|
-
"spec/inbound_stream_spec.rb",
|
96
|
-
"spec/namespace_spec.rb",
|
97
|
-
"spec/session_spec.rb",
|
98
|
-
"spec/spec_helper.rb",
|
99
|
-
"spec/widget_spec.rb",
|
100
|
-
"spec/worker_spec.rb"
|
101
|
-
]
|
15
|
+
s.licenses = ["MIT"]
|
16
|
+
|
17
|
+
s.add_dependency "bson_ext", ">= 1.4.0"
|
18
|
+
s.add_dependency "sinatra", ">= 1.2.6"
|
19
|
+
s.add_dependency "redis", ">= 2.2.2"
|
20
|
+
s.add_dependency "eventmachine"
|
21
|
+
s.add_dependency "em-hiredis"
|
22
|
+
s.add_dependency "json"
|
23
|
+
s.add_dependency "i18n"
|
24
|
+
s.add_dependency "haml"
|
25
|
+
s.add_dependency "rack"
|
26
|
+
s.add_dependency "rack-test"
|
27
|
+
s.add_dependency "yajl-ruby"
|
28
|
+
s.add_dependency "thin"
|
29
|
+
s.add_dependency "activesupport"
|
102
30
|
|
103
|
-
|
104
|
-
|
31
|
+
s.add_development_dependency "delorean"
|
32
|
+
s.add_development_dependency "rspec", "~> 2.6.0"
|
33
|
+
s.add_development_dependency "shoulda"
|
105
34
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
s.add_runtime_dependency(%q<eventmachine>, [">= 0"])
|
111
|
-
s.add_runtime_dependency(%q<em-hiredis>, [">= 0"])
|
112
|
-
s.add_runtime_dependency(%q<json>, [">= 0"])
|
113
|
-
s.add_runtime_dependency(%q<i18n>, [">= 0"])
|
114
|
-
s.add_runtime_dependency(%q<haml>, [">= 0"])
|
115
|
-
s.add_runtime_dependency(%q<rack>, [">= 0"])
|
116
|
-
s.add_runtime_dependency(%q<rack-test>, [">= 0"])
|
117
|
-
s.add_runtime_dependency(%q<yajl-ruby>, [">= 0"])
|
118
|
-
s.add_runtime_dependency(%q<thin>, [">= 0"])
|
119
|
-
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
120
|
-
s.add_development_dependency(%q<delorean>, [">= 0"])
|
121
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
|
122
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
123
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
124
|
-
else
|
125
|
-
s.add_dependency(%q<bson_ext>, [">= 1.4.0"])
|
126
|
-
s.add_dependency(%q<sinatra>, [">= 1.2.6"])
|
127
|
-
s.add_dependency(%q<redis>, [">= 2.2.2"])
|
128
|
-
s.add_dependency(%q<eventmachine>, [">= 0"])
|
129
|
-
s.add_dependency(%q<em-hiredis>, [">= 0"])
|
130
|
-
s.add_dependency(%q<json>, [">= 0"])
|
131
|
-
s.add_dependency(%q<i18n>, [">= 0"])
|
132
|
-
s.add_dependency(%q<haml>, [">= 0"])
|
133
|
-
s.add_dependency(%q<rack>, [">= 0"])
|
134
|
-
s.add_dependency(%q<rack-test>, [">= 0"])
|
135
|
-
s.add_dependency(%q<yajl-ruby>, [">= 0"])
|
136
|
-
s.add_dependency(%q<thin>, [">= 0"])
|
137
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
138
|
-
s.add_dependency(%q<delorean>, [">= 0"])
|
139
|
-
s.add_dependency(%q<rspec>, ["~> 2.6.0"])
|
140
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
141
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
142
|
-
end
|
143
|
-
else
|
144
|
-
s.add_dependency(%q<bson_ext>, [">= 1.4.0"])
|
145
|
-
s.add_dependency(%q<sinatra>, [">= 1.2.6"])
|
146
|
-
s.add_dependency(%q<redis>, [">= 2.2.2"])
|
147
|
-
s.add_dependency(%q<eventmachine>, [">= 0"])
|
148
|
-
s.add_dependency(%q<em-hiredis>, [">= 0"])
|
149
|
-
s.add_dependency(%q<json>, [">= 0"])
|
150
|
-
s.add_dependency(%q<i18n>, [">= 0"])
|
151
|
-
s.add_dependency(%q<haml>, [">= 0"])
|
152
|
-
s.add_dependency(%q<rack>, [">= 0"])
|
153
|
-
s.add_dependency(%q<rack-test>, [">= 0"])
|
154
|
-
s.add_dependency(%q<yajl-ruby>, [">= 0"])
|
155
|
-
s.add_dependency(%q<thin>, [">= 0"])
|
156
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
157
|
-
s.add_dependency(%q<delorean>, [">= 0"])
|
158
|
-
s.add_dependency(%q<rspec>, ["~> 2.6.0"])
|
159
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
160
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
161
|
-
end
|
35
|
+
s.files = `git ls-files`.split("\n") - [".gitignore", ".rspec", ".travis.yml"]
|
36
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
37
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
38
|
+
s.require_paths = ["lib"]
|
162
39
|
end
|
163
|
-
|
data/lib/fnordmetric.rb
CHANGED
data/lib/fnordmetric/api.rb
CHANGED
@@ -7,7 +7,6 @@ class FnordMetric::API
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def connect
|
10
|
-
@redis = @@opts[:redis] if @@opts[:redis]
|
11
10
|
@redis = Redis.connect(:url => @@opts[:redis_url])
|
12
11
|
end
|
13
12
|
|
@@ -44,4 +43,4 @@ class FnordMetric::API
|
|
44
43
|
def get_next_uuid
|
45
44
|
SecureRandom.uuid
|
46
45
|
end
|
47
|
-
end
|
46
|
+
end
|
@@ -12,7 +12,7 @@ class FnordMetric::InboundStream < EventMachine::Connection
|
|
12
12
|
|
13
13
|
def receive_data(chunk)
|
14
14
|
@buffer << chunk
|
15
|
-
|
15
|
+
next_event
|
16
16
|
end
|
17
17
|
|
18
18
|
def next_event
|
@@ -44,7 +44,7 @@ class FnordMetric::InboundStream < EventMachine::Connection
|
|
44
44
|
@events_buffered = 0
|
45
45
|
@streaming = true
|
46
46
|
@buffer = ""
|
47
|
-
@events = []
|
47
|
+
@events = []
|
48
48
|
end
|
49
49
|
|
50
50
|
def unbind
|
data/lib/fnordmetric/worker.rb
CHANGED
@@ -19,12 +19,14 @@ class FnordMetric::Worker
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def tick
|
22
|
-
@redis.blpop(queue_key,
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
@redis.blpop(queue_key, 1).callback do |list, event_id|
|
23
|
+
EM.next_tick(&method(:tick))
|
24
|
+
if event_id
|
25
|
+
@redis.get(event_key(event_id)).callback do |event_data|
|
26
|
+
process_event(event_id, event_data) if event_data
|
27
|
+
FnordMetric.log("event_lost: event_data not found for event-id '#{event_id}'") unless event_data
|
28
|
+
@redis.hincrby(stats_key, :events_processed, 1)
|
29
|
+
end
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: fnordmetric
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Paul Asmuth
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-01-
|
13
|
+
date: 2012-01-21 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -189,33 +189,19 @@ dependencies:
|
|
189
189
|
version: "0"
|
190
190
|
type: :development
|
191
191
|
version_requirements: *id016
|
192
|
-
- !ruby/object:Gem::Dependency
|
193
|
-
name: jeweler
|
194
|
-
prerelease: false
|
195
|
-
requirement: &id017 !ruby/object:Gem::Requirement
|
196
|
-
none: false
|
197
|
-
requirements:
|
198
|
-
- - ~>
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
version: 1.5.2
|
201
|
-
type: :development
|
202
|
-
version_requirements: *id017
|
203
192
|
description: FnordMetric is a Ruby Event-Tracking gem on steroids
|
204
|
-
email:
|
193
|
+
email:
|
194
|
+
- paul@paulasmuth.com
|
205
195
|
executables: []
|
206
196
|
|
207
197
|
extensions: []
|
208
198
|
|
209
|
-
extra_rdoc_files:
|
210
|
-
|
199
|
+
extra_rdoc_files: []
|
200
|
+
|
211
201
|
files:
|
212
|
-
- .rspec
|
213
|
-
- .travis.yml
|
214
202
|
- Gemfile
|
215
|
-
- Gemfile.lock
|
216
203
|
- README.md
|
217
204
|
- Rakefile
|
218
|
-
- VERSION
|
219
205
|
- doc/full_example.rb
|
220
206
|
- doc/preview1.png
|
221
207
|
- doc/preview2.png
|
@@ -251,6 +237,7 @@ files:
|
|
251
237
|
- lib/fnordmetric/sum_metric.rb
|
252
238
|
- lib/fnordmetric/timeline_widget.rb
|
253
239
|
- lib/fnordmetric/toplist_widget.rb
|
240
|
+
- lib/fnordmetric/version.rb
|
254
241
|
- lib/fnordmetric/widget.rb
|
255
242
|
- lib/fnordmetric/worker.rb
|
256
243
|
- pub/fnordmetric.css
|
@@ -295,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
295
282
|
requirements: []
|
296
283
|
|
297
284
|
rubyforge_project:
|
298
|
-
rubygems_version: 1.
|
285
|
+
rubygems_version: 1.6.2
|
299
286
|
signing_key:
|
300
287
|
specification_version: 3
|
301
288
|
summary: FnordMetric is a Ruby Event-Tracking gem on steroids
|
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm: 1.9.3
|
data/Gemfile.lock
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/brianmario/yajl-ruby.git
|
3
|
-
revision: eef5c48be81b6404af66da3f185ec9301e5214d8
|
4
|
-
specs:
|
5
|
-
yajl-ruby (1.1.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: http://rubygems.org/
|
9
|
-
specs:
|
10
|
-
activesupport (3.1.1)
|
11
|
-
multi_json (~> 1.0)
|
12
|
-
bson_ext (1.4.0)
|
13
|
-
chronic (0.6.4)
|
14
|
-
daemons (1.1.4)
|
15
|
-
delorean (1.1.0)
|
16
|
-
chronic
|
17
|
-
diff-lcs (1.1.3)
|
18
|
-
em-hiredis (0.1.0)
|
19
|
-
hiredis (~> 0.3.0)
|
20
|
-
eventmachine (0.12.10)
|
21
|
-
git (1.2.5)
|
22
|
-
haml (3.1.2)
|
23
|
-
hiredis (0.3.2)
|
24
|
-
i18n (0.6.0)
|
25
|
-
jeweler (1.5.2)
|
26
|
-
bundler (~> 1.0.0)
|
27
|
-
git (>= 1.2.5)
|
28
|
-
rake
|
29
|
-
json (1.6.1)
|
30
|
-
multi_json (1.0.4)
|
31
|
-
rack (1.3.0)
|
32
|
-
rack-test (0.6.0)
|
33
|
-
rack (>= 1.0)
|
34
|
-
rake (0.9.2)
|
35
|
-
redis (2.2.2)
|
36
|
-
rspec (2.6.0)
|
37
|
-
rspec-core (~> 2.6.0)
|
38
|
-
rspec-expectations (~> 2.6.0)
|
39
|
-
rspec-mocks (~> 2.6.0)
|
40
|
-
rspec-core (2.6.4)
|
41
|
-
rspec-expectations (2.6.0)
|
42
|
-
diff-lcs (~> 1.1.2)
|
43
|
-
rspec-mocks (2.6.0)
|
44
|
-
shoulda (2.11.3)
|
45
|
-
sinatra (1.2.6)
|
46
|
-
rack (~> 1.1)
|
47
|
-
tilt (>= 1.2.2, < 2.0)
|
48
|
-
thin (1.2.11)
|
49
|
-
daemons (>= 1.0.9)
|
50
|
-
eventmachine (>= 0.12.6)
|
51
|
-
rack (>= 1.0.0)
|
52
|
-
tilt (1.3.2)
|
53
|
-
|
54
|
-
PLATFORMS
|
55
|
-
ruby
|
56
|
-
|
57
|
-
DEPENDENCIES
|
58
|
-
activesupport
|
59
|
-
bson_ext (>= 1.4.0)
|
60
|
-
bundler (~> 1.0.0)
|
61
|
-
delorean
|
62
|
-
em-hiredis
|
63
|
-
eventmachine
|
64
|
-
haml
|
65
|
-
i18n
|
66
|
-
jeweler (~> 1.5.2)
|
67
|
-
json
|
68
|
-
rack
|
69
|
-
rack-test
|
70
|
-
redis (>= 2.2.2)
|
71
|
-
rspec (~> 2.6.0)
|
72
|
-
shoulda
|
73
|
-
sinatra (>= 1.2.6)
|
74
|
-
thin
|
75
|
-
yajl-ruby!
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.6.4
|