govuk_app_config 9.11.0 → 9.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2b999667300e1c7039636683bbec26d0876bba98d909766de7f2a900cbe8fec
4
- data.tar.gz: 9f256df66ab205142cf4e53d0fe868bb57d9f17e2465906f10f5be6fc8abdf1e
3
+ metadata.gz: 2e328b8f14abd03a18e3f68c5334eca8681fd149b6572bbc30bd2336f32fa4a8
4
+ data.tar.gz: f31ef5725579cb25b04fcc0ddfb75a00e1efedb7e6f6ca838182edea6fdfd0ff
5
5
  SHA512:
6
- metadata.gz: e12b4f83286dde0a7be9a252e85f0ec6284e86396b7a8f2888c0c34591c41e5acf9c6b685d0c04310d44e8c990b103a2581905c11280beda39863c8ee601b7ae
7
- data.tar.gz: 754946671f494b0be22851f8c7b0926fd79a7bbce1a39a7cb5adf8a1ffff12ba2a27ca3997bf32945b8f7b8e9ee7fbe27de5939b9f37e0887e830aac95c7b83e
6
+ metadata.gz: 6387c742d5b1e535e8e26b7e60f5161377e410c9a1a974aae32572546746f9e6bed7cbbf09ed2501492106d3db82bf57293f661c116d748e79e5d973f2242ca9
7
+ data.tar.gz: 8b5283cc08344c0975d0cdd5904f380bfd937e87f41f4f89e10c296b4f3eb906d76625160130aea6ad77f399f4e2b0e129e648dd6df1bfb278ddea65ad821704
@@ -0,0 +1,3 @@
1
+ ⚠️ Make sure you [release a new version of this gem](https://github.com/alphagov/govuk_app_config/pull/356/files) after merging your changes. ⚠️
2
+
3
+ Refer to the [existing docs](https://docs.publishing.service.gov.uk/manual/publishing-a-ruby-gem.html#ruby-version-compatibility) if you are making changes to the supported Ruby versions.
@@ -1,7 +1,7 @@
1
1
  on:
2
2
  workflow_dispatch: {}
3
3
  schedule:
4
- - cron: '00 13 * * 2'
4
+ - cron: '30 10 * * 1-5' # 10:30am UTC, Mon-Fri.
5
5
 
6
6
  jobs:
7
7
  autorelease:
@@ -11,17 +11,6 @@ on:
11
11
  type: string
12
12
 
13
13
  jobs:
14
- snyk-security:
15
- name: SNYK security analysis
16
- uses: alphagov/govuk-infrastructure/.github/workflows/snyk-security.yml@main
17
- with:
18
- skip_sca: true
19
- secrets: inherit
20
- permissions:
21
- contents: read
22
- security-events: write
23
- actions: read
24
-
25
14
  codeql-sast:
26
15
  name: CodeQL SAST scan
27
16
  uses: alphagov/govuk-infrastructure/.github/workflows/codeql-analysis.yml@main
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 9.11.1
2
+
3
+ * Fix OpenTelemetry errors when using with Logstasher gem ([#372](https://github.com/alphagov/govuk_app_config/pull/372))
4
+
1
5
  # 9.11.0
2
6
 
3
7
  * Add GDS::SSO::PermissionDeniedError to excluded exceptions list ([#366](https://github.com/alphagov/govuk_app_config/pull/366))
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "rake", "~> 13.0"
40
40
  spec.add_development_dependency "rspec", "~> 3.10"
41
41
  spec.add_development_dependency "rspec-its", "~> 1.3"
42
- spec.add_development_dependency "rubocop-govuk", "4.16.1"
42
+ spec.add_development_dependency "rubocop-govuk", "4.17.1"
43
43
  spec.add_development_dependency "simplecov"
44
44
  spec.add_development_dependency "webmock"
45
45
  end
@@ -0,0 +1,65 @@
1
+ # This is copied from
2
+ # https://github.com/shadabahmed/logstasher/blob/main/lib/logstasher/rails_ext/action_controller/metal/instrumentation.rb
3
+ # Changes have been highlight in comments, otherwise the code is the same.
4
+
5
+ module ActionController
6
+ module Instrumentation
7
+ alias_method "orig_process_action", "process_action"
8
+
9
+ def process_action(*args)
10
+ # The raw payload has been updated to reflect the payload structure used
11
+ # in Rails 7.1, primarily the addition of the `headers`, `request` keys
12
+ # and using `request.filtered_path` instead of `request.fullpath`.
13
+ # https://github.com/rails/rails/blame/d39db5d1891f7509cde2efc425c9d69bbb77e670/actionpack/lib/action_controller/metal/instrumentation.rb#L60
14
+ raw_payload = {
15
+ controller: self.class.name,
16
+ action: action_name,
17
+ request:,
18
+ params: request.filtered_parameters,
19
+ headers: request.headers,
20
+ format: request.format.ref,
21
+ method: request.request_method,
22
+ path: begin
23
+ request.filtered_path
24
+ rescue StandardError
25
+ "unknown"
26
+ end,
27
+ }
28
+
29
+ LogStasher.add_default_fields_to_payload(raw_payload, request)
30
+
31
+ LogStasher.clear_request_context
32
+ LogStasher.add_default_fields_to_request_context(request)
33
+
34
+ ActiveSupport::Notifications.instrument("start_processing.action_controller", raw_payload.dup)
35
+
36
+ ActiveSupport::Notifications.instrument("process_action.action_controller", raw_payload) do |payload|
37
+ if respond_to?(:logstasher_add_custom_fields_to_request_context)
38
+ logstasher_add_custom_fields_to_request_context(LogStasher.request_context)
39
+ end
40
+
41
+ if respond_to?(:logstasher_add_custom_fields_to_payload)
42
+ before_keys = raw_payload.keys.clone
43
+ logstasher_add_custom_fields_to_payload(raw_payload)
44
+ after_keys = raw_payload.keys
45
+ # Store all extra keys added to payload hash in payload itself. This is a thread safe way
46
+ LogStasher::CustomFields.add(*(after_keys - before_keys))
47
+ end
48
+
49
+ result = super
50
+
51
+ payload[:status] = response.status
52
+ append_info_to_payload(payload)
53
+ LogStasher.store.each do |key, value|
54
+ payload[key] = value
55
+ end
56
+
57
+ LogStasher.request_context.each do |key, value|
58
+ payload[key] = value
59
+ end
60
+ result
61
+ end
62
+ end
63
+ alias_method "logstasher_process_action", "process_action"
64
+ end
65
+ end
@@ -16,6 +16,12 @@ module GovukJsonLogging
16
16
  end
17
17
 
18
18
  def self.configure(&block)
19
+ # Fixes the monkey patch from the logstasher gem to support Rails 7
20
+ config = Rails.application.config.logstasher
21
+ if (!config.controller_monkey_patch && config.controller_monkey_patch != false) || config.controller_monkey_patch == true
22
+ require_relative "./govuk_json_logging/rails_ext/action_controller/metal/instrumentation"
23
+ end
24
+
19
25
  configuration = Configuration.new
20
26
 
21
27
  configuration.instance_eval(&block) if block_given?
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "9.11.0".freeze
2
+ VERSION = "9.11.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_app_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.11.0
4
+ version: 9.11.1
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: 2024-04-25 00:00:00.000000000 Z
11
+ date: 2024-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstasher
@@ -292,14 +292,14 @@ dependencies:
292
292
  requirements:
293
293
  - - '='
294
294
  - !ruby/object:Gem::Version
295
- version: 4.16.1
295
+ version: 4.17.1
296
296
  type: :development
297
297
  prerelease: false
298
298
  version_requirements: !ruby/object:Gem::Requirement
299
299
  requirements:
300
300
  - - '='
301
301
  - !ruby/object:Gem::Version
302
- version: 4.16.1
302
+ version: 4.17.1
303
303
  - !ruby/object:Gem::Dependency
304
304
  name: simplecov
305
305
  requirement: !ruby/object:Gem::Requirement
@@ -336,6 +336,7 @@ extensions: []
336
336
  extra_rdoc_files: []
337
337
  files:
338
338
  - ".github/dependabot.yml"
339
+ - ".github/pull_request_template.md"
339
340
  - ".github/workflows/autorelease.yml"
340
341
  - ".github/workflows/ci.yml"
341
342
  - ".gitignore"
@@ -365,6 +366,7 @@ files:
365
366
  - lib/govuk_app_config/govuk_healthcheck/redis.rb
366
367
  - lib/govuk_app_config/govuk_healthcheck/sidekiq_redis.rb
367
368
  - lib/govuk_app_config/govuk_json_logging.rb
369
+ - lib/govuk_app_config/govuk_json_logging/rails_ext/action_controller/metal/instrumentation.rb
368
370
  - lib/govuk_app_config/govuk_open_telemetry.rb
369
371
  - lib/govuk_app_config/govuk_prometheus_exporter.rb
370
372
  - lib/govuk_app_config/govuk_proxy/static_proxy.rb
@@ -391,7 +393,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
391
393
  - !ruby/object:Gem::Version
392
394
  version: '0'
393
395
  requirements: []
394
- rubygems_version: 3.5.9
396
+ rubygems_version: 3.5.11
395
397
  signing_key:
396
398
  specification_version: 4
397
399
  summary: Base configuration for GOV.UK applications