2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
require 'prometheus/client/formats/text'
|
|
|
|
|
|
|
|
class MetricsService
|
|
|
|
def prometheus_metrics_text
|
2023-07-09 08:55:56 +05:30
|
|
|
if Feature.enabled?(:prom_metrics_rust)
|
|
|
|
::Prometheus::Client::Formats::Text.marshal_multiprocess(multiprocess_metrics_path, use_rust: true)
|
|
|
|
else
|
|
|
|
::Prometheus::Client::Formats::Text.marshal_multiprocess(multiprocess_metrics_path)
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def metrics_text
|
2018-11-08 19:23:39 +05:30
|
|
|
prometheus_metrics_text
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def multiprocess_metrics_path
|
|
|
|
::Prometheus::Client.configuration.multiprocess_files_dir
|
|
|
|
end
|
|
|
|
end
|