Merge commit '2f98134ac69ee840095c9d8389e4b2fff72f20c1' into glitch-soc/merge-upstream

This commit is contained in:
Claire
2025-03-15 17:49:32 +01:00
27 changed files with 362 additions and 63 deletions

View File

@@ -0,0 +1,26 @@
# frozen_string_literal: true
module Mastodon
module Middleware
class PrometheusQueueTime < ::PrometheusExporter::Middleware
# Overwrite to only collect the queue time metric
def call(env)
queue_time = measure_queue_time(env)
result = @app.call(env)
result
ensure
obj = {
type: 'web',
queue_time: queue_time,
default_labels: default_labels(env, result),
}
labels = custom_labels(env)
obj = obj.merge(custom_labels: labels) if labels
@client.send_json(obj)
end
end
end
end