Sha256: e4694f4d741ce4077487b99c5e3984e6a3cc67bbf027a3eaeaeb2cea4e2556b6
Contents?: true
Size: 1.02 KB
Versions: 15
Compression:
Stored size: 1.02 KB
Contents
module GitLab module Exporter # 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::Exporter) { |a, e| a.const_get(e) } params[:class] = klass end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems