lib/sidekiq/prometheus/exporter.rb in sidekiq-prometheus-exporter-0.1.0 vs lib/sidekiq/prometheus/exporter.rb in sidekiq-prometheus-exporter-0.1.1
- old
+ new
@@ -6,10 +6,11 @@
module Sidekiq
module Prometheus
# Expose Prometheus metrics via Rack application or Sidekiq::Web application
module Exporter
HTTP_GET = 'GET'.freeze
+ NOT_FOUND_TEXT = 'Not Found'.freeze
REQUEST_METHOD = 'REQUEST_METHOD'.freeze
HEADERS = {
'Content-Type' => 'text/plain; version=0.0.4',
'Cache-Control' => 'no-cache'
}.freeze
@@ -55,10 +56,10 @@
end
end
end
def self.call(env)
- return [404, HEADERS, [NOT_FOUND]] if env[REQUEST_METHOD] != HTTP_GET
+ return [404, HEADERS, [NOT_FOUND_TEXT]] if env[REQUEST_METHOD] != HTTP_GET
stats = Sidekiq::Stats.new
queues_latency = Sidekiq::Queue.all.map do |queue|
format(LATENCY_TEMPLATE, name: queue.name, latency: queue.latency)
end