fnordmetric 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +335 -0
- data/VERSION +1 -1
- data/fnordmetric.gemspec +7 -4
- data/haml/app.haml +6 -1
- data/lib/fnordmetric.rb +1 -1
- data/lib/fnordmetric/app.rb +5 -1
- data/lib/fnordmetric/inbound_stream.rb +1 -1
- data/lib/fnordmetric/worker.rb +1 -1
- data/pub/fnordmetric.css +10 -2
- data/pub/fnordmetric.js +138 -133
- metadata +166 -158
- data/readme.rdoc +0 -337
metadata
CHANGED
@@ -1,223 +1,229 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: fnordmetric
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.5
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 0.5.6
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Paul Asmuth
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
date: 2012-01-03 00:00:00 +01:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
15
17
|
name: bson_ext
|
16
|
-
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
20
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
21
24
|
version: 1.4.0
|
22
25
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
26
28
|
name: sinatra
|
27
|
-
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
31
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
32
35
|
version: 1.2.6
|
33
36
|
type: :runtime
|
34
|
-
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
37
39
|
name: redis
|
38
|
-
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
39
42
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
43
46
|
version: 2.2.2
|
44
47
|
type: :runtime
|
45
|
-
|
46
|
-
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
48
50
|
name: eventmachine
|
49
|
-
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
50
53
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
55
58
|
type: :runtime
|
56
|
-
|
57
|
-
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
59
61
|
name: em-hiredis
|
60
|
-
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
61
64
|
none: false
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version:
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
66
69
|
type: :runtime
|
67
|
-
|
68
|
-
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
70
72
|
name: json
|
71
|
-
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
72
75
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
77
80
|
type: :runtime
|
78
|
-
|
79
|
-
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
81
83
|
name: i18n
|
82
|
-
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
83
86
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version:
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: "0"
|
88
91
|
type: :runtime
|
89
|
-
|
90
|
-
|
91
|
-
- !ruby/object:Gem::Dependency
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
92
94
|
name: haml
|
93
|
-
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
94
97
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version:
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: "0"
|
99
102
|
type: :runtime
|
100
|
-
|
101
|
-
|
102
|
-
- !ruby/object:Gem::Dependency
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
103
105
|
name: rack
|
104
|
-
|
106
|
+
prerelease: false
|
107
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
105
108
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: "0"
|
110
113
|
type: :runtime
|
111
|
-
|
112
|
-
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
+
version_requirements: *id009
|
115
|
+
- !ruby/object:Gem::Dependency
|
114
116
|
name: rack-test
|
115
|
-
|
117
|
+
prerelease: false
|
118
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
116
119
|
none: false
|
117
|
-
requirements:
|
118
|
-
- -
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
version:
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: "0"
|
121
124
|
type: :runtime
|
122
|
-
|
123
|
-
|
124
|
-
- !ruby/object:Gem::Dependency
|
125
|
+
version_requirements: *id010
|
126
|
+
- !ruby/object:Gem::Dependency
|
125
127
|
name: yajl-ruby
|
126
|
-
|
128
|
+
prerelease: false
|
129
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
127
130
|
none: false
|
128
|
-
requirements:
|
129
|
-
- -
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: "0"
|
132
135
|
type: :runtime
|
133
|
-
|
134
|
-
|
135
|
-
- !ruby/object:Gem::Dependency
|
136
|
+
version_requirements: *id011
|
137
|
+
- !ruby/object:Gem::Dependency
|
136
138
|
name: thin
|
137
|
-
|
139
|
+
prerelease: false
|
140
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
138
141
|
none: false
|
139
|
-
requirements:
|
140
|
-
- -
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
version:
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: "0"
|
143
146
|
type: :runtime
|
144
|
-
|
145
|
-
|
146
|
-
- !ruby/object:Gem::Dependency
|
147
|
+
version_requirements: *id012
|
148
|
+
- !ruby/object:Gem::Dependency
|
147
149
|
name: activesupport
|
148
|
-
|
150
|
+
prerelease: false
|
151
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
149
152
|
none: false
|
150
|
-
requirements:
|
151
|
-
- -
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version:
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: "0"
|
154
157
|
type: :runtime
|
155
|
-
|
156
|
-
|
157
|
-
- !ruby/object:Gem::Dependency
|
158
|
+
version_requirements: *id013
|
159
|
+
- !ruby/object:Gem::Dependency
|
158
160
|
name: delorean
|
159
|
-
|
161
|
+
prerelease: false
|
162
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
160
163
|
none: false
|
161
|
-
requirements:
|
162
|
-
- -
|
163
|
-
- !ruby/object:Gem::Version
|
164
|
-
version:
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: "0"
|
165
168
|
type: :development
|
166
|
-
|
167
|
-
|
168
|
-
- !ruby/object:Gem::Dependency
|
169
|
+
version_requirements: *id014
|
170
|
+
- !ruby/object:Gem::Dependency
|
169
171
|
name: rspec
|
170
|
-
|
172
|
+
prerelease: false
|
173
|
+
requirement: &id015 !ruby/object:Gem::Requirement
|
171
174
|
none: false
|
172
|
-
requirements:
|
175
|
+
requirements:
|
173
176
|
- - ~>
|
174
|
-
- !ruby/object:Gem::Version
|
177
|
+
- !ruby/object:Gem::Version
|
175
178
|
version: 2.6.0
|
176
179
|
type: :development
|
177
|
-
|
178
|
-
|
179
|
-
- !ruby/object:Gem::Dependency
|
180
|
+
version_requirements: *id015
|
181
|
+
- !ruby/object:Gem::Dependency
|
180
182
|
name: shoulda
|
181
|
-
|
183
|
+
prerelease: false
|
184
|
+
requirement: &id016 !ruby/object:Gem::Requirement
|
182
185
|
none: false
|
183
|
-
requirements:
|
184
|
-
- -
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
version:
|
186
|
+
requirements:
|
187
|
+
- - ">="
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: "0"
|
187
190
|
type: :development
|
188
|
-
|
189
|
-
|
190
|
-
- !ruby/object:Gem::Dependency
|
191
|
+
version_requirements: *id016
|
192
|
+
- !ruby/object:Gem::Dependency
|
191
193
|
name: bundler
|
192
|
-
|
194
|
+
prerelease: false
|
195
|
+
requirement: &id017 !ruby/object:Gem::Requirement
|
193
196
|
none: false
|
194
|
-
requirements:
|
197
|
+
requirements:
|
195
198
|
- - ~>
|
196
|
-
- !ruby/object:Gem::Version
|
199
|
+
- !ruby/object:Gem::Version
|
197
200
|
version: 1.0.0
|
198
201
|
type: :development
|
199
|
-
|
200
|
-
|
201
|
-
- !ruby/object:Gem::Dependency
|
202
|
+
version_requirements: *id017
|
203
|
+
- !ruby/object:Gem::Dependency
|
202
204
|
name: jeweler
|
203
|
-
|
205
|
+
prerelease: false
|
206
|
+
requirement: &id018 !ruby/object:Gem::Requirement
|
204
207
|
none: false
|
205
|
-
requirements:
|
208
|
+
requirements:
|
206
209
|
- - ~>
|
207
|
-
- !ruby/object:Gem::Version
|
210
|
+
- !ruby/object:Gem::Version
|
208
211
|
version: 1.5.2
|
209
212
|
type: :development
|
210
|
-
|
211
|
-
version_requirements: *82476140
|
213
|
+
version_requirements: *id018
|
212
214
|
description: FnordMetric is a Ruby Event-Tracking gem on steroids
|
213
215
|
email: paul@paulasmuth.com
|
214
216
|
executables: []
|
217
|
+
|
215
218
|
extensions: []
|
216
|
-
|
217
|
-
|
219
|
+
|
220
|
+
extra_rdoc_files:
|
221
|
+
- README.md
|
222
|
+
files:
|
218
223
|
- .travis.yml
|
219
224
|
- Gemfile
|
220
225
|
- Gemfile.lock
|
226
|
+
- README.md
|
221
227
|
- Rakefile
|
222
228
|
- VERSION
|
223
229
|
- doc/preview1.png
|
@@ -262,7 +268,6 @@ files:
|
|
262
268
|
- pub/sprite.png
|
263
269
|
- pub/vendor/highcharts.js
|
264
270
|
- pub/vendor/jquery-1.6.1.min.js
|
265
|
-
- readme.rdoc
|
266
271
|
- spec/app_spec.rb
|
267
272
|
- spec/context_spec.rb
|
268
273
|
- spec/dashboard_spec.rb
|
@@ -274,32 +279,35 @@ files:
|
|
274
279
|
- spec/spec_helper.rb
|
275
280
|
- spec/widget_spec.rb
|
276
281
|
- spec/worker_spec.rb
|
282
|
+
has_rdoc: true
|
277
283
|
homepage: http://github.com/paulasmuth/fnordmetric
|
278
|
-
licenses:
|
284
|
+
licenses:
|
279
285
|
- MIT
|
280
286
|
post_install_message:
|
281
287
|
rdoc_options: []
|
282
|
-
|
288
|
+
|
289
|
+
require_paths:
|
283
290
|
- lib
|
284
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
291
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
285
292
|
none: false
|
286
|
-
requirements:
|
287
|
-
- -
|
288
|
-
- !ruby/object:Gem::Version
|
289
|
-
version:
|
290
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
293
|
+
requirements:
|
294
|
+
- - ">="
|
295
|
+
- !ruby/object:Gem::Version
|
296
|
+
version: "0"
|
297
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
291
298
|
none: false
|
292
|
-
requirements:
|
293
|
-
- -
|
294
|
-
- !ruby/object:Gem::Version
|
295
|
-
version:
|
299
|
+
requirements:
|
300
|
+
- - ">="
|
301
|
+
- !ruby/object:Gem::Version
|
302
|
+
version: "0"
|
296
303
|
requirements: []
|
304
|
+
|
297
305
|
rubyforge_project:
|
298
|
-
rubygems_version: 1.
|
306
|
+
rubygems_version: 1.5.2
|
299
307
|
signing_key:
|
300
308
|
specification_version: 3
|
301
309
|
summary: FnordMetric is a Ruby Event-Tracking gem on steroids
|
302
|
-
test_files:
|
310
|
+
test_files:
|
303
311
|
- spec/app_spec.rb
|
304
312
|
- spec/context_spec.rb
|
305
313
|
- spec/dashboard_spec.rb
|
data/readme.rdoc
DELETED
@@ -1,337 +0,0 @@
|
|
1
|
-
= FnordMetric
|
2
|
-
|
3
|
-
FnordMetric is a highly configurable (and pretty fast) realtime app/event tracking thing based on ruby eventmachine and redis. You define your own plotting and counting functions as ruby blocks!
|
4
|
-
|
5
|
-
{<img src="https://secure.travis-ci.org/paulasmuth/fnordmetric.png" />}[http://travis-ci.org/paulasmuth/fnordmetric]
|
6
|
-
|
7
|
-
SCREENCAST: http://www.screenr.com/KiJs - the FnordMetric-instance we use to track our social dating app
|
8
|
-
|
9
|
-
---
|
10
|
-
|
11
|
-
FnordMetric keeps track of your data and draws nice timeline plots.
|
12
|
-
|
13
|
-
{<img src="https://raw.github.com/paulasmuth/fnordmetric/master/doc/preview1.png" />}[https://raw.github.com/paulasmuth/fnordmetric/master/doc/preview1.png]
|
14
|
-
|
15
|
-
FnordMetric gives you a live dashboard, that shows who is using your app in realtime. You can select a single user and follow them step by step.
|
16
|
-
|
17
|
-
{<img src="https://raw.github.com/paulasmuth/fnordmetric/master/doc/preview2.png" />}[https://raw.github.com/paulasmuth/fnordmetric/master/doc/preview1.png]
|
18
|
-
|
19
|
-
|
20
|
-
== Getting Started
|
21
|
-
|
22
|
-
Copy doc/ulm_stats.rb (that's the configuration from the screenshots and screencast) or the simple example from below to 'my_stats_app.rb'
|
23
|
-
|
24
|
-
Simple Example: This will listen for json-events with type=unicorn_seen and render a timeline-plot showing the number of received events per hour.
|
25
|
-
|
26
|
-
require "fnordmetric"
|
27
|
-
|
28
|
-
FnordMetric.namespace :myapp do
|
29
|
-
|
30
|
-
# numeric (delta) gauge, 1-hour tick
|
31
|
-
gauge :unicorns_seen_per_hour,
|
32
|
-
:tick => 1.hour.to_i,
|
33
|
-
:title => "Unicorns seenper Hour"
|
34
|
-
|
35
|
-
# on every event like { _type: 'unicorn_seen' }
|
36
|
-
event(:unicorn_seen) do
|
37
|
-
# increment the unicorns_seen_per_hour gauge by 1
|
38
|
-
incr :unicorns_seen_per_hour
|
39
|
-
end
|
40
|
-
|
41
|
-
# draw a timeline showing the gauges value, auto-refresh every 30s
|
42
|
-
widget 'Overview', {
|
43
|
-
:title => "Unicorn-Sightings per Hour",
|
44
|
-
:type => :timeline,
|
45
|
-
:gauges => :unicorns_seen_per_hour,
|
46
|
-
:include_current => true,
|
47
|
-
:autoupdate => 2
|
48
|
-
}
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
FnordMetric.standalone
|
53
|
-
|
54
|
-
Start the app (requires ruby >= 1.9.2):
|
55
|
-
|
56
|
-
$ ruby my_stats_app.rb run
|
57
|
-
|
58
|
-
Log all incoming events:
|
59
|
-
|
60
|
-
$ ruby my_stats_app.rb log DUMP_FILE=/tmp/foo.json
|
61
|
-
|
62
|
-
This is the easiest way to submit an event:
|
63
|
-
|
64
|
-
echo "{\"_type\": \"unicorn_seen\"}" | nc localhost 1337
|
65
|
-
|
66
|
-
|
67
|
-
== Installation
|
68
|
-
|
69
|
-
gem install fnordmetric
|
70
|
-
|
71
|
-
or in your Gemfile:
|
72
|
-
|
73
|
-
gem 'fnordmetric', '>= 0.5.1'
|
74
|
-
|
75
|
-
|
76
|
-
== Documentation
|
77
|
-
|
78
|
-
|
79
|
-
=== Sending Events
|
80
|
-
|
81
|
-
The slow way: HTTP-Post the json event to the fnordmetric webinterface
|
82
|
-
|
83
|
-
POST http://localhost:2323/events _type=unicorn_seen
|
84
|
-
|
85
|
-
curl -X POST -d "_type=unicorn_seen" http://localhost:4242/events
|
86
|
-
|
87
|
-
The easy way: Stream one ore more newline-seperated json encoded events through a tcp connection.
|
88
|
-
|
89
|
-
echo "\{\"_type\": \"unicorn_seen\"\}\n" | nc localhost 2323
|
90
|
-
|
91
|
-
The fast way: Add your event directly to the redis-based queue:
|
92
|
-
|
93
|
-
uuid = (8**32).to_s(36)
|
94
|
-
event = { :_type => "unicorn_seen" }.to_json
|
95
|
-
|
96
|
-
redis.lpush("fnordmetric-queue", uuid)
|
97
|
-
redis.set("fnordmetric-event-#{my_uuid}", event)
|
98
|
-
redis.expire("fnordmetric-event-#{my_uuid}", 60)
|
99
|
-
|
100
|
-
---
|
101
|
-
|
102
|
-
=== Special Events
|
103
|
-
|
104
|
-
// track a pageview
|
105
|
-
{ "_type": "_pageview", "url": "/blob/my_super_seo_article", "_session": "mysessiontoken" }
|
106
|
-
|
107
|
-
// set the user name
|
108
|
-
{ "_type": "_set_name", "name": "Tingle Tangle Bob", "_session": "mysessiontoken" }
|
109
|
-
|
110
|
-
// set the user picture
|
111
|
-
{ "_type": "_set_picture", "url": "http://myhost/123.jpg", "_session": "mysessiontoken" }
|
112
|
-
|
113
|
-
|
114
|
-
---
|
115
|
-
|
116
|
-
=== DSL Methods
|
117
|
-
|
118
|
-
gauge
|
119
|
-
|
120
|
-
widget
|
121
|
-
|
122
|
-
event
|
123
|
-
|
124
|
-
|
125
|
-
---
|
126
|
-
|
127
|
-
=== Event Handlers
|
128
|
-
|
129
|
-
call these methods from the event-handler block
|
130
|
-
|
131
|
-
incr(gauge_name, value=1):
|
132
|
-
Increment the given (two-dimensional) gauge by value at the tick specified by event-time
|
133
|
-
|
134
|
-
incr_field(gauge_name, field_name, value=1):
|
135
|
-
Increment the given field on a three-dimensional gauge by value at the tick specified by event-time
|
136
|
-
|
137
|
-
set_value(gauge_name, value)
|
138
|
-
Set the given (two-dimensional) to value at the tick specified by event-time (overwrite existing value)
|
139
|
-
|
140
|
-
set_field(gauge_name, field_name, value)
|
141
|
-
Set the given field on a three-dimensional gauge to value at the tick specified by event-time (overwrite existing value)
|
142
|
-
|
143
|
-
|
144
|
-
---
|
145
|
-
|
146
|
-
=== Gauges
|
147
|
-
|
148
|
-
---
|
149
|
-
|
150
|
-
=== Widgets
|
151
|
-
|
152
|
-
[autoupdate] auto-refresh the timeline every n secs (0 turns autoupdate off)
|
153
|
-
|
154
|
-
==== Widget-Options: TimelineWidget
|
155
|
-
|
156
|
-
[plot_style] one of: line, areaspline
|
157
|
-
[include_current] show the current tick?
|
158
|
-
[ticks] number of ticks to show (defaults to 24/30)
|
159
|
-
|
160
|
-
==== Widget-Options: BarsWidget
|
161
|
-
|
162
|
-
[plot_style] one of: vertical, horizontal
|
163
|
-
[order_by]: order bars/columns by: value, field
|
164
|
-
|
165
|
-
==== Widget-Options: Numbers-Widget
|
166
|
-
|
167
|
-
==== Widget-Options: ToplistWidget
|
168
|
-
|
169
|
-
|
170
|
-
---
|
171
|
-
|
172
|
-
=== JSON API
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
== Examples
|
177
|
-
|
178
|
-
(link1), (link2), (link3), (link4)
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
== Full Example
|
183
|
-
|
184
|
-
require "fnordmetric"
|
185
|
-
|
186
|
-
FnordMetric.namespace :myapp do
|
187
|
-
|
188
|
-
# numeric (delta) gauge, 1-hour tick
|
189
|
-
gauge :messages_sent,
|
190
|
-
:tick => 1.hour.to_i,
|
191
|
-
:title => "Messages (sent) per Hour"
|
192
|
-
|
193
|
-
# numeric (delta) gauge, 1-hour tick
|
194
|
-
gauge :messages_read,
|
195
|
-
:tick => 1.hour.to_i,
|
196
|
-
:title => "Messages (read) per Hour"
|
197
|
-
|
198
|
-
# numeric (progressive) gauge, 1-hour tick
|
199
|
-
gauge :events_total,
|
200
|
-
:tick => 1.day.to_i,
|
201
|
-
:progressive => true,
|
202
|
-
:title => "Events (total)"
|
203
|
-
|
204
|
-
# numeric (delta) gauge, increments uniquely by session_key
|
205
|
-
gauge :pageviews_daily_unique,
|
206
|
-
:tick => 1.day.to_i,
|
207
|
-
:unique => true,
|
208
|
-
:title => "Unique Visits (Daily)"
|
209
|
-
|
210
|
-
# numeric (delta) gauge, increments uniquely by session_key, returns average
|
211
|
-
gauge :avg_age_per_session,
|
212
|
-
:tick => 1.day.to_i,
|
213
|
-
:unique => true,
|
214
|
-
:average => true,
|
215
|
-
:title => "Avg. User Age"
|
216
|
-
|
217
|
-
# three-dimensional (delta) gauge (time->key->value)
|
218
|
-
gauge :pageviews_per_url_daily,
|
219
|
-
:tick => 1.day.to_i,
|
220
|
-
:title => "Daily Pageviews per URL",
|
221
|
-
:three_dimensional => true
|
222
|
-
|
223
|
-
|
224
|
-
# on every event like { _type: 'message_sent' }
|
225
|
-
event(:message_sent) do
|
226
|
-
# increment the messages_sent gauge by 1
|
227
|
-
incr :messages_sent
|
228
|
-
end
|
229
|
-
|
230
|
-
# on every event like { _type: 'message_read' }
|
231
|
-
event(:message_read) do
|
232
|
-
# increment the messages_read gauge by 1
|
233
|
-
incr :messages_read
|
234
|
-
end
|
235
|
-
|
236
|
-
# on _every_ event
|
237
|
-
event :"*" do
|
238
|
-
# increment the events_total gauge by 1
|
239
|
-
incr :events_total
|
240
|
-
end
|
241
|
-
|
242
|
-
# on every event like { _type: '_pageview', _session: 'sbz7jset', _url: '/page2' }
|
243
|
-
event :_pageview do
|
244
|
-
# increment the daily_uniques gauge by 1 if session_key hasn't been seen in this tick yet
|
245
|
-
incr :pageviews_daily_unique
|
246
|
-
# increment the pageviews_per_url_daily gauge by 1 where key = 'page2'
|
247
|
-
incr_field :pageviews_per_url_daily, data[:url]
|
248
|
-
end
|
249
|
-
|
250
|
-
# on every event like { _type: '_pageview', my_set_age: '23' }
|
251
|
-
event(:my_set_age) do
|
252
|
-
# add the value of my_set_age to the avg_age_per_session gauge if session_key
|
253
|
-
# hasn't been seen in this tick yet
|
254
|
-
incr :avg_age_per_session, data[:my_age_field]
|
255
|
-
end
|
256
|
-
|
257
|
-
# draw a timeline showing the pageviews_daily_unique, auto-refresh every 30s
|
258
|
-
widget 'Overview', {
|
259
|
-
:title => "Unique Visits per Day",
|
260
|
-
:type => :timeline,
|
261
|
-
:width => 70,
|
262
|
-
:gauges => :pageviews_daily_unique,
|
263
|
-
:include_current => true,
|
264
|
-
:autoupdate => 30
|
265
|
-
}
|
266
|
-
|
267
|
-
# draw the values of the messages_sent and messages_read gauge at the current tick, three ticks ago, and
|
268
|
-
# the sum of the last 10 ticks, auto-refresh every 20s
|
269
|
-
widget 'Overview', {
|
270
|
-
:title => "Messages Sent / Read",
|
271
|
-
:type => :numbers,
|
272
|
-
:width => 30,
|
273
|
-
:autoupdate => 20,
|
274
|
-
:offsets => [0,3,"10s"]
|
275
|
-
:gauges => [ :messages_sent, :messages_read ]
|
276
|
-
}
|
277
|
-
|
278
|
-
# draw a list of the most visited urls (url, visits + percentage), auto-refresh every 20s
|
279
|
-
widget 'Overview', {
|
280
|
-
:title => "Top Pages",
|
281
|
-
:type => :toplist,
|
282
|
-
:autoupdate => 20,
|
283
|
-
:gauges => [ :pageviews_per_url_daily ]
|
284
|
-
}
|
285
|
-
|
286
|
-
end
|
287
|
-
|
288
|
-
FnordMetric.standalone
|
289
|
-
|
290
|
-
|
291
|
-
== License
|
292
|
-
|
293
|
-
Copyright (c) 2011 Paul Asmuth
|
294
|
-
|
295
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
296
|
-
a copy of this software and associated documentation files (the
|
297
|
-
"Software"), to use, copy and modify copies of the Software, subject
|
298
|
-
to the following conditions:
|
299
|
-
|
300
|
-
The above copyright notice and this permission notice shall be
|
301
|
-
included in all copies or substantial portions of the Software.
|
302
|
-
|
303
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
304
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
305
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
306
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
307
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
308
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
309
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
310
|
-
|
311
|
-
|
312
|
-
== Todos
|
313
|
-
|
314
|
-
-> funnel-widget
|
315
|
-
-> combine/calculation gauges via opts_gauge({}, &block) (+calculate ctr)
|
316
|
-
-> timeline_widget: 'compare mode': compate gauge to yesterday
|
317
|
-
-> fix include_current
|
318
|
-
-> numbers_widget: handle decreasing vals
|
319
|
-
-> make redis-addr and redis-prefix + listen-ports configurable
|
320
|
-
-> referal tracking fu (parse googlequeries)
|
321
|
-
-> trend detection
|
322
|
-
-> opt_event options: :increment => gauge_name
|
323
|
-
-> preconfigured default-dashboard (like google analytics)
|
324
|
-
-> pagview+ref-tracking via js-tracking-pixel
|
325
|
-
-> table/gauge-list-widget (with mini-stats!)
|
326
|
-
-> prune the namespace-sessions-timline (remove event_ids older than x)
|
327
|
-
-> prune the namespace-event-types-list (trim to max items)
|
328
|
-
-> timelinewidget + numberswidget => should use redis hmget
|
329
|
-
-> get multiple metrics in a single http get
|
330
|
-
-> { _namespace: myns } field (!!!)
|
331
|
-
|
332
|
-
|
333
|
-
-> demo / example: chatroom;
|
334
|
-
-> events: msg_read, msg_sent, {reg_start, reg_register, reg_active}, login (+demog.data+lang), referall
|
335
|
-
-> widgets: msgs sent/read (timeline), user-demog. (bars), reg-funnel (funnel), male vs. female users (pie), top langs (list), kpi list (toplist - regs, msg/user, conversion rate, etc), top referrers
|
336
|
-
|
337
|
-
|