govuk_app_config 9.0.4 → 9.2.0

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: 13c7b2080a8136a1799208e1bf685d420afbde632c35780c7b2cef063d7bad54
4
- data.tar.gz: 757a148a0d5db0867f8ca54033cb243837c5dadb9427c5047c24db4bcc96a897
3
+ metadata.gz: a879f92fed2a4b6f098a3a1bbd367853413b3314c4d45f3d38802897cc9ecc68
4
+ data.tar.gz: 2dcd94fb037f6799cf9ce5229cb3ba6b7e391063091c3f3a65e4085d5eab9195
5
5
  SHA512:
6
- metadata.gz: 7838253f4088c269f00f85ae005ee072ae3e08a935ba49f39e1dd0aa9b5c857de75472ebb73697b9ad49c31c61a62ad47556a3b75fe660edd2d818b0ad00cd65
7
- data.tar.gz: 102c41532cfa9d12140d54c5ed44b8bc06eb0e331524d032652c4f8b9d68fb5b1adcfb1044e197135ed4c7b9161903219719f767327719a09ed862a1de9dbca7
6
+ metadata.gz: cab7cd78d7ffd83c19e37ad9bcd7865b3c1d7731baf1dd607556d3a758e99288b56186786fa20789011fc84f340e83caa7df6c1d9324c63d934f9b15733e6003
7
+ data.tar.gz: c547b53fca4fa5ad8f9f4444451dd8facc04bfcbe2312dfe5f591ac6236c6df90f9c49c7d0c3ab2a2cdcd25336b50ab3b23711cf137804286040e1b39b383d0d
@@ -20,7 +20,7 @@ jobs:
20
20
  ruby: ['3.0', 3.1, 3.2]
21
21
  runs-on: ubuntu-latest
22
22
  steps:
23
- - uses: actions/checkout@v3
23
+ - uses: actions/checkout@v4
24
24
  with:
25
25
  ref: ${{ inputs.ref || github.ref }}
26
26
  - uses: ruby/setup-ruby@v1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 9.2.0
