Skip to content

Commit

Permalink
DEV: Remove flawed collection of transient_readonly_mode global metric
Browse files Browse the repository at this point in the history
The metric should be a per-process metric. However, we don't seem to be
using this anywhere in our code base so there isn't a point in
collecting it.
  • Loading branch information
tgxworld committed Jun 9, 2020
1 parent e3cc5d8 commit 01cf1b3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
5 changes: 0 additions & 5 deletions lib/collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ def ensure_global_metrics
"Indicates whether site is in readonly mode due to PostgreSQL failover"
)

global_metrics << Gauge.new(
"transient_readonly_mode",
"Indicates whether site is in a transient readonly mode"
)

global_metrics << Gauge.new(
"redis_master_available",
"Whether or not we have an active connection to the master Redis",
Expand Down
15 changes: 0 additions & 15 deletions lib/internal_metric/global.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class Global < Base
STUCK_JOB_MINUTES = 120

attribute :postgres_readonly_mode,
:transient_readonly_mode,
:redis_master_available,
:redis_slave_available,
:postgres_master_available,
Expand Down Expand Up @@ -76,7 +75,6 @@ def collect
net_stats = Raindrops::Linux::tcp_listener_stats("0.0.0.0:3000")["0.0.0.0:3000"] unless RbConfig::CONFIG["arch"] =~ /darwin/

@postgres_readonly_mode = primary_site_readonly?
@transient_readonly_mode = recently_readonly?
@redis_master_available = redis_master_running
@redis_slave_available = redis_slave_running
@postgres_master_available = postgres_master_running
Expand Down Expand Up @@ -168,19 +166,6 @@ def test_redis(role, host, port, password)
test_connection&.close
end

def recently_readonly?
recently_readonly = 0

RailsMultisite::ConnectionManagement.with_connection('default') do
recently_readonly = 1 if Discourse.recently_readonly?
end

recently_readonly
rescue
# no db
0
end

def sidekiq_paused_states
paused = {}

Expand Down

0 comments on commit 01cf1b3

Please sign in to comment.