Class: Sidekiq::Prometheus::Exporter::Exporters
- Inherits:
-
Object
- Object
- Sidekiq::Prometheus::Exporter::Exporters
- Defined in:
- lib/sidekiq/prometheus/exporter/exporters.rb
Constant Summary collapse
- AVAILABLE_EXPORTERS =
{ standard: Sidekiq::Prometheus::Exporter::Standard, cron: Sidekiq::Prometheus::Exporter::Cron, scheduler: Sidekiq::Prometheus::Exporter::Scheduler }.freeze
Instance Attribute Summary collapse
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
Instance Method Summary collapse
- #exporters=(value) ⇒ Object
-
#initialize ⇒ Exporters
constructor
A new instance of Exporters.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Exporters
Returns a new instance of Exporters.
19 20 21 |
# File 'lib/sidekiq/prometheus/exporter/exporters.rb', line 19 def initialize @enabled = AVAILABLE_EXPORTERS.values.select(&:available?) end |
Instance Attribute Details
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
17 18 19 |
# File 'lib/sidekiq/prometheus/exporter/exporters.rb', line 17 def enabled @enabled end |
Instance Method Details
#exporters=(value) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sidekiq/prometheus/exporter/exporters.rb', line 23 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 |
#to_s ⇒ Object
37 38 39 |
# File 'lib/sidekiq/prometheus/exporter/exporters.rb', line 37 def to_s @enabled.map { |exporter| exporter.new.to_s }.join("\n".freeze) end |