Skip to content

Commit

Permalink
Allow us to force-load the Prometheus Exporter...
Browse files Browse the repository at this point in the history
The Exporter currently ignores the `GOVUK_PROMETHEUS_EXPORTER`
 environment variable if it detects it is being called by rake.

As the email-alerts-service is a perpetual rake task, we need a
 way to override this for the time being.
  • Loading branch information
dj-maisy committed Feb 20, 2023
1 parent 94d3b94 commit 14c9457
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/govuk_app_config/govuk_prometheus_exporter.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module GovukPrometheusExporter
def self.should_configure
if File.basename($PROGRAM_NAME) == "rake" ||
# Allow us to force the Prometheus Exporter for persistent Rake tasks...
if ENV["GOVUK_PROMETHEUS_EXPORTER"] == "force"
true
elsif File.basename($PROGRAM_NAME) == "rake" ||
defined?(Rails) && (Rails.const_defined?("Console") || Rails.env == "test")
false
else
Expand Down

0 comments on commit 14c9457

Please sign in to comment.