Commit 03c8bcc9 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '350546-remove-web-exporter-healthchecks' into 'master'

Drop health checks from WebExporter

See merge request gitlab-org/gitlab!78482
parents 35b3e905 6e485446
...@@ -95,13 +95,6 @@ if Gitlab::Runtime.web_server? ...@@ -95,13 +95,6 @@ if Gitlab::Runtime.web_server?
Gitlab::Metrics::Exporter::WebExporter.instance.start Gitlab::Metrics::Exporter::WebExporter.instance.start
end end
# DEPRECATED: TO BE REMOVED
# This is needed to implement blackout period of `web_exporter`
# https://gitlab.com/gitlab-org/gitlab/issues/35343#note_238479057
Gitlab::Cluster::LifecycleEvents.on_before_blackout_period do
Gitlab::Metrics::Exporter::WebExporter.instance.mark_as_not_running!
end
Gitlab::Cluster::LifecycleEvents.on_before_graceful_shutdown do Gitlab::Cluster::LifecycleEvents.on_before_graceful_shutdown do
# We need to ensure that before we re-exec or shutdown server # We need to ensure that before we re-exec or shutdown server
# we do stop the exporter # we do stop the exporter
......
...@@ -9,8 +9,6 @@ module Gitlab ...@@ -9,8 +9,6 @@ module Gitlab
class BaseExporter < Daemon class BaseExporter < Daemon
attr_reader :server attr_reader :server
attr_accessor :readiness_checks
def initialize(settings, log_enabled:, log_file:, gc_requests: false, **options) def initialize(settings, log_enabled:, log_file:, gc_requests: false, **options)
super(**options) super(**options)
...@@ -85,7 +83,7 @@ module Gitlab ...@@ -85,7 +83,7 @@ module Gitlab
end end
def readiness_probe def readiness_probe
::Gitlab::HealthChecks::Probes::Collection.new(*readiness_checks) ::Gitlab::HealthChecks::Probes::Collection.new
end end
def liveness_probe def liveness_probe
......
...@@ -4,17 +4,6 @@ module Gitlab ...@@ -4,17 +4,6 @@ module Gitlab
module Metrics module Metrics
module Exporter module Exporter
class WebExporter < BaseExporter class WebExporter < BaseExporter
ExporterCheck = Struct.new(:exporter) do
def readiness
Gitlab::HealthChecks::Result.new(
'web_exporter', exporter.running)
end
def available?
true
end
end
RailsMetricsInitializer = Struct.new(:app) do RailsMetricsInitializer = Struct.new(:app) do
def call(env) def call(env)
Gitlab::Metrics::RailsSlis.initialize_request_slis_if_needed! Gitlab::Metrics::RailsSlis.initialize_request_slis_if_needed!
...@@ -23,24 +12,9 @@ module Gitlab ...@@ -23,24 +12,9 @@ module Gitlab
end end
end end
attr_reader :running
# This exporter is always run on master process # This exporter is always run on master process
def initialize(**options) def initialize(**options)
super(Settings.monitoring.web_exporter, log_enabled: true, log_file: 'web_exporter.log', **options) super(Settings.monitoring.web_exporter, log_enabled: true, log_file: 'web_exporter.log', **options)
# DEPRECATED:
# these `readiness_checks` are deprecated
# as presenting no value in a way how we run
# application: https://gitlab.com/gitlab-org/gitlab/issues/35343
self.readiness_checks = [
WebExporter::ExporterCheck.new(self),
Gitlab::HealthChecks::PumaCheck
]
end
def mark_as_not_running!
@running = false
end end
private private
...@@ -53,16 +27,6 @@ module Gitlab ...@@ -53,16 +27,6 @@ module Gitlab
run app run app
end end
end end
def start_working
@running = true
super
end
def stop_working
mark_as_not_running!
super
end
end end
end end
end end
......
...@@ -4,7 +4,6 @@ require 'spec_helper' ...@@ -4,7 +4,6 @@ require 'spec_helper'
RSpec.describe Gitlab::Metrics::Exporter::WebExporter do RSpec.describe Gitlab::Metrics::Exporter::WebExporter do
let(:exporter) { described_class.new } let(:exporter) { described_class.new }
let(:readiness_probe) { exporter.send(:readiness_probe).execute }
before do before do
stub_config( stub_config(
...@@ -25,12 +24,6 @@ RSpec.describe Gitlab::Metrics::Exporter::WebExporter do ...@@ -25,12 +24,6 @@ RSpec.describe Gitlab::Metrics::Exporter::WebExporter do
end end
context 'when running server', :prometheus do context 'when running server', :prometheus do
it 'readiness probe returns succesful status' do
expect(readiness_probe.http_status).to eq(200)
expect(readiness_probe.json).to include(status: 'ok')
expect(readiness_probe.json).to include('web_exporter' => [{ 'status': 'ok' }])
end
it 'initializes request metrics' do it 'initializes request metrics' do
expect(Gitlab::Metrics::RailsSlis).to receive(:initialize_request_slis_if_needed!).and_call_original expect(Gitlab::Metrics::RailsSlis).to receive(:initialize_request_slis_if_needed!).and_call_original
...@@ -40,14 +33,4 @@ RSpec.describe Gitlab::Metrics::Exporter::WebExporter do ...@@ -40,14 +33,4 @@ RSpec.describe Gitlab::Metrics::Exporter::WebExporter do
expect(response.body).to include('gitlab_sli:rails_request_apdex') expect(response.body).to include('gitlab_sli:rails_request_apdex')
end end
end end
describe '#mark_as_not_running!' do
it 'readiness probe returns a failure status', :prometheus do
exporter.mark_as_not_running!
expect(readiness_probe.http_status).to eq(503)
expect(readiness_probe.json).to include(status: 'failed')
expect(readiness_probe.json).to include('web_exporter' => [{ 'status': 'failed' }])
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment