Sha256: 9c7101dc24ea197ab78f4066f48ad6e85a50619d40e9b249ff91268fcb5067e4
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true require 'sidekiq/prometheus/exporter/standard' require 'sidekiq/prometheus/exporter/cron' module Sidekiq module Prometheus module Exporter class Exporters AVAILABLE_EXPORTERS = { standard: Sidekiq::Prometheus::Exporter::Standard, cron: Sidekiq::Prometheus::Exporter::Cron }.freeze 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-prometheus-exporter-0.1.9 | lib/sidekiq/prometheus/exporter/exporters.rb |
sidekiq-prometheus-exporter-0.1.8 | lib/sidekiq/prometheus/exporter/exporters.rb |