diff --git a/lib/metrics.rb b/lib/metrics.rb index c9e6a8944c..9418e7eecd 100644 --- a/lib/metrics.rb +++ b/lib/metrics.rb @@ -48,4 +48,22 @@ def benchmark_and_record_metric(type, event, labels, description) elapsed_time_seconds = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start record_metric(type, event, elapsed_time_seconds, labels, description) end + + class Prometheus + include Singleton + + def initialize + @client = PrometheusExporter::Client.default + @collectors = {} + end + + def register(type, name, description = nil) + @collectors[name] ||= @client.register(type, name, description) + self + end + + def observe(name, value, labels = {}) + @collectors[name].observe(value, labels) + end + end end diff --git a/lib/prometheus.rb b/lib/prometheus.rb deleted file mode 100644 index 1e67a1aaec..0000000000 --- a/lib/prometheus.rb +++ /dev/null @@ -1,18 +0,0 @@ -require "prometheus_exporter/client" -class Prometheus - include Singleton - - def initialize - @client = PrometheusExporter::Client.default - @collectors = {} - end - - def register(type, name, description = nil) - @collectors[name] ||= @client.register(type, name, description) - self - end - - def observe(name, value, labels = {}) - @collectors[name].observe(value, labels) - end -end