Sha256: 473d9fd68ffc18e191839dc75bc40c3d2f70a2c1dba4e77fe6b929c35688d77f
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
module GitLab module Monitor # A class to combine multiple probers into one class Prober def initialize(prober_opts, metrics: PrometheusMetrics.new) @prober_opts = prober_opts @metrics = metrics resolve_prober_classes end 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 def write_to(target) target.write(@metrics.to_s) end private def resolve_prober_classes @prober_opts.each do |probe_name, params| prober_class_name = params[:class_name] || Utils.camel_case_string("#{probe_name}_prober") klass = prober_class_name.split("::").reduce(GitLab::Monitor) { |a, e| a.const_get(e) } params[:class] = klass end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems