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?
Gitlab::Metrics::Exporter::WebExporter.instance.start
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
# We need to ensure that before we re-exec or shutdown server
# we do stop the exporter
......
......@@ -9,8 +9,6 @@ module Gitlab
class BaseExporter < Daemon
attr_reader :server
attr_accessor :readiness_checks
def initialize(settings, log_enabled:, log_file:, gc_requests: false, **options)
super(**options)
......@@ -85,7 +83,7 @@ module Gitlab
end
def readiness_probe
::Gitlab::HealthChecks::Probes::Collection.new(*readiness_checks)
::Gitlab::HealthChecks::Probes::Collection.new
end
def liveness_probe
......
......@@ -4,17 +4,6 @@ module Gitlab
module Metrics
module Exporter
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
def call(env)
Gitlab::Metrics::RailsSlis.initialize_request_slis_if_needed!
......@@ -23,24 +12,9 @@ module Gitlab
end
end
attr_reader :running
# This exporter is always run on master process
def initialize(**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
private
......@@ -53,16 +27,6 @@ module Gitlab
run app
end
end
def start_working
@running = true
super
end
def stop_working
mark_as_not_running!
super
end
end
end
end
......
......@@ -4,7 +4,6 @@ require 'spec_helper'
RSpec.describe Gitlab::Metrics::Exporter::WebExporter do
let(:exporter) { described_class.new }
let(:readiness_probe) { exporter.send(:readiness_probe).execute }
before do
stub_config(
......@@ -25,12 +24,6 @@ RSpec.describe Gitlab::Metrics::Exporter::WebExporter do
end
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
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
expect(response.body).to include('gitlab_sli:rails_request_apdex')
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
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