mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 18:56:21 +00:00
iniciar prometheus solo en producción
This commit is contained in:
parent
1695cc6771
commit
2383ab9454
2 changed files with 7 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
unless Rails.env.test?
|
if Rails.env.production?
|
||||||
require 'prometheus_exporter/middleware'
|
require 'prometheus_exporter/middleware'
|
||||||
|
|
||||||
# This reports stats per request like HTTP status and timings
|
# This reports stats per request like HTTP status and timings
|
||||||
|
|
|
@ -57,8 +57,10 @@ end
|
||||||
on_worker_boot do
|
on_worker_boot do
|
||||||
ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||||
|
|
||||||
require 'prometheus_exporter/instrumentation'
|
if Rails.env.production?
|
||||||
PrometheusExporter::Instrumentation::ActiveRecord.start(custom_labels: { type: 'puma_worker' }, config_labels: %i[database host])
|
require 'prometheus_exporter/instrumentation'
|
||||||
PrometheusExporter::Instrumentation::Puma.start
|
PrometheusExporter::Instrumentation::ActiveRecord.start(custom_labels: { type: 'puma_worker' }, config_labels: %i[database host])
|
||||||
PrometheusExporter::Instrumentation::Process.start(type: 'web')
|
PrometheusExporter::Instrumentation::Puma.start
|
||||||
|
PrometheusExporter::Instrumentation::Process.start(type: 'web')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue