chore(yabeda): use webrick and check enabled flag

This commit is contained in:
simon lehericey 2024-04-19 18:43:58 +02:00
parent 3dbb2266d2
commit fcbd3d94d1
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
4 changed files with 10 additions and 1 deletions

View file

@ -192,3 +192,5 @@ La compatibilité est testée par Browserstack.<br>[<img src="app/assets/images/
[![View performance data on Skylight](https://badges.skylight.io/status/zAvWTaqO0mu1.svg)](https://oss.skylight.io/app/applications/zAvWTaqO0mu1)
Nous utilisons Skylight pour suivre les performances de notre application.
Par ailleurs, nous utilisons [Yabeda](https://github.com/yabeda-rb/yabeda) pour exporter des metriques au format prometheus. L'activation se fait via la variable d'environnement `PROMETHEUS_EXPORTER_ENABLED` voir config/env.example.optional .

View file

@ -2,5 +2,9 @@
require_relative "config/environment"
if ENV['PROMETHEUS_EXPORTER_ENABLED'] == 'enabled'
Yabeda::Prometheus::Exporter.start_metrics_server!
end
run Rails.application
Rails.application.load_server

View file

@ -244,7 +244,7 @@ REDIS_SIDEKIQ_PASSWORD='sentinel_and_redis_password'
REDIS_SIDEKIQ_USERNAME='sentinel_and_redis_username'
# configuration for prometheus metrics web server
# launched with sidekiq
# launched with sidekiq and puma
PROMETHEUS_EXPORTER_BIND="0.0.0.0"
PROMETHEUS_EXPORTER_PORT="9394"
PROMETHEUS_EXPORTER_ENABLED="disabled"

View file

@ -0,0 +1,3 @@
if ENV['PROMETHEUS_EXPORTER_ENABLED'] == 'enabled' && !Sidekiq.server?
Prometheus::Client.config.data_store = Prometheus::Client::DataStores::DirectFileStore.new(dir: Rails.root.join('tmp', 'prometheus'))
end