Skip to content

Commit

Permalink
Merge pull request #224 from alphagov/fix-loading-govuk-prometheus-ex…
Browse files Browse the repository at this point in the history
…porter

Fix loading gem due missing PrometheusExporter constant
  • Loading branch information
theseanything authored Mar 4, 2022
2 parents 3b1b696 + 540fa01 commit 1208816
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# 4.4.1

- Fix issue where GovukPrometheusExporter module prevented the gem to load due to missing constant "PrometheusExporter" ([#224](https://github.com/alphagov/govuk_app_config/pull/224)).
- Lazy load the prometheus_exporter dependency for only apps that use GovukPrometheusExporter ([#224](https://github.com/alphagov/govuk_app_config/pull/224)).

# 4.4.0

- Add GovukPrometheusModule, to allow for export of prometheus metrics ([#223](https://github.com/alphagov/govuk_app_config/pull/223)).

# 4.3.0

- Remove Speedcurve's LUX from the connect-src policy ([#216](https://github.com/alphagov/govuk_app_config/pull/216)).
Expand Down
2 changes: 1 addition & 1 deletion lib/govuk_app_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# This require is deprecated and should be removed on next major version bump
# and should be required by applications directly.
require "govuk_app_config/govuk_unicorn"
require "govuk_app_config/govuk_prometheus_exporter"

if defined?(Rails)
require "govuk_app_config/govuk_prometheus_exporter"
require "govuk_app_config/govuk_logging"
require "govuk_app_config/govuk_content_security_policy"
require "govuk_app_config/railtie"
Expand Down
7 changes: 4 additions & 3 deletions lib/govuk_app_config/govuk_prometheus_exporter.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
require "prometheus_exporter/server"
require "prometheus_exporter/middleware"

module GovukPrometheusExporter
def self.configure
unless Rails.env == "test"
require "prometheus_exporter"
require "prometheus_exporter/server"
require "prometheus_exporter/middleware"

server = PrometheusExporter::Server::WebServer.new bind: "localhost", port: 9394
server.start

Expand Down
2 changes: 1 addition & 1 deletion lib/govuk_app_config/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module GovukAppConfig
VERSION = "4.4.0".freeze
VERSION = "4.4.1".freeze
end

0 comments on commit 1208816

Please sign in to comment.