Add middleware to record queue time (#34172)
This commit is contained in:
parent
24ec83ee52
commit
4a6cf67c46
3 changed files with 65 additions and 3 deletions
|
@ -1,8 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
if ENV['MASTODON_PROMETHEUS_EXPORTER_ENABLED'] == 'true'
|
||||
require 'prometheus_exporter'
|
||||
require 'prometheus_exporter/middleware'
|
||||
|
||||
if ENV['MASTODON_PROMETHEUS_EXPORTER_LOCAL'] == 'true'
|
||||
require 'prometheus_exporter'
|
||||
require 'prometheus_exporter/server'
|
||||
require 'prometheus_exporter/client'
|
||||
|
||||
|
@ -17,9 +19,11 @@ if ENV['MASTODON_PROMETHEUS_EXPORTER_ENABLED'] == 'true'
|
|||
|
||||
if ENV['MASTODON_PROMETHEUS_EXPORTER_WEB_DETAILED_METRICS'] == 'true'
|
||||
# Optional, as those metrics might generate extra overhead and be redundant with what OTEL provides
|
||||
require 'prometheus_exporter/middleware'
|
||||
|
||||
# Per-action/controller request stats like HTTP status and timings
|
||||
Rails.application.middleware.unshift PrometheusExporter::Middleware
|
||||
else
|
||||
# Include stripped down version of PrometheusExporter::Middleware that only collects queue time
|
||||
require 'mastodon/middleware/prometheus_queue_time'
|
||||
Rails.application.middleware.unshift Mastodon::Middleware::PrometheusQueueTime
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue