debian-mirror-gitlab/lib/gitlab/metrics/exporter/web_exporter.rb

61 lines
1.3 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
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
2021-03-11 19:13:27 +05:30
def available?
true
end
2019-12-21 20:55:43 +05:30
end
attr_reader :running
# This exporter is always run on master process
def initialize
super
2019-12-26 22:10:19 +05:30
# 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
2019-12-21 20:55:43 +05:30
self.readiness_checks = [
WebExporter::ExporterCheck.new(self),
2021-09-04 01:27:46 +05:30
Gitlab::HealthChecks::PumaCheck
2019-12-21 20:55:43 +05:30
]
end
def settings
Gitlab.config.monitoring.web_exporter
end
def log_filename
File.join(Rails.root, 'log', 'web_exporter.log')
end
2019-12-26 22:10:19 +05:30
def mark_as_not_running!
@running = false
end
2019-12-21 20:55:43 +05:30
private
def start_working
@running = true
super
end
def stop_working
2019-12-26 22:10:19 +05:30
mark_as_not_running!
2019-12-21 20:55:43 +05:30
super
end
end
end
end
end