Skip to content
Permalink
Browse files

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:
discourse/prometheus_exporter@f83b4f4
  • Loading branch information
SamSaffron committed Feb 14, 2020
1 parent e2b144e commit f11f93720860e8c6c090d5236b8bb6e0135a21d2
Showing with 3 additions and 12 deletions.
  1. +2 −11 lib/internal_metric/global.rb
  2. +1 −1 prometheus_exporter_version
@@ -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
@@ -1 +1 @@
0.4.16
0.5.0

0 comments on commit f11f937

Please sign in to comment.
You can’t perform that action at this time.