librato-rails 0.8.0 → 0.8.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 (26) hide show
  1. data/README.md +81 -45
  2. data/lib/librato/rails/version.rb +1 -1
  3. data/test/dummy/db/development.sqlite3 +0 -0
  4. data/test/dummy/db/test.sqlite3 +0 -0
  5. data/test/dummy/log/development.log +2189 -0
  6. data/test/dummy/log/test.log +11522 -0
  7. data/test/dummy/test_env.sh +2 -0
  8. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  9. data/test/dummy/tmp/cache/assets/CDF/870/sprockets%2Fb878faf942403e313a5b103e5d80488e +0 -0
  10. data/test/dummy/tmp/cache/assets/CE8/7E0/sprockets%2F178e2a1f9aa891d473009c7f3095df28 +0 -0
  11. data/test/dummy/tmp/cache/assets/CF9/7C0/sprockets%2F40fc2f3d2a468a00e463f1d313cb1683 +0 -0
  12. data/test/dummy/tmp/cache/assets/D04/890/sprockets%2F587335c079eef8d5a63784fc8f99905a +0 -0
  13. data/test/dummy/tmp/cache/assets/D05/D40/sprockets%2F1c9faaf28d05409b88ad3113374d613c +0 -0
  14. data/test/dummy/tmp/cache/assets/D11/D90/sprockets%2Ff688bee5b15ad322749fd06432065df2 +0 -0
  15. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  16. data/test/dummy/tmp/cache/assets/D48/6E0/sprockets%2F3d5dd928c45756c99bb1018cdbba7485 +0 -0
  17. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  18. data/test/dummy/tmp/cache/assets/D4F/000/sprockets%2F25e44896aac12384727e9dab827ebef9 +0 -0
  19. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  20. data/test/dummy/tmp/cache/assets/D66/890/sprockets%2F789354d3ec91e1ba6c8e92878d8f6ff8 +0 -0
  21. data/test/dummy/tmp/cache/assets/D84/000/sprockets%2F2ed60caa8412eb8334fe327cab12cb32 +0 -0
  22. data/test/dummy/tmp/cache/assets/D8B/F90/sprockets%2Ffe6ce696e9141eb755d8eed79128e17c +0 -0
  23. data/test/dummy/tmp/cache/assets/D98/8B0/sprockets%2Fedbef6e0d0a4742346cf479f2c522eb0 +0 -0
  24. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  25. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  26. metadata +56 -4
data/README.md CHANGED
@@ -3,18 +3,39 @@ librato-rails
3
3
 
