c134a72cdb
+ Use NullMetrics to mock metrics when unused + Use method_missing in NullMetrics mocking + Update prometheus gem to version that correctly uses transitive dependencies + Ensure correct folders are used in Multiprocess prometheus client tests. + rename Sessions controller's metric
21 lines
470 B
Ruby
21 lines
470 B
Ruby
class MetricsController < ActionController::Base
|
|
include RequiresHealthToken
|
|
|
|
protect_from_forgery with: :exception
|
|
|
|
before_action :validate_prometheus_metrics
|
|
|
|
def index
|
|
render text: metrics_service.metrics_text, content_type: 'text/plain; verssion=0.0.4'
|
|
end
|
|
|
|
private
|
|
|
|
def metrics_service
|
|
@metrics_service ||= MetricsService.new
|
|
end
|
|
|
|
def validate_prometheus_metrics
|
|
render_404 unless Gitlab::Metrics.prometheus_metrics_enabled?
|
|
end
|
|
end
|