2
+
3
+ * Default to Prometheus histograms, not summaries ([#318](https://github.com/alphagov/govuk_app_config/pull/318))
4
+
5
+ # 9.1.0
6
+
7
+ * GovukAppConfig silences OpenTelemetry log output when running a rake task ([#311](https://github.com/alphagov/govuk_app_config/pull/311))
8
+ * Update warning message for Prometheus metric server address already in use.
9
+ * Add ability to support custom collectors in the Prometheus exporter.
10
+
1
11
  # 9.0.4
2
12
 
3
13
  * Fix an issue with Rails.logger being not an instance of ActiveSupport::Logger. Rails expects Rails.logger to have methods that Ruby STD Logger does not provide. e.g. `silence()` ([#309](https://github.com/alphagov/govuk_app_config/pull/309))
@@ -36,7 +46,7 @@
36
46
 
37
47
  # 8.0.1
38
48
 
39
- * Change the "source" field in Rails logs from logstasher from string representing IP host address to an empty object.
49
+ * Change the "source" field in Rails logs from logstasher from string representing IP host address to an empty object.
40
50
 
41
51
  # 8.0.0
42
52
 
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = %w[lib]
22
22
 
23
23
  spec.add_dependency "logstasher", "~> 2.1"
24
- spec.add_dependency "opentelemetry-exporter-otlp", "~> 0.25.0"
25
- spec.add_dependency "opentelemetry-instrumentation-all", "~> 0.39.1"
24
+ spec.add_dependency "opentelemetry-exporter-otlp", ">= 0.25", "< 0.27"
25
+ spec.add_dependency "opentelemetry-instrumentation-all", ">= 0.39.1", "< 0.41.0"
26
26
  spec.add_dependency "opentelemetry-sdk", "~> 1.2"
27
27
  spec.add_dependency "plek", ">= 4", "< 6"
28
28
  spec.add_dependency "prometheus_exporter", "~> 2.0"
@@ -39,6 +39,6 @@ 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.11.0"
42
+ spec.add_development_dependency "rubocop-govuk", "4.12.0"
43
43
  spec.add_development_dependency "webmock"
44
44
  end
@@ -13,6 +13,11 @@ module GovukOpenTelemetry
13
13
  OpenTelemetry::SDK.configure do |config|
14
14
  config.service_name = service_name
15
15
  config.use_all # enables all instrumentation!
16
+ config.logger = Logger.new(File::NULL) if in_rake_task?
16
17
  end
17
18
  end
19
+
20
+ def self.in_rake_task?
21
+ Rails.const_defined?(:Rake) && Rake.application.top_level_tasks.any?
22
+ end
18
23
  end
@@ -1,3 +1,8 @@
1
+ require "prometheus_exporter"
2
+ require "prometheus_exporter/metric"
3
+ require "prometheus_exporter/server"
4
+ require "prometheus_exporter/middleware"
5
+
1
6
  module GovukPrometheusExporter
2
7
  def self.should_configure
3
8
  # Allow us to force the Prometheus Exporter for persistent Rake tasks...
@@ -11,12 +16,14 @@ module GovukPrometheusExporter
11
16
  end
12
17
  end
13
18
 
14
- def self.configure
19
+ def self.configure(collectors: [], default_aggregation: PrometheusExporter::Metric::Histogram)
15
20
  return unless should_configure
16
21
 
17
- require "prometheus_exporter"
18
- require "prometheus_exporter/server"
19
- require "prometheus_exporter/middleware"
22
+ # PrometheusExporter::Metric::Histogram.DEFAULT_BUCKETS tops out at 10 but
23
+ # we have a few controller actions which are slower than this, so we add a
24
+ # few extra buckets for slower requests
25
+ PrometheusExporter::Metric::Histogram.default_buckets = [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 15, 25, 50].freeze
26
+ PrometheusExporter::Metric::Base.default_aggregation = default_aggregation
20
27
 
21
28
  if defined?(Sidekiq)
22
29
  Sidekiq.configure_server do |config|
@@ -37,6 +44,9 @@ module GovukPrometheusExporter
37
44
 
38
45
  begin
39
46
  server = PrometheusExporter::Server::WebServer.new bind: "0.0.0.0", port: 9394
47
+
48
+ collectors.each { |collector| server.collector.register_collector(collector.new) }
49
+
40
50
  server.start
41
51
 
42
52
  if defined?(Rails)
@@ -47,7 +57,7 @@ module GovukPrometheusExporter
47
57
  Sinatra.use PrometheusExporter::Middleware
48
58
  end
49
59
  rescue Errno::EADDRINUSE
50
- warn "Warning: Could not connect to Prometheus Server"
60
+ warn "Could not start Prometheus metrics server as address already in use."
51
61
  end
52
62
  end
53
63
  end
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "9.0.4".freeze
2
+ VERSION = "9.2.0".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.0.4
4
+ version: 9.2.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: 2023-07-17 00:00:00.000000000 Z
11
+ date: 2023-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstasher
@@ -28,30 +28,42 @@ dependencies:
28
28
  name: opentelemetry-exporter-otlp
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0.25'
34
+ - - "<"
32
35
  - !ruby/object:Gem::Version
33
- version: 0.25.0
36
+ version: '0.27'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0.25'
44
+ - - "<"
39
45
  - !ruby/object:Gem::Version
40
- version: 0.25.0
46
+ version: '0.27'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: opentelemetry-instrumentation-all
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - "~>"
51
+ - - ">="
46
52
  - !ruby/object:Gem::Version
47
53
  version: 0.39.1
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: 0.41.0
48
57
  type: :runtime
49
58
  prerelease: false
50
59
  version_requirements: !ruby/object:Gem::Requirement
51
60
  requirements:
52
- - - "~>"
61
+ - - ">="
53
62
  - !ruby/object:Gem::Version
54
63
  version: 0.39.1
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: 0.41.0
55
67
  - !ruby/object:Gem::Dependency
56
68
  name: opentelemetry-sdk
57
69
  requirement: !ruby/object:Gem::Requirement
@@ -280,14 +292,14 @@ dependencies:
280
292
  requirements:
281
293
  - - '='
282
294
  - !ruby/object:Gem::Version
283
- version: 4.11.0
295
+ version: 4.12.0
284
296
  type: :development
285
297
  prerelease: false
286
298
  version_requirements: !ruby/object:Gem::Requirement
287
299
  requirements:
288
300
  - - '='
289
301
  - !ruby/object:Gem::Version
290
- version: 4.11.0
302
+ version: 4.12.0
291
303
  - !ruby/object:Gem::Dependency
292
304
  name: webmock
293
305
  requirement: !ruby/object:Gem::Requirement
@@ -363,7 +375,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
363
375
  - !ruby/object:Gem::Version
364
376
  version: '0'
365
377
  requirements: []
366
- rubygems_version: 3.4.17
378
+ rubygems_version: 3.4.19
367
379
  signing_key:
368
380
  specification_version: 4
369
381
  summary: Base configuration for GOV.UK applications