govuk_app_config 9.10.0 → 9.11.1
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/.gitignore +2 -0
- data/.govuk_dependabot_merger.yml +4 -10
- data/CHANGELOG.md +8 -0
- data/govuk_app_config.gemspec +2 -1
- data/lib/govuk_app_config/govuk_error/configuration.rb +1 -0
- 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 +6 -0
- data/lib/govuk_app_config/version.rb +1 -1
- metadata +21 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e328b8f14abd03a18e3f68c5334eca8681fd149b6572bbc30bd2336f32fa4a8
|
4
|
+
data.tar.gz: f31ef5725579cb25b04fcc0ddfb75a00e1efedb7e6f6ca838182edea6fdfd0ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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/.gitignore
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
api_version:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
- patch
|
6
|
-
- minor
|
7
|
-
- dependency: plek
|
8
|
-
allowed_semver_bumps:
|
9
|
-
- patch
|
10
|
-
- minor
|
1
|
+
api_version: 2
|
2
|
+
defaults:
|
3
|
+
auto_merge: true
|
4
|
+
update_external_dependencies: true
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
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
|
+
|
5
|
+
# 9.11.0
|
6
|
+
|
7
|
+
* Add GDS::SSO::PermissionDeniedError to excluded exceptions list ([#366](https://github.com/alphagov/govuk_app_config/pull/366))
|
8
|
+
|
1
9
|
# 9.10.0
|
2
10
|
|
3
11
|
* Simplify the logic for deciding whether to initialize `GovukPrometheusExporter`. `GovukPrometheusExporter` provides the `/metrics` webserver and "exporter" process for aggregating counters in multi-process apps. govuk_app_config will now always attempt to initialize GovukPrometheusExporter except when running under `rails console`. The `GOVUK_PROMETHEUS_EXPORTER` environment variable no longer has any effect.
|
data/govuk_app_config.gemspec
CHANGED
@@ -39,6 +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.17.1"
|
43
|
+
spec.add_development_dependency "simplecov"
|
43
44
|
spec.add_development_dependency "webmock"
|
44
45
|
end
|
@@ -40,6 +40,7 @@ module GovukError
|
|
40
40
|
"CGI::Session::CookieStore::TamperedWithCookie",
|
41
41
|
"GdsApi::HTTPIntermittentServerError",
|
42
42
|
"GdsApi::TimedOutException",
|
43
|
+
"GDS::SSO::PermissionDeniedError",
|
43
44
|
"Mongoid::Errors::DocumentNotFound",
|
44
45
|
"Puma::HttpParserError",
|
45
46
|
"Sinatra::NotFound",
|
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,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?
|
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.
|
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-
|
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,28 @@ dependencies:
|
|
292
292
|
requirements:
|
293
293
|
- - '='
|
294
294
|
- !ruby/object:Gem::Version
|
295
|
-
version: 4.
|
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.
|
302
|
+
version: 4.17.1
|
303
|
+
- !ruby/object:Gem::Dependency
|
304
|
+
name: simplecov
|
305
|
+
requirement: !ruby/object:Gem::Requirement
|
306
|
+
requirements:
|
307
|
+
- - ">="
|
308
|
+
- !ruby/object:Gem::Version
|
309
|
+
version: '0'
|
310
|
+
type: :development
|
311
|
+
prerelease: false
|
312
|
+
version_requirements: !ruby/object:Gem::Requirement
|
313
|
+
requirements:
|
314
|
+
- - ">="
|
315
|
+
- !ruby/object:Gem::Version
|
316
|
+
version: '0'
|
303
317
|
- !ruby/object:Gem::Dependency
|
304
318
|
name: webmock
|
305
319
|
requirement: !ruby/object:Gem::Requirement
|
@@ -322,6 +336,7 @@ extensions: []
|
|
322
336
|
extra_rdoc_files: []
|
323
337
|
files:
|
324
338
|
- ".github/dependabot.yml"
|
339
|
+
- ".github/pull_request_template.md"
|
325
340
|
- ".github/workflows/autorelease.yml"
|
326
341
|
- ".github/workflows/ci.yml"
|
327
342
|
- ".gitignore"
|
@@ -351,6 +366,7 @@ files:
|
|
351
366
|
- lib/govuk_app_config/govuk_healthcheck/redis.rb
|
352
367
|
- lib/govuk_app_config/govuk_healthcheck/sidekiq_redis.rb
|
353
368
|
- lib/govuk_app_config/govuk_json_logging.rb
|
369
|
+
- lib/govuk_app_config/govuk_json_logging/rails_ext/action_controller/metal/instrumentation.rb
|
354
370
|
- lib/govuk_app_config/govuk_open_telemetry.rb
|
355
371
|
- lib/govuk_app_config/govuk_prometheus_exporter.rb
|
356
372
|
- lib/govuk_app_config/govuk_proxy/static_proxy.rb
|
@@ -377,7 +393,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
377
393
|
- !ruby/object:Gem::Version
|
378
394
|
version: '0'
|
379
395
|
requirements: []
|
380
|
-
rubygems_version: 3.5.
|
396
|
+
rubygems_version: 3.5.11
|
381
397
|
signing_key:
|
382
398
|
specification_version: 4
|
383
399
|
summary: Base configuration for GOV.UK applications
|