dawarich/config/initializers/prometheus.rb

16 lines
578 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2025-09-18 12:29:46 -04:00
if defined?(Rails::Server) && !Rails.env.test? && DawarichSettings.prometheus_exporter_enabled?
require 'prometheus_exporter/middleware'
require 'prometheus_exporter/instrumentation'
# This reports stats per request like HTTP status and timings
Rails.application.middleware.unshift PrometheusExporter::Middleware
2024-12-04 09:00:28 -05:00
# This reports basic process stats like RSS and GC info
PrometheusExporter::Instrumentation::Process.start(type: 'web')
# Add ActiveRecord instrumentation
PrometheusExporter::Instrumentation::ActiveRecord.start
end