kpi 0.3.0 → 0.3.1

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 (2) hide show
  1. data/README.rdoc +79 -3
  2. metadata +2 -2
data/README.rdoc CHANGED
@@ -1,8 +1,84 @@
1
- = kpi
1
+ = Key Performance Indicators
2
2
 
3
- Description goes here.
3
+ This gem helps you to track key indicators in your Rails app.
4
4
 
5
- == Contributing to kpi
5
+ Have you even wanted to get daily reports with information:
6
+ * how many users registered to my app?
7
+ * how many users registered today?
8
+ * what is a total revenue today?
9
+ * how many times certain event occurred in app?
10
+ and so on?
11
+
12
+ This gem lets you define your application state reports with ease. Look:
13
+
14
+ == Installation
15
+
16
+ === Rails 3.x
17
+
18
+ Add to your Gemfile:
19
+
20
+ gem "kpi"
21
+
22
+ and run in console in project directory:
23
+
24
+ $ bundle
25
+
26
+ == Configuration
27
+
28
+ Create config/initializers/kpi.rb:
29
+
30
+ KPI.configure do |c|
31
+ c.app_name = "Your App Name"
32
+ c.mail_from = "Your App KPI Service <kpi@example.com>"
33
+ c.mail_to = "your@email.com"
34
+ end
35
+
36
+ == Defining report
37
+
38
+ Example report in app/models/daily_kpi_report.rb:
39
+
40
+ class DailyKpiReport < KPI::Report::Base
41
+ def users_count
42
+ return ["Users count", User.count, "Total users count"]
43
+ end
44
+
45
+ def today_registrations_count
46
+ return ["Today registrations count", User.where("created_at > ?", @time - 24.hours)]
47
+ end
48
+ end
49
+
50
+ Each defined method should return an array containing 2 or 3 elements:
51
+ * KPI title
52
+ * value
53
+ * optional description
54
+
55
+ It is important, if your indicator depends on current time (last 24 hours, last week),
56
+ to rely on @time instance variable instead of Time.now. This lets you to generate report
57
+ for every moment in history:
58
+
59
+ report = DailyKpiReport.new(2.days.ago)
60
+
61
+ == Sending report
62
+
63
+ To collect all statistics and send an email to you just call:
64
+
65
+ DailyKpiReport.collect_and_send!
66
+
67
+ == Other
68
+ * You can override report title by overriding title method in report:
69
+ class DailyKpiReport < KPI::Report::Base
70
+ def title; "Your daily report"; end
71
+ # ...
72
+ end
73
+
74
+ == Todo
75
+
76
+ * Database persistence - storing reports in different databases: PostgreSQL & Mongo prioritized
77
+ * Controllers & views allowing to review stored reports
78
+ * More tests ;)
79
+
80
+
81
+ == Contributing to KPI
6
82
 
7
83
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
84
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: kpi
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.0
5
+ version: 0.3.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Artur Roszczyk
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- hash: -1994630966239560221
117
+ hash: -914412323094170311
118
118
  segments:
119
119
  - 0
120
120
  version: "0"