4
4
  [![Build Status](https://secure.travis-ci.org/librato/librato-rails.png?branch=master)](http://travis-ci.org/librato/librato-rails)
5
5
 
6
- Report key statistics for your Rails app to [Librato Metrics](https://metrics.librato.com/), easily track your own custom metrics. Currently supports Rails 3.0+.
6
+ `librato-rails` will report key statistics for your Rails app to [Librato Metrics](https://metrics.librato.com/) and allow you to easily track your own custom metrics. Metrics are delivered asynchronously behind the scenes so they won't affect performance of your requests.
7
7
 
8
- **NOTE: This is currently in alpha development and is not yet officially supported**
8
+ Currently Rails 3.0+ and Ruby 1.9.2+ are required.
9
9
 
10
- You may want to read the [notes on upgrading](https://github.com/librato/librato-rails/wiki/Alpha-Tester-Upgrade-Notes) if you are an alpha tester.
10
+ You may want to read the [notes on upgrading](https://github.com/librato/librato-rails/wiki/Alpha-Tester-Upgrade-Notes) if you were an alpha tester.
11
+
12
+ ## Quick Start
13
+
14
+ Installing `librato-rails` and relaunching your application will automatically start the reporting of metrics to your Metrics account.
15
+
16
+ After installation `librato-rails` will detect your environment and start reporting available performance information for your application.
17
+
18
+ Custom metrics can also be added easily:
19
+
20
+ ```ruby
21
+ # keep counts of key events
22
+ Librato.increment 'user.signup'
23
+
24
+ # easily benchmark sections of code to verify production performance
25
+ Librato.timing 'my.complicated.work' do
26
+ # do work
27
+ end
28
+
29
+ # track averages across requests
30
+ Librato.measure 'user.social_graph.nodes', user.social_graph.size
31
+ ```
11
32
 
12
33
  ## Installation
13
34
 
14
35
  In your `Gemfile` add:
15
36
 
16
37
  gem 'librato-rails'
17
-
38
+
18
39
  Then run `bundle install`.
19
40
 
20
41
  ## Configuration
@@ -25,17 +46,19 @@ If you don't have a Metrics account already, [sign up](https://metrics.librato.c
25
46
 
26
47
  Create a `config/librato.yml` like the following:
27
48
 
28
- production:
29
- user: <your-email>
30
- token: <your-api-key>
49
+ ```yaml
50
+ production:
51
+ user: <your-email>
52
+ token: <your-api-key>
53
+ ```
31
54
 
32
- The `librato.yml` file is parsed via ERB in case you need to add some host or environment-specific magic.
55
+ The `librato.yml` file is parsed via ERB in case you need to add some host or environment-specific magic.
33
56
 
34
- Note that using a configuration file allows you to specify different configurations per-environment. Submission will be disabled in any environment without credentials.
57
+ Note that using a configuration file allows you to specify different configurations per-environment. Submission will be disabled in any environment without credentials.
35
58
 
36
59
  ##### Use environment variables
37
60
 
38
- Alternately you can provide `LIBRATO_USER` and `LIBRATO_TOKEN` environment variables. Unlike config file settings, environment variables will be used in all non-test environments (development, production, etc).
61
+ Alternately you can provide `LIBRATO_USER` and `LIBRATO_TOKEN` environment variables. Unlike config file settings, environment variables will be used in all non-test environments (development, production, etc).
39
62
 
40
63
  Note that if a config file is present, _all environment variables will be ignored_.
41
64
 
@@ -48,7 +71,7 @@ If you are using the Librato Metrics Heroku addon, your user and token environme
48
71
  In either case you will need to specify a custom source for your app to track properly. If `librato-rails` does not detect an explicit source it will not start. You can set the source in your environment:
49
72
 
50
73
  heroku config:add LIBRATO_SOURCE=myappname
51
-
74
+
52
75
  If you are using a config file, add your source entry to that instead.
53
76
 
54
77
  Full information on configuration options is available on the [configuration wiki page](https://github.com/librato/librato-rails/wiki/Configuration).
@@ -57,9 +80,9 @@ Note that if Heroku idles your application measurements will not be sent until i
57
80
 
58
81
  ## Automatic Measurements
59
82
 
60
- After installing `librato-rails` and restarting your app and you will see a number of new metrics appear in your Metrics account. These track request performance, sql queries, mail handling, and other key stats.
83
+ After installing `librato-rails` and restarting your app and you will see a number of new metrics appear in your Metrics account. These track request performance, sql queries, mail handling, and other key stats.
61
84
 
62
- Built-in performance metrics will start with either `rack` or `rails`, depending on the level they are being sampled from. For example: `rails.request.total` is the total number of requests rails has received each minute.
85
+ Built-in performance metrics will start with either `rack` or `rails`, depending on the level they are being sampled from. For example: `rails.request.total` is the total number of requests rails has received each minute.
63
86
 
64
87
  ## Custom Measurements
65
88
 
@@ -69,15 +92,17 @@ Tracking anything that interests you is easy with Metrics. There are four primar
69
92
 
70
93
  Use for tracking a running total of something _across_ requests, examples:
71
94
 
72
- # increment the 'sales_completed' metric by one
73
- Librato.increment 'sales_completed'
74
-
75
- # increment by five
76
- Librato.increment 'items_purchased', :by => 5
77
-
78
- # increment with a custom source
79
- Librato.increment 'user.purchases', :source => user.id
80
-
95
+ ```ruby
96
+ # increment the 'sales_completed' metric by one
97
+ Librato.increment 'sales_completed'
98
+
99
+ # increment by five
100
+ Librato.increment 'items_purchased', :by => 5
101
+
102
+ # increment with a custom source
103
+ Librato.increment 'user.purchases', :source => user.id
104
+ ```
105
+
81
106
  Other things you might track this way: user signups, requests of a certain type or to a certain route, total jobs queued or processed, emails sent or received
82
107
 
83
108
  ###### Sporadic Increment Reporting
@@ -86,46 +111,57 @@ Note that `increment` is primarily used for tracking the rate of occurrence of s
86
111
 
87
112
  Especially with custom sources you may want the opposite behavior - reporting a measurement only during intervals where `increment` was called on the metric:
88
113
 
89
- # report a value for 'user.uploaded_file' only during non-zero intervals
90
- Librato.increment 'user.uploaded_file', :source => user.id, :sporadic => true
114
+ ```ruby
115
+ # report a value for 'user.uploaded_file' only during non-zero intervals
116
+ Librato.increment 'user.uploaded_file', :source => user.id, :sporadic => true
117
+ ```
91
118
 
92
119
  #### measure
93
120
 
94
121
  Use when you want to track an average value _per_-request. Examples:
95
122
 
96
- Librato.measure 'user.social_graph.nodes', 212
123
+ ```ruby
124
+ Librato.measure 'user.social_graph.nodes', 212
97
125
 
98
- # report from a custom source
99
- Librato.measure 'jobs.queued', 3, :source => 'worker.12'
100
-
126
+ # report from a custom source
127
+ Librato.measure 'jobs.queued', 3, :source => 'worker.12'
128
+ ```
101
129
 
102
130
  #### timing
103
131
 
104
132
  Like `Librato.measure` this is per-request, but specialized for timing information:
105
133
 
106
- Librato.timing 'twitter.lookup.time', 21.2
107
-
134
+ ```ruby
135
+ Librato.timing 'twitter.lookup.time', 21.2
136
+ ```
137
+
108
138
  The block form auto-submits the time it took for its contents to execute as the measurement value:
109
139
 
110
- Librato.timing 'twitter.lookup.time' do
111
- @twitter = Twitter.lookup(user)
112
- end
140
+ ```ruby
141
+ Librato.timing 'twitter.lookup.time' do
142
+ @twitter = Twitter.lookup(user)
143
+ end
144
+ ```
113
145
 
114
146
  #### group
115
147
 
116
148
  There is also a grouping helper, to make managing nested metrics easier. So this:
117
149
 
118
- Librato.measure 'memcached.gets', 20
119
- Librato.measure 'memcached.sets', 2
120
- Librato.measure 'memcached.hits', 18
121
-
150
+ ```ruby
151
+ Librato.measure 'memcached.gets', 20
152
+ Librato.measure 'memcached.sets', 2
153
+ Librato.measure 'memcached.hits', 18
154
+ ```
155
+
122
156
  Can also be written as:
123
157
 
124
- Librato.group 'memcached' do |g|
125
- g.measure 'gets', 20
126
- g.measure 'sets', 2
127
- g.measure 'hits', 18
128
- end
158
+ ```ruby
159
+ Librato.group 'memcached' do |g|
160
+ g.measure 'gets', 20
161
+ g.measure 'sets', 2
162
+ g.measure 'hits', 18
163
+ end
164
+ ```
129
165
 
130
166
  Symbols can be used interchangably with strings for metric names.
131
167
 
@@ -135,17 +171,17 @@ You can set an optional prefix to all metrics reported by `librato-rails` in you
135
171
 
136
172
  ## Cross-Process Aggregation
137
173
 
138
- `librato-rails` submits measurements back to the Librato platform on a _per-process_ basis. By default these measurements are then combined into a single measurement per source (default is your hostname) before persisting the data.
174
+ `librato-rails` submits measurements back to the Librato platform on a _per-process_ basis. By default these measurements are then combined into a single measurement per source (default is your hostname) before persisting the data.
139
175
 
140
176
  For example if you have 4 hosts with 8 unicorn instances each (i.e. 32 processes total), on the Metrics site you'll find 4 data streams (1 per host) instead of 32.
141
177
  Current pricing applies after aggregation, so in this case you will be charged for 4 streams instead of 32.
142
178
 
143
179
  If you want to report per-process instead, you can set `source_pids` to `true` in
144
- your config, which will append the process id to the source name used by each thread.
180
+ your config, which will append the process id to the source name used by each thread.
145
181
 
146
182
  ## Troubleshooting
147
183
 
148
- Note that it may take 2-3 minutes for the first results to show up in your Metrics account after you have started your servers with `librato-rails` enabled and the first request has been received.
184
+ Note that it may take 2-3 minutes for the first results to show up in your Metrics account after you have started your servers with `librato-rails` enabled and the first request has been received.
149
185
 
150
186
  If you want to get more information about `librato-rails` submissions to the Metrics service you can set your `log_level` to `debug` (see [configuration](https://github.com/librato/librato-rails/wiki/Configuration)) to get detailed information added to your logs about the settings `librato-rails` is seeing at startup and when it is submitting.
151
187
 
@@ -1,5 +1,5 @@
1
1
  module Librato
2
2
  module Rails
3
- VERSION = "0.8.0"
3
+ VERSION = "0.8.1"
4
4
  end
5
5
  end
File without changes
Binary file