diff --git a/CHANGELOG.md b/CHANGELOG.md index 70f97a70..843c3009 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +- Fix prometheus_exporter to only be enabled when the GOVUK_PROMETHEUS_EXPORTER env var is set to "true" ([#231](https://github.com/alphagov/govuk_app_config/pull/231)). +- Add Prometheus monitoring for EKS section to README.md ([#231](https://github.com/alphagov/govuk_app_config/pull/231)). - Fix govuk_error being incompatible with Ruby >= 3 ([#233](https://github.com/alphagov/govuk_app_config/pull/233)) - Require Ruby 2.7 as the minimum supported Ruby version ([#233](https://github.com/alphagov/govuk_app_config/pull/233)) - Require Sentry 5 and Unicorn 6 major versions ([#237](https://github.com/alphagov/govuk_app_config/pull/237)) diff --git a/README.md b/README.md index 408ad794..0a5c84c7 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ Adds the basics of a GOV.UK application: - Statsd client for reporting stats - Rails logging - Content Security Policy generation for frontend apps +- Prometheus monitoring for EKS ## Installation @@ -166,6 +167,15 @@ GovukContentSecurityPolicy.configure Some frontend apps support languages that are not defined in the i18n gem. This provides them with our own custom rules for these languages. +## Prometheus monitoring for EKS + +Create a `/config/initializers/prometheus.rb` file in the app and add the following + +```ruby +require "govuk_app_config/govuk_prometheus_exporter" +GovukPrometheusExporter.configure +``` + ## License [MIT License](LICENSE.md) diff --git a/lib/govuk_app_config/govuk_prometheus_exporter.rb b/lib/govuk_app_config/govuk_prometheus_exporter.rb index 2d570774..d036d964 100644 --- a/lib/govuk_app_config/govuk_prometheus_exporter.rb +++ b/lib/govuk_app_config/govuk_prometheus_exporter.rb @@ -1,6 +1,6 @@ module GovukPrometheusExporter def self.configure - unless Rails.env == "test" + unless Rails.env == "test" || (ENV["GOVUK_PROMETHEUS_EXPORTER"]) != "true" require "prometheus_exporter" require "prometheus_exporter/server" require "prometheus_exporter/middleware"