Skip to content

Commit

Permalink
Merge pull request #316 from alphagov/add-custom-collectors
Browse files Browse the repository at this point in the history
Add ability to specify custom collectors
  • Loading branch information
theseanything authored Sep 8, 2023
2 parents 447f9c7 + 74759c6 commit 6a68034
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* GovukAppConfig silences OpenTelemetry log output when running a rake task ([#311](https://github.com/alphagov/govuk_app_config/pull/311))
* Update warning message for Prometheus metric server address already in use.
* Add ability to support custom collectors in the Prometheus exporter.

# 9.0.4

Expand Down
5 changes: 4 additions & 1 deletion lib/govuk_app_config/govuk_prometheus_exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def self.should_configure
end
end

def self.configure
def self.configure(collectors: [])
return unless should_configure

require "prometheus_exporter"
Expand All @@ -37,6 +37,9 @@ def self.configure

begin
server = PrometheusExporter::Server::WebServer.new bind: "0.0.0.0", port: 9394

collectors.each { |collector| server.collector.register_collector(collector.new) }

server.start

if defined?(Rails)
Expand Down

0 comments on commit 6a68034

Please sign in to comment.