Enumerated File Store
Enumerated File Store - это гем для реализации специального Data Store для библиотеки prometheus-client.
Данная библиотека решает проблему огромного числа файлов-метрик при использовании стандартного DirectFileStore
Enumerated File Store provides custom Data Store for prometheus-client library.
It fixes issue with too many files for long running applications when using DirectFileStore.
Возможности / Features
Библиоетка использует последовательное присвоение номеров файлам метри вместо использования PID / It uses sequential numbering for metric filenames instead of PID-stamps.
Начало работы / Getting started
gem install prometheus-enumerated-store
При установке prometheus_enumerated_store через bundler добавьте следующую строку в Gemfile:
If you'd rather install prometheus_enumerated_store using bundler, add a line for it in your Gemfile:
gem 'prometheus_enumerated_store'
Затем выполните / Then run:
bundle install # для установки гема / gem installation
Использование / Usage
Для использования необходимо в каком-нибудь файле config/initializers/ настройить Data Store для библиотеки prometheus-client:
Now you need to set Data Store for prometheus-client gem somewhere in config/initializers/:
Prometheus::Client.config.data_store = Prometheus::Enumerated::Store.new(dir: Rails.root.join('tmp', 'prometheus_metrics'))
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |_forked|
Prometheus::Client.config.data_store.reset
end
end
# Or somewhere in Pum config if any:
on_restart do
Prometheus::Client.config.data_store.reset
end
on_worker_boot do
Prometheus::Client.config.data_store.reset
end
Лицензия / License
Библиотека доступна с открытым исходным кодом в соответствии с условиями лицензии MIT.
The gem is available as open source under the terms of the MIT License.