Sha256: c866d15e3e975138a37d4980ab487ae4e60290305f8efd31f5899a7b8a5ae43b
Contents?: true
Size: 1.17 KB
Versions: 9
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true require 'sidekiq/prometheus/exporter/standard' require 'sidekiq/prometheus/exporter/cron' require 'sidekiq/prometheus/exporter/scheduler' module Sidekiq module Prometheus module Exporter class Exporters AVAILABLE_EXPORTERS = { standard: Sidekiq::Prometheus::Exporter::Standard, cron: Sidekiq::Prometheus::Exporter::Cron, scheduler: Sidekiq::Prometheus::Exporter::Scheduler }.freeze attr_reader :enabled def initialize @enabled = AVAILABLE_EXPORTERS.values.select(&:available?) end def exporters=(value) value = Array(value) unless value.respond_to?(:select) potential = AVAILABLE_EXPORTERS unless value.include?(:auto_detect) potential = potential.select { |name, _| value.include?(name) } end @enabled = %i(standard).concat(potential.keys).uniq .map { |name| AVAILABLE_EXPORTERS.fetch(name) } .select(&:available?) end def to_s @enabled.map { |exporter| exporter.new.to_s }.join("\n".freeze) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems