govuk_app_config 9.11.0 → 9.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +3 -0
- data/.github/workflows/autorelease.yml +1 -1
- data/.github/workflows/ci.yml +0 -11
- data/CHANGELOG.md +8 -0
- data/govuk_app_config.gemspec +1 -1
- data/lib/govuk_app_config/govuk_json_logging/rails_ext/action_controller/metal/instrumentation.rb +65 -0
- data/lib/govuk_app_config/govuk_json_logging.rb +8 -0
- data/lib/govuk_app_config/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f502d5ff732d2ef2693fca10c8c4366180ca91a1e243aabc2e9c3a8c6081b7f
|
4
|
+
data.tar.gz: cab52af8090596b98a8ba84f90105a161c8f64d293c437030de7c1a964832ad9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a88e6b1158e9ece8c93469d5c8b1b6a8af894bc79096353ca6540c632d9459d3ea46718b8e1181a4ac75a1d5580ba54d786317fb17e71bdc282babda20ee78c2
|
7
|
+
data.tar.gz: bb215c586b2c3bde4119df0cca8845cdb6b06d6eeb266a9fcfd70f3fd263944f2aeaf718f3fbe8a50d93915e90b8e67b8818a6301da008bfbaa38dd5b8561d7f
|
@@ -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.
|
data/.github/workflows/ci.yml
CHANGED
@@ -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,11 @@
|
|
1
|
+
# 9.11.2
|
2
|
+
|
3
|
+
* Fix Logstasher monkey patch overriding patch from this library for OpenTelemetry errors ([#377](https://github.com/alphagov/govuk_app_config/pull/377))
|
4
|
+
|
5
|
+
# 9.11.1
|
6
|
+
|
7
|
+
* Fix OpenTelemetry errors when using with Logstasher gem ([#372](https://github.com/alphagov/govuk_app_config/pull/372))
|
8
|
+
|
1
9
|
# 9.11.0
|
2
10
|
|
3
11
|
* Add GDS::SSO::PermissionDeniedError to excluded exceptions list ([#366](https://github.com/alphagov/govuk_app_config/pull/366))
|
data/govuk_app_config.gemspec
CHANGED
@@ -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.
|
42
|
+
spec.add_development_dependency "rubocop-govuk", "4.18.0"
|
43
43
|
spec.add_development_dependency "simplecov"
|
44
44
|
spec.add_development_dependency "webmock"
|
45
45
|
end
|
data/lib/govuk_app_config/govuk_json_logging/rails_ext/action_controller/metal/instrumentation.rb
ADDED
@@ -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,14 @@ 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
|
+
# Prevent the old monkey patch being applied
|
24
|
+
config.controller_monkey_patch = false
|
25
|
+
end
|
26
|
+
|
19
27
|
configuration = Configuration.new
|
20
28
|
|
21
29
|
configuration.instance_eval(&block) if block_given?
|
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.
|
4
|
+
version: 9.11.2
|
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-
|
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.
|
295
|
+
version: 4.18.0
|
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.
|
302
|
+
version: 4.18.0
|
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.
|
396
|
+
rubygems_version: 3.5.11
|
395
397
|
signing_key:
|
396
398
|
specification_version: 4
|
397
399
|
summary: Base configuration for GOV.UK applications
|