govuk_app_config 1.8.0 → 1.9.0

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
  SHA256:
3
- metadata.gz: 3756aa3c504162388cd3edb39b03affb14615298d6ed92fe2080e4b77309722f
4
- data.tar.gz: 9d52a0f64638b08eb1f0707515e2c8fcb157576324bee1923bfe5c3eced0c694
3
+ metadata.gz: 0eb703d633019c261beacc5297b8620227a7c1e2948e469f88662ecab13fe440
4
+ data.tar.gz: 04a12ed7107d261d406897952c1fb66953497d52d2b3ee41658d75373f9961f9
5
5
  SHA512:
6
- metadata.gz: d805891e750f29125b84ad101bb7d1d26fdc5eaae602cd56d2f2001a613617f578c216b984bc4be9df2f4a99bcbd60d866ad7e82b4e026e37f5e42d49afdea08
7
- data.tar.gz: ff802243682c4934a2fe97fe37c1cb46a0c0abc5d8b4ae76d7b98e1a96e625b13c358b07a5508fcb9915c8fea73b81a9d8a1030b7872471bc9a0ae5be6ac75bb
6
+ metadata.gz: 11bcd19aa0c4de45d061f6a3ef084854a0e05c66cc609ae6e58a0b04fc5a125cb9df7979aa8e00c98e33ff08c7cc8055982c7c7c22f9aaf6740bdaad0bda8f0b
7
+ data.tar.gz: fe634e1aeb3efe7f75773ea9a5a081288b55fa4868359d51cd05e23c57f828d53f4c7469a933ff970093e7698baa47e6e483dbdb585f230200b7f15d32fcb939
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.9.0
2
+
3
+ * Record 1% of requests with AWS X-Ray.
4
+
1
5
  # 1.8.0
2
6
 
3
7
  * Handle a health check which raises an exception.
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
+ spec.add_dependency "aws-xray-sdk", "~> 0.10.0"
24
25
  spec.add_dependency "statsd-ruby", "~> 1.4.0"
25
26
  spec.add_dependency "logstasher", "~> 1.2.2"
26
27
  spec.add_dependency "sentry-raven", "~> 2.7.1"
@@ -0,0 +1,28 @@
1
+ require 'aws-xray-sdk/facets/rack'
2
+ require 'aws-xray-sdk/facets/rails/ex_middleware'
3
+
4
+ module GovukXRay
5
+ def self.initialize(app)
6
+ app.middleware.insert 0, XRay::Rack::Middleware
7
+ app.middleware.use XRay::Rails::ExceptionMiddleware
8
+ end
9
+
10
+ def self.start
11
+ # if aws-sdk is loaded, we want to instrument that too
12
+ patch = Gem.loaded_specs.has_key?('aws-sdk-core') ?
13
+ %I[aws_sdk net_http] : %I[net_http]
14
+
15
+ XRay.recorder.configure(
16
+ name: ENV['GOVUK_APP_NAME'].to_s,
17
+ patch: patch,
18
+ sampling_rules: {
19
+ version: 1,
20
+ default: {
21
+ 'fixed_target': ENV.fetch('XRAY_SAMPLE_TARGET', 0).to_i,
22
+ 'rate': ENV.fetch('XRAY_SAMPLE_RATE', 0.01).to_f,
23
+ },
24
+ rules: [],
25
+ },
26
+ )
27
+ end
28
+ end
@@ -1,7 +1,16 @@
1
1
  module GovukAppConfig
2
2
  class Railtie < Rails::Railtie
3
+
4
+ initializer('govuk_app_config') do |app|
5
+ GovukXRay.initialize(app) if Rails.env.production?
6
+ end
7
+
3
8
  config.before_initialize do
4
9
  GovukLogging.configure if Rails.env.production?
5
10
  end
11
+
12
+ config.after_initialize do
13
+ GovukXRay.start if Rails.env.production?
14
+ end
6
15
  end
7
16
  end
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "1.8.0"
2
+ VERSION = "1.9.0"
3
3
  end
@@ -6,5 +6,6 @@ require "govuk_app_config/govuk_healthcheck"
6
6
  # This require is deprecated and should be removed on next major version bump
7
7
  # and should be required by applications directly.
8
8
  require "govuk_app_config/govuk_unicorn"
9
+ require "govuk_app_config/govuk_xray"
9
10
  require "govuk_app_config/configure"
10
11
  require "govuk_app_config/railtie" if defined?(Rails)
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_app_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-06 00:00:00.000000000 Z
11
+ date: 2018-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-xray-sdk
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.10.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.10.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: statsd-ruby
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -199,6 +213,7 @@ files:
199
213
  - lib/govuk_app_config/govuk_logging.rb
200
214
  - lib/govuk_app_config/govuk_statsd.rb
201
215
  - lib/govuk_app_config/govuk_unicorn.rb
216
+ - lib/govuk_app_config/govuk_xray.rb
202
217
  - lib/govuk_app_config/railtie.rb
203
218
  - lib/govuk_app_config/version.rb
204
219
  homepage: https://github.com/alphagov/govuk_app_config