govuk_app_config 9.2.0 → 9.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/govuk_app_config.gemspec +1 -1
- data/lib/govuk_app_config/govuk_prometheus_exporter.rb +39 -2
- data/lib/govuk_app_config/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91aa874fe05081ba23cdf6d37cb9046b357fe1d20d79ec3c336877a3e75e2edc
|
4
|
+
data.tar.gz: eff73c0ebf947cd2adb0c8bd37599c5bae85497db9c3942621b2178465c586de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcf73e2e1bcf53b466918e89fd23b2083e02dc7d9e8dd4333021db40f46a3d9774d52079c443d204bc00b0d09547e5be83c0f824611f532fc90a786f07cfe8f4
|
7
|
+
data.tar.gz: b0ffcd15e23557623c9749eb925ec52ffa867558769da1cb13cd9d52e275e1201576c5c1d040ce9d90b80af5a7848452bd43ffe8d59d328bfdbed4029781f4b4
|
data/CHANGELOG.md
CHANGED
data/govuk_app_config.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_dependency "logstasher", "~> 2.1"
|
24
24
|
spec.add_dependency "opentelemetry-exporter-otlp", ">= 0.25", "< 0.27"
|
25
|
-
spec.add_dependency "opentelemetry-instrumentation-all", ">= 0.39.1", "< 0.
|
25
|
+
spec.add_dependency "opentelemetry-instrumentation-all", ">= 0.39.1", "< 0.51.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"
|
@@ -4,6 +4,43 @@ require "prometheus_exporter/server"
|
|
4
4
|
require "prometheus_exporter/middleware"
|
5
5
|
|
6
6
|
module GovukPrometheusExporter
|
7
|
+
#
|
8
|
+
# See https://github.com/discourse/prometheus_exporter/pull/293
|
9
|
+
#
|
10
|
+
# RailsMiddleware can be removed and replaced with the default middleware if
|
11
|
+
# that PR is merged / released
|
12
|
+
#
|
13
|
+
class RailsMiddleware < PrometheusExporter::Middleware
|
14
|
+
def default_labels(env, _result)
|
15
|
+
controller_instance = env["action_controller.instance"]
|
16
|
+
action = controller = nil
|
17
|
+
if controller_instance
|
18
|
+
action = controller_instance.action_name
|
19
|
+
controller = controller_instance.controller_name
|
20
|
+
elsif (cors = env["rack.cors"]) && cors.respond_to?(:preflight?) && cors.preflight?
|
21
|
+
# if the Rack CORS Middleware identifies the request as a preflight request,
|
22
|
+
# the stack doesn't get to the point where controllers/actions are defined
|
23
|
+
action = "preflight"
|
24
|
+
controller = "preflight"
|
25
|
+
end
|
26
|
+
{
|
27
|
+
action: action || "other",
|
28
|
+
controller: controller || "other",
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class SinatraMiddleware < PrometheusExporter::Middleware
|
34
|
+
def default_labels(_env, _result)
|
35
|
+
# The default prometheus exporter middleware uses the controller and
|
36
|
+
# action as labels. These aren't meaningful in Sinatra applications, and
|
37
|
+
# other options (such as request.path_info) have potentially very high
|
38
|
+
# cardinality. For now, just accept that we can't be more specific than
|
39
|
+
# the application / pod and don't provide any other labels
|
40
|
+
{}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
7
44
|
def self.should_configure
|
8
45
|
# Allow us to force the Prometheus Exporter for persistent Rake tasks...
|
9
46
|
if ENV["GOVUK_PROMETHEUS_EXPORTER"] == "force"
|
@@ -50,11 +87,11 @@ module GovukPrometheusExporter
|
|
50
87
|
server.start
|
51
88
|
|
52
89
|
if defined?(Rails)
|
53
|
-
Rails.application.middleware.unshift
|
90
|
+
Rails.application.middleware.unshift RailsMiddleware, instrument: :prepend
|
54
91
|
end
|
55
92
|
|
56
93
|
if defined?(Sinatra)
|
57
|
-
Sinatra.use
|
94
|
+
Sinatra.use SinatraMiddleware
|
58
95
|
end
|
59
96
|
rescue Errno::EADDRINUSE
|
60
97
|
warn "Could not start Prometheus metrics server as address already in use."
|
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.3.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-
|
11
|
+
date: 2023-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstasher
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
version: 0.39.1
|
54
54
|
- - "<"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
56
|
+
version: 0.51.0
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -63,7 +63,7 @@ dependencies:
|
|
63
63
|
version: 0.39.1
|
64
64
|
- - "<"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: 0.
|
66
|
+
version: 0.51.0
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: opentelemetry-sdk
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -375,7 +375,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
375
375
|
- !ruby/object:Gem::Version
|
376
376
|
version: '0'
|
377
377
|
requirements: []
|
378
|
-
rubygems_version: 3.4.
|
378
|
+
rubygems_version: 3.4.20
|
379
379
|
signing_key:
|
380
380
|
specification_version: 4
|
381
381
|
summary: Base configuration for GOV.UK applications
|