From f11f93720860e8c6c090d5236b8bb6e0135a21d2 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Fri, 14 Feb 2020 18:12:14 +1100 Subject: [PATCH] DEV: bump prometheus exporter version New version binds to localhost by default which is less exposed. Additionally it adds a hostname helper If we have trouble with binding to v6 we can adjust per: https://github.com/discourse/prometheus_exporter/commit/f83b4f4fb6e9285e3d8c8e7a1e96f6f3fcbba475 --- lib/internal_metric/global.rb | 13 ++----------- prometheus_exporter_version | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/internal_metric/global.rb b/lib/internal_metric/global.rb index 034f1c6..0d6cf63 100644 --- a/lib/internal_metric/global.rb +++ b/lib/internal_metric/global.rb @@ -6,15 +6,6 @@ module DiscoursePrometheus::InternalMetric class Global < Base - def self.hostname - @hostname ||= - begin - Discourse::Utils.execute_command("hostname").strip - rescue - "Unknown" - end - end - STUCK_JOB_MINUTES = 60 attribute :postgres_readonly_mode, @@ -82,7 +73,7 @@ def collect @sidekiq_processes = 0 @sidekiq_workers = Sidekiq::ProcessSet.new.sum do |process| - if process["hostname"] == Global.hostname + if process["hostname"] == ::DiscoursePrometheus.hostname @sidekiq_processes += 1 process["concurrency"] else @@ -91,7 +82,7 @@ def collect end @sidekiq_stuck_workers = Sidekiq::Workers.new.filter do |queue, _, w| - queue.start_with?(Global.hostname) && Time.at(w["run_at"]) < (Time.now - 60 * STUCK_JOB_MINUTES) + queue.start_with?(::DiscoursePrometheus.hostname) && Time.at(w["run_at"]) < (Time.now - 60 * STUCK_JOB_MINUTES) end.count @sidekiq_paused = sidekiq_paused_states diff --git a/prometheus_exporter_version b/prometheus_exporter_version index 5745cc7..8f0916f 100644 --- a/prometheus_exporter_version +++ b/prometheus_exporter_version @@ -1 +1 @@ -0.4.16 +0.5.0