You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 11, 2023. It is now read-only.
Copy file name to clipboardexpand all lines: README.md
+52-73
Original file line number
Diff line number
Diff line change
@@ -68,17 +68,41 @@ To see all config options or for information on combining config files and envir
68
68
69
69
If you are using the Librato Heroku addon, your user and token environment variables will already be set in your Heroku environment. If you are running without the addon you will need to provide them yourself.
70
70
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:
71
+
If Heroku idles your application, measurements will not be sent until it receives another request and is restarted. If you see intermittent gaps in your measurements during periods of low traffic, this is the most likely cause.
72
72
73
-
heroku config:add LIBRATO_SOURCE=myappname
73
+
If you are using Librato as a Heroku addon, [a paid plan](https://elements.heroku.com/addons/librato#pricing) is required for reporting custom metrics with librato-rails. You can view more about available addon levels [here](https://elements.heroku.com/addons/librato#pricing).
74
74
75
-
If you are using a config file, add your source entry to that instead.
75
+
## Default Tags
76
76
77
-
Full information on configuration options is available on the [configuration wiki page](https://github.com/librato/librato-rails/wiki/Configuration).
77
+
Librato Metrics supports tagged measurements that are associated with a metric, one or more tag pairs, and a point in time. For more information on tagged measurements, visit our [API documentation](https://www.librato.com/docs/api/#measurements).
78
78
79
-
If Heroku idles your application, measurements will not be sent until it receives another request and is restarted. If you see intermittent gaps in your measurements during periods of low traffic, this is the most likely cause.
79
+
##### Detected Tags
80
80
81
-
If you are using Librato as a Heroku addon, [a paid plan](https://elements.heroku.com/addons/librato#pricing) is required for reporting custom metrics with librato-rails. You can view more about available addon levels [here](https://elements.heroku.com/addons/librato#pricing).
81
+
By default, `service`, `environment` and `host` are detected and applied as default tags for submitted measurements. Optionally, you can override the detected values in your configuration file:
82
+
83
+
```yaml
84
+
production:
85
+
user: <your-email>
86
+
token: <your-api-key>
87
+
tags:
88
+
service: 'myapp'
89
+
environment: 'production'
90
+
host: 'myapp-prod-1'
91
+
```
92
+
93
+
##### Custom Tags
94
+
95
+
In addition to the default tags, you can also provide custom tags:
96
+
97
+
```yaml
98
+
production:
99
+
user: <your-email>
100
+
token: <your-api-key>
101
+
tags:
102
+
region: 'us-east-1'
103
+
```
104
+
105
+
Full information on configuration options is available on the [configuration wiki page](https://github.com/librato/librato-rails/wiki/Configuration).
82
106
83
107
## Automatic Measurements
84
108
@@ -93,9 +117,8 @@ The metrics automatically recorded by `librato-rails` are organized into named m
93
117
###### Request Metrics
94
118
95
119
* *rails_controller*: Metrics which provide a high level overview of request performance including `rails.request.total`, `rails.request.time`, `rails.request.time.db`, `rails.request.time.view`, and `rails.request.slow`
96
-
* *rails_method*: `rails.request.method.*` metrics (GET, POST, etc)
97
-
* *rails_status*: `rails.request.status.*` metrics broken out by individual status codes and class (200, 2xx, etc)
98
-
* *rails_action*: `rails.action.*` metrics specific to individual controller actions via the [instrument_action](#instrument_action-experimental) helper
120
+
* *rails_method*: `rails.request.method` metric with `method` tag name and HTTP method tag value, e.g. `method=POST`
121
+
* *rails_status*: `rails.request.status` metric with `status` tag name and HTTP status code tag value, e.g. `status=200`
99
122
100
123
###### System-Specific Metrics
101
124
@@ -110,8 +133,8 @@ The metrics automatically recorded by `librato-rails` are organized into named m
110
133
Rack measurements are taken from the very beginning of your [rack middleware stack](http://guides.rubyonrails.org/rails_on_rack.html). They include all time spent in your ruby process (not just in Rails proper). They will also show requests that are handled entirely in middleware and don't appear in the `rails` suites above.
111
134
112
135
* *rack*: The `rack.request.total`, `rack.request.time`, `rack.request.slow`, and `rack.request.queue.time` metrics
113
-
* *rack_method*: `rack.request.method.*` metrics (GET, POST, etc)
114
-
* *rack_status*: `rack.request.status.*` metrics metrics broken out by individual status codes and class (200, 2xx, etc)
136
+
* *rack_method*: `rack.request.method` metric with `method` tag name and HTTP method tag value, e.g. `method=POST`
137
+
* *rack_status*: `rack.request.status` metric with `status` tag name and HTTP status code tag value, e.g. `status=200`
115
138
116
139
###### Queue Time
117
140
@@ -156,13 +179,20 @@ Use for tracking a running total of something _across_ requests, examples:
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
@@ -175,7 +205,7 @@ Especially with custom sources you may want the opposite behavior - reporting a
175
205
176
206
```ruby
177
207
# report a value for 'user.uploaded_file' only during non-zero intervals
Each instrumented action will appear as a source for the `rails.action.*` metrics, for example `mycontroller.action.html`.
298
-
299
-
IMPORTANT NOTE: Metrics from `instrument_action` take into account all time spent in the ActionController stack for that action, including before/after filters and any global processing. They are _not_ equivalent to using a `Librato.timing` block inside the method body.
300
-
301
283
## Use with ActiveSupport::Notifications
302
284
303
285
`librato-rails`and [ActiveSupport::Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) work great together. In fact, many of the Rails metrics provided are produced by subscribing to the [instrumentation events](http://edgeguides.rubyonrails.org/active_support_instrumentation.html) built into Rails.
@@ -324,7 +306,7 @@ ActiveSupport::Notifications.subscribe 'my.event' do |*args|
@@ -357,14 +339,11 @@ Never fear, [we have some guidelines](https://github.com/librato/librato-rails/w
357
339
358
340
## Cross-Process Aggregation
359
341
360
-
`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.
342
+
`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 default tags (detects `service`, `environment` and `host`) before persisting the data.
361
343
362
344
For example if you have 4 hosts with 8 unicorn instances each (i.e. 32 processes total), on the Librato site you'll find 4 data streams (1 per host) instead of 32.
363
345
Current pricing applies after aggregation, so in this case you will be charged for 4 streams instead of 32.
364
346
365
-
If you want to report per-process instead, you can set `source_pids` to `true` in
366
-
your config, which will append the process id to the source name used by each thread.
367
-
368
347
## Troubleshooting
369
348
370
349
Note that it may take 2-3 minutes for the first results to show up in your Librato account after you have started your servers with `librato-rails` enabled and the first request has been received.
0 commit comments