Class: GitLab::Monitor::Prober
- Inherits:
-
Object
- Object
- GitLab::Monitor::Prober
- Defined in:
- lib/gitlab_monitor/prober.rb
Overview
A class to combine multiple probers into one
Instance Method Summary collapse
-
#initialize(prober_opts, metrics: PrometheusMetrics.new) ⇒ Prober
constructor
A new instance of Prober.
- #probe_all ⇒ Object
- #write_to(target) ⇒ Object
Constructor Details
#initialize(prober_opts, metrics: PrometheusMetrics.new) ⇒ Prober
Returns a new instance of Prober.
5 6 7 8 9 10 |
# File 'lib/gitlab_monitor/prober.rb', line 5 def initialize(prober_opts, metrics: PrometheusMetrics.new) @prober_opts = prober_opts @metrics = metrics resolve_prober_classes end |
Instance Method Details
#probe_all ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gitlab_monitor/prober.rb', line 12 def probe_all @prober_opts.each do |_probe_name, params| Utils.wrap_in_array(params[:opts]).each do |opts| prober = params[:class].new(opts, metrics: @metrics) params[:methods].each do |meth| prober.send(meth) end end end end |
#write_to(target) ⇒ Object
23 24 25 |
# File 'lib/gitlab_monitor/prober.rb', line 23 def write_to(target) target.write(@metrics.to_s) end |