fnordmetric 0.3.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -0
- data/Gemfile.lock +21 -0
- data/Procfile +1 -2
- data/VERSION +1 -1
- data/_spec/app_spec.rb +178 -0
- data/{spec → _spec}/cache_spec.rb +0 -0
- data/{spec → _spec}/combine_metric_spec.rb +0 -0
- data/{spec → _spec}/core_spec.rb +0 -0
- data/{spec → _spec}/count_metric_spec.rb +0 -0
- data/_spec/dashboard_spec.rb +67 -0
- data/_spec/event_spec.rb +46 -0
- data/{spec → _spec}/metric_spec.rb +0 -0
- data/{spec → _spec}/report_spec.rb +0 -0
- data/{spec → _spec}/sum_metric_spec.rb +0 -0
- data/_spec/widget_spec.rb +107 -0
- data/doc/import_dump.rb +26 -0
- data/em_runner.rb +33 -0
- data/fnordmetric.gemspec +59 -20
- data/haml/app.haml +26 -12
- data/lib/fnordmetric.rb +150 -15
- data/lib/fnordmetric/app.rb +70 -11
- data/lib/fnordmetric/cache.rb +4 -4
- data/lib/fnordmetric/context.rb +65 -0
- data/lib/fnordmetric/dashboard.rb +16 -12
- data/lib/fnordmetric/event.rb +65 -15
- data/lib/fnordmetric/gauge.rb +46 -0
- data/lib/fnordmetric/gauge_calculations.rb +43 -0
- data/lib/fnordmetric/gauge_modifiers.rb +43 -0
- data/lib/fnordmetric/inbound_stream.rb +66 -0
- data/lib/fnordmetric/logger.rb +38 -0
- data/lib/fnordmetric/namespace.rb +120 -0
- data/lib/fnordmetric/numbers_widget.rb +29 -11
- data/lib/fnordmetric/session.rb +131 -0
- data/lib/fnordmetric/standalone.rb +31 -0
- data/lib/fnordmetric/timeline_widget.rb +29 -9
- data/lib/fnordmetric/widget.rb +50 -45
- data/lib/fnordmetric/worker.rb +80 -0
- data/pub/fnordmetric/fnordmetric.css +76 -9
- data/pub/fnordmetric/fnordmetric.js +541 -42
- data/pub/raphael-min.js +8 -0
- data/pub/raphael-utils.js +221 -0
- data/readme.rdoc +172 -27
- data/server.rb +22 -0
- data/spec/app_spec.rb +359 -117
- data/spec/context_spec.rb +42 -0
- data/spec/dashboard_spec.rb +7 -47
- data/spec/event_spec.rb +114 -33
- data/spec/gauge_modifiers_spec.rb +276 -0
- data/spec/gauge_spec.rb +128 -0
- data/spec/namespace_spec.rb +104 -0
- data/spec/session_spec.rb +231 -0
- data/spec/spec_helper.rb +27 -4
- data/spec/widget_spec.rb +81 -75
- data/spec/worker_spec.rb +37 -0
- data/test_stream.sh +187 -0
- data/ulm_stats.rb +198 -0
- metadata +114 -35
- data/lib/fnordmetric/core.rb +0 -66
- data/lib/fnordmetric/engine.rb +0 -3
data/lib/fnordmetric/core.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
module FnordMetric
|
2
|
-
|
3
|
-
WIDGET_TYPES = %(timeline funnel numbers)
|
4
|
-
|
5
|
-
@@metrics = {}
|
6
|
-
@@widgets = {}
|
7
|
-
@@dashboards = Array.new
|
8
|
-
|
9
|
-
def self.define(metric_name, options)
|
10
|
-
warn "FnordMetric.metric is deprecated, please use FnordMetric.metric instead"
|
11
|
-
self.metric(metric_name, options)
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.metric(metric_name, options)
|
15
|
-
options.merge!(:name => metric_name)
|
16
|
-
@@metrics[metric_name] = FnordMetric::Metric.from_options(options)
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.widget(widget_name, options)
|
20
|
-
options.merge!(:widget_name => widget_name)
|
21
|
-
raise "missing option: :type" unless options[:type]
|
22
|
-
klass = if FnordMetric::WIDGET_TYPES.include?(options[:type].to_s)
|
23
|
-
"FnordMetric::#{options[:type].to_s.capitalize}Widget".constantize
|
24
|
-
else
|
25
|
-
raise "unknown widget type: #{options[:type]}"
|
26
|
-
end
|
27
|
-
[options[:metrics]].flatten.each do |m|
|
28
|
-
raise "unknown metric: #{m}" unless @@metrics[m]
|
29
|
-
end
|
30
|
-
@@widgets[widget_name] = klass.new(options)
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.dashboard(title, options={}, &block)
|
34
|
-
options.merge!(:title => title)
|
35
|
-
@@dashboards << FnordMetric::Dashboard.new(options, block)
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.track(event_name, event_data)
|
39
|
-
FnordMetric::Event.track!(event_name, event_data)
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.report(options)
|
43
|
-
FnordMetric::Report.new(metrics, options)
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.metrics
|
47
|
-
@@metrics
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.widgets
|
51
|
-
@@widgets
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.reset_metrics
|
55
|
-
@@metrics = {}
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.reset_widgets
|
59
|
-
@@widgets = {}
|
60
|
-
end
|
61
|
-
|
62
|
-
def self.dashboards
|
63
|
-
@@dashboards
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
data/lib/fnordmetric/engine.rb
DELETED