iniciar prometheus solo en producción

This commit is contained in:
f 2020-09-28 19:38:53 -03:00
parent 1695cc6771
commit 2383ab9454
2 changed files with 7 additions and 5 deletions

View file

@ -1,4 +1,4 @@
unless Rails.env.test?
if Rails.env.production?
require 'prometheus_exporter/middleware'
# This reports stats per request like HTTP status and timings

View file

@ -57,8 +57,10 @@ end
on_worker_boot do
ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
require 'prometheus_exporter/instrumentation'
PrometheusExporter::Instrumentation::ActiveRecord.start(custom_labels: { type: 'puma_worker' }, config_labels: %i[database host])
PrometheusExporter::Instrumentation::Puma.start
PrometheusExporter::Instrumentation::Process.start(type: 'web')
if Rails.env.production?
require 'prometheus_exporter/instrumentation'
PrometheusExporter::Instrumentation::ActiveRecord.start(custom_labels: { type: 'puma_worker' }, config_labels: %i[database host])
PrometheusExporter::Instrumentation::Puma.start
PrometheusExporter::Instrumentation::Process.start(type: 'web')
end
end