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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 925119ebbdc1da99d8586de3f7c98b0a02b637af
4
- data.tar.gz: 2c584413df2ea05a8fab05eb9e5c5116ffd15dbd
3
+ metadata.gz: c8c27777c779a649ab5b3d24d0f33d728b37f6b8
4
+ data.tar.gz: 643b0428ff24c735bba82293bd1d651dbfdbbd1b
5
5
  SHA512:
6
- metadata.gz: 8871cf91b56d26f7ed25d54fb6f0e93e3f8b9f012bc34b053bd4b7957601b7086c24c968e941b1791207413d4ff92f8f05684468234d5e9072ee3cdd2c72a5e6
7
- data.tar.gz: 95712a3eb73c604413ad33bc9a2f77cdb49de8e75ec58bfb80a5728d948dc38394362a23144b9e38f322485e0156dfefe738ebca7c9c6f625942a4394c4d0205
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
- old_style = false
68
- if options.respond_to?(:log_level) # old-style single argument
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'] || ENV['LIBRATO_METRICS_USER']
61
- self.token = ENV['LIBRATO_TOKEN'] || ENV['LIBRATO_METRICS_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'] || ENV['LIBRATO_METRICS_PREFIX']
64
- self.source = ENV['LIBRATO_SOURCE'] || ENV['LIBRATO_METRICS_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
- %w{USER TOKEN PREFIX SOURCE}.each do |item|
114
- if ENV["LIBRATO_METRICS_#{item}"]
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
 
@@ -1,5 +1,5 @@
1
1
  module Librato
2
2
  class Rack
3
- VERSION = "1.0.0.beta1"
3
+ VERSION = "1.0.0.beta2"
4
4
  end
5
5
  end
@@ -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.beta1
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-18 00:00:00.000000000 Z
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
@@ -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