librato-rails 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.
- data/README.md +4 -2
- data/lib/librato/rails/version.rb +1 -1
- data/lib/librato/rails.rb +6 -6
- data/test/dummy/log/test.log +2290 -0
- data/test/fixtures/config/librato.yml +4 -4
- data/test/remote/rails_remote_test.rb +2 -2
- data/test/unit/configuration_test.rb +6 -6
- metadata +3 -3
data/README.md
CHANGED
@@ -7,6 +7,8 @@ Report key statistics for your Rails app to [Librato Metrics](https://metrics.li
|
|
7
7
|
|
8
8
|
**NOTE: This is currently in alpha development and is not yet officially supported**
|
9
9
|
|
10
|
+
**IMPORTANT NOTE: If you are currently using a version prior to the rename to librato-rails, note that the env variable names for configuration and the name of the config files have changed. See the new names in configuration, below.**
|
11
|
+
|
10
12
|
## Installation
|
11
13
|
|
12
14
|
In your `Gemfile` add:
|
@@ -22,8 +24,8 @@ If you don't have a Metrics account already, [sign up](https://metrics.librato.c
|
|
22
24
|
Create a `config/librato.yml` like the following:
|
23
25
|
|
24
26
|
production:
|
25
|
-
|
26
|
-
|
27
|
+
user: <your-email>
|
28
|
+
token: <your-api-key>
|
27
29
|
|
28
30
|
OR provide `LIBRATO_METRICS_USER` and `LIBRATO_METRICS_TOKEN` environment variables. If both env variables and a config file are present, environment variables will take precendence.
|
29
31
|
|
data/lib/librato/rails.rb
CHANGED
@@ -19,15 +19,15 @@ module Librato
|
|
19
19
|
|
20
20
|
module Rails
|
21
21
|
extend SingleForwardable
|
22
|
-
CONFIG_SETTABLE = %w{
|
22
|
+
CONFIG_SETTABLE = %w{user token flush_interval prefix source}
|
23
23
|
FORKING_SERVERS = [:unicorn, :passenger]
|
24
24
|
|
25
25
|
mattr_accessor :config_file
|
26
26
|
self.config_file = 'config/librato.yml'
|
27
27
|
|
28
28
|
# config options
|
29
|
-
mattr_accessor :
|
30
|
-
mattr_accessor :
|
29
|
+
mattr_accessor :user
|
30
|
+
mattr_accessor :token
|
31
31
|
mattr_accessor :flush_interval
|
32
32
|
mattr_accessor :prefix
|
33
33
|
|
@@ -64,8 +64,8 @@ module Librato
|
|
64
64
|
settable.each { |key| self.send("#{key}=", env_specific[key]) }
|
65
65
|
end
|
66
66
|
end
|
67
|
-
self.
|
68
|
-
self.
|
67
|
+
self.token = ENV['LIBRATO_METRICS_TOKEN'] if ENV['LIBRATO_METRICS_TOKEN']
|
68
|
+
self.user = ENV['LIBRATO_METRICS_USER'] if ENV['LIBRATO_METRICS_USER']
|
69
69
|
end
|
70
70
|
|
71
71
|
# check to see if we've forked into a process where a worker
|
@@ -181,7 +181,7 @@ module Librato
|
|
181
181
|
def prepare_client
|
182
182
|
check_config
|
183
183
|
client = Librato::Metrics::Client.new
|
184
|
-
client.authenticate
|
184
|
+
client.authenticate user, token
|
185
185
|
client.api_endpoint = @api_endpoint if @api_endpoint
|
186
186
|
client.custom_user_agent = user_agent
|
187
187
|
client
|