fnordmetric 0.3.2 → 0.5.0

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.
Files changed (59) hide show
  1. data/Gemfile +6 -0
  2. data/Gemfile.lock +21 -0
  3. data/Procfile +1 -2
  4. data/VERSION +1 -1
  5. data/_spec/app_spec.rb +178 -0
  6. data/{spec → _spec}/cache_spec.rb +0 -0
  7. data/{spec → _spec}/combine_metric_spec.rb +0 -0
  8. data/{spec → _spec}/core_spec.rb +0 -0
  9. data/{spec → _spec}/count_metric_spec.rb +0 -0
  10. data/_spec/dashboard_spec.rb +67 -0
  11. data/_spec/event_spec.rb +46 -0
  12. data/{spec → _spec}/metric_spec.rb +0 -0
  13. data/{spec → _spec}/report_spec.rb +0 -0
  14. data/{spec → _spec}/sum_metric_spec.rb +0 -0
  15. data/_spec/widget_spec.rb +107 -0
  16. data/doc/import_dump.rb +26 -0
  17. data/em_runner.rb +33 -0
  18. data/fnordmetric.gemspec +59 -20
  19. data/haml/app.haml +26 -12
  20. data/lib/fnordmetric.rb +150 -15
  21. data/lib/fnordmetric/app.rb +70 -11
  22. data/lib/fnordmetric/cache.rb +4 -4
  23. data/lib/fnordmetric/context.rb +65 -0
  24. data/lib/fnordmetric/dashboard.rb +16 -12
  25. data/lib/fnordmetric/event.rb +65 -15
  26. data/lib/fnordmetric/gauge.rb +46 -0
  27. data/lib/fnordmetric/gauge_calculations.rb +43 -0
  28. data/lib/fnordmetric/gauge_modifiers.rb +43 -0
  29. data/lib/fnordmetric/inbound_stream.rb +66 -0
  30. data/lib/fnordmetric/logger.rb +38 -0
  31. data/lib/fnordmetric/namespace.rb +120 -0
  32. data/lib/fnordmetric/numbers_widget.rb +29 -11
  33. data/lib/fnordmetric/session.rb +131 -0
  34. data/lib/fnordmetric/standalone.rb +31 -0
  35. data/lib/fnordmetric/timeline_widget.rb +29 -9
  36. data/lib/fnordmetric/widget.rb +50 -45
  37. data/lib/fnordmetric/worker.rb +80 -0
  38. data/pub/fnordmetric/fnordmetric.css +76 -9
  39. data/pub/fnordmetric/fnordmetric.js +541 -42
  40. data/pub/raphael-min.js +8 -0
  41. data/pub/raphael-utils.js +221 -0
  42. data/readme.rdoc +172 -27
  43. data/server.rb +22 -0
  44. data/spec/app_spec.rb +359 -117
  45. data/spec/context_spec.rb +42 -0
  46. data/spec/dashboard_spec.rb +7 -47
  47. data/spec/event_spec.rb +114 -33
  48. data/spec/gauge_modifiers_spec.rb +276 -0
  49. data/spec/gauge_spec.rb +128 -0
  50. data/spec/namespace_spec.rb +104 -0
  51. data/spec/session_spec.rb +231 -0
  52. data/spec/spec_helper.rb +27 -4
  53. data/spec/widget_spec.rb +81 -75
  54. data/spec/worker_spec.rb +37 -0
  55. data/test_stream.sh +187 -0
  56. data/ulm_stats.rb +198 -0
  57. metadata +114 -35
  58. data/lib/fnordmetric/core.rb +0 -66
  59. data/lib/fnordmetric/engine.rb +0 -3
@@ -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
@@ -1,3 +0,0 @@
1
- class FnordMetric::Engine < Rails::Engine
2
- endpoint FnordMetric::App
3
- end