librato-rack 1.0.0.beta1 → 1.0.0.beta2
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +5 -0
- data/lib/librato/rack.rb +2 -12
- data/lib/librato/rack/configuration.rb +6 -8
- data/lib/librato/rack/version.rb +1 -1
- data/test/support/environment_helpers.rb +0 -4
- data/test/unit/rack/configuration_test.rb +0 -11
- metadata +2 -6
- metadata.gz.sig +0 -0
- data/test/apps/deprecated.ru +0 -14
- data/test/integration/deprecated_test.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8c27777c779a649ab5b3d24d0f33d728b37f6b8
|
4
|
+
data.tar.gz: 643b0428ff24c735bba82293bd1d651dbfdbbd1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9be2d033034479ce265377066119835d695e73711ebd814bc0845248d1c09d173e5f48c38bb42e827cbd360258c3c89d9888b0492888290b4c0a4ac7c025be7
|
7
|
+
data.tar.gz: e545965b87e64932366b7f6aa02868f0680fc6ec913268ad128499d6c198671a8573d63e855d2837edff245a339ba87c8d520837e5b2dd526dc48367dab2bd4f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
### Version 1.0.0.beta2
|
2
|
+
* Drop support for long-deprecated config via LIBRATO_METRICS_* env vars
|
3
|
+
* Drop support for old-style config passing during initialization
|
4
|
+
* Deprecate `disable_rack_metrics` config option, use `suites='none'` instead
|
5
|
+
|
1
6
|
### Version 1.0.0.beta1
|
2
7
|
* Add support for configurable metric suites
|
3
8
|
|
data/lib/librato/rack.rb
CHANGED
@@ -64,21 +64,11 @@ module Librato
|
|
64
64
|
attr_reader :config, :tracker
|
65
65
|
|
66
66
|
def initialize(app, options={})
|
67
|
-
|
68
|
-
|
69
|
-
config = options
|
70
|
-
old_style = true
|
71
|
-
else
|
72
|
-
config = options.fetch(:config, Configuration.new)
|
73
|
-
end
|
74
|
-
@app, @config = app, config
|
67
|
+
@app = app
|
68
|
+
@config = options.fetch(:config, Configuration.new)
|
75
69
|
@tracker = @config.tracker || Tracker.new(@config)
|
76
70
|
Librato.register_tracker(@tracker) # create global reference
|
77
71
|
|
78
|
-
if old_style
|
79
|
-
@tracker.deprecate 'middleware setup no longer takes a single argument, use `use Librato::Rack :config => config` instead.'
|
80
|
-
end
|
81
|
-
|
82
72
|
build_record_request_metrics_method
|
83
73
|
build_record_header_metrics_method
|
84
74
|
build_record_exception_method
|
@@ -57,11 +57,11 @@ module Librato
|
|
57
57
|
# check environment variables and capture current state
|
58
58
|
# for configuration
|
59
59
|
def load_configuration
|
60
|
-
self.user = ENV['LIBRATO_USER']
|
61
|
-
self.token = ENV['LIBRATO_TOKEN']
|
60
|
+
self.user = ENV['LIBRATO_USER']
|
61
|
+
self.token = ENV['LIBRATO_TOKEN']
|
62
62
|
self.autorun = detect_autorun
|
63
|
-
self.prefix = ENV['LIBRATO_PREFIX']
|
64
|
-
self.source = ENV['LIBRATO_SOURCE']
|
63
|
+
self.prefix = ENV['LIBRATO_PREFIX']
|
64
|
+
self.source = ENV['LIBRATO_SOURCE']
|
65
65
|
self.log_level = ENV['LIBRATO_LOG_LEVEL'] || :info
|
66
66
|
self.proxy = ENV['LIBRATO_PROXY'] || ENV['https_proxy'] || ENV['http_proxy']
|
67
67
|
self.event_mode = ENV['LIBRATO_EVENT_MODE']
|
@@ -110,10 +110,8 @@ module Librato
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def check_deprecations
|
113
|
-
|
114
|
-
|
115
|
-
deprecate "LIBRATO_METRICS_#{item} will be removed in a future release, please use LIBRATO_#{item} instead."
|
116
|
-
end
|
113
|
+
if self.disable_rack_metrics
|
114
|
+
deprecate "disable_rack_metrics configuration option will be removed in a future release, please use config.suites = 'none' instead."
|
117
115
|
end
|
118
116
|
end
|
119
117
|
|
data/lib/librato/rack/version.rb
CHANGED
@@ -12,10 +12,6 @@ module EnvironmentHelpers
|
|
12
12
|
ENV.delete('LIBRATO_SUITES')
|
13
13
|
ENV.delete('LIBRATO_LOG_LEVEL')
|
14
14
|
ENV.delete('LIBRATO_EVENT_MODE')
|
15
|
-
# legacy - deprecated
|
16
|
-
ENV.delete('LIBRATO_METRICS_USER')
|
17
|
-
ENV.delete('LIBRATO_METRICS_TOKEN')
|
18
|
-
ENV.delete('LIBRATO_METRICS_SOURCE')
|
19
15
|
# system
|
20
16
|
ENV.delete('http_proxy')
|
21
17
|
end
|
@@ -30,17 +30,6 @@ module Librato
|
|
30
30
|
#assert Librato::Rails.explicit_source, 'source is explicit'
|
31
31
|
end
|
32
32
|
|
33
|
-
def test_legacy_env_variable_config
|
34
|
-
ENV['LIBRATO_METRICS_USER'] = 'foo@bar.com'
|
35
|
-
ENV['LIBRATO_METRICS_TOKEN'] = 'api_key'
|
36
|
-
ENV['LIBRATO_METRICS_SOURCE'] = 'source'
|
37
|
-
config = Configuration.new
|
38
|
-
assert_equal 'foo@bar.com', config.user
|
39
|
-
assert_equal 'api_key', config.token
|
40
|
-
assert_equal 'source', config.source
|
41
|
-
# assert Librato::Rails.explicit_source, 'source is explicit'
|
42
|
-
end
|
43
|
-
|
44
33
|
def test_http_proxy_env_variable_config
|
45
34
|
ENV['http_proxy'] = 'http://localhost:8888'
|
46
35
|
config = Configuration.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: librato-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Sanders
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
hvjx0WJP8pzZMJPKJBRZQXJO5ifEPyKjZyMi5XMHmrtDclHLj3sx4RAvEZjGWkRP
|
30
30
|
JSQ=
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2016-04-
|
32
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: librato-metrics
|
@@ -103,11 +103,9 @@ files:
|
|
103
103
|
- test/apps/basic.ru
|
104
104
|
- test/apps/custom.ru
|
105
105
|
- test/apps/custom_suites.ru
|
106
|
-
- test/apps/deprecated.ru
|
107
106
|
- test/apps/no_stats.ru
|
108
107
|
- test/apps/queue_wait.ru
|
109
108
|
- test/integration/custom_test.rb
|
110
|
-
- test/integration/deprecated_test.rb
|
111
109
|
- test/integration/no_stats_test.rb
|
112
110
|
- test/integration/no_suites_test.rb
|
113
111
|
- test/integration/queue_wait_test.rb
|
@@ -153,11 +151,9 @@ test_files:
|
|
153
151
|
- test/apps/basic.ru
|
154
152
|
- test/apps/custom.ru
|
155
153
|
- test/apps/custom_suites.ru
|
156
|
-
- test/apps/deprecated.ru
|
157
154
|
- test/apps/no_stats.ru
|
158
155
|
- test/apps/queue_wait.ru
|
159
156
|
- test/integration/custom_test.rb
|
160
|
-
- test/integration/deprecated_test.rb
|
161
157
|
- test/integration/no_stats_test.rb
|
162
158
|
- test/integration/no_suites_test.rb
|
163
159
|
- test/integration/queue_wait_test.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/test/apps/deprecated.ru
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'bundler/setup'
|
2
|
-
require 'librato-rack'
|
3
|
-
|
4
|
-
config = Librato::Rack::Configuration.new
|
5
|
-
config.prefix = 'deprecated'
|
6
|
-
|
7
|
-
# old-style single-argument assignment
|
8
|
-
use Librato::Rack, config
|
9
|
-
|
10
|
-
def application(env)
|
11
|
-
[200, {"Content-Type" => 'text/html'}, ["Hello!"]]
|
12
|
-
end
|
13
|
-
|
14
|
-
run method(:application)
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'rack/test'
|
3
|
-
|
4
|
-
# Tests for deprecated functionality
|
5
|
-
#
|
6
|
-
class DeprecatedTest < Minitest::Test
|
7
|
-
include Rack::Test::Methods
|
8
|
-
|
9
|
-
def app
|
10
|
-
Rack::Builder.parse_file('test/apps/deprecated.ru').first
|
11
|
-
end
|
12
|
-
|
13
|
-
def teardown
|
14
|
-
# clear metrics before each run
|
15
|
-
aggregate.delete_all
|
16
|
-
counters.delete_all
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_deprecated_config_form
|
20
|
-
get '/'
|
21
|
-
assert_equal 'deprecated', Librato.tracker.config.prefix
|
22
|
-
assert_equal 1, aggregate['deprecated.rack.request.time'][:count]
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def aggregate
|
28
|
-
Librato.tracker.collector.aggregate
|
29
|
-
end
|
30
|
-
|
31
|
-
def counters
|
32
|
-
Librato.tracker.collector.counters
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|