mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 18:08:42 -05:00
(POOLER-160) Add Prometheus Stats Feeds
Add a new Prometheus class as an additional stats feed along with the existing feeds. Move the metrics initialisation code into its own class and sub-class the individual metrics implementations under this.
This commit is contained in:
parent
c6ab52372a
commit
ffab7def9e
9 changed files with 585 additions and 16 deletions
24
lib/vmpooler/metrics.rb
Normal file
24
lib/vmpooler/metrics.rb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Vmpooler
|
||||
class Metrics
|
||||
# static class instantiate appropriate metrics object.
|
||||
def self.init(params)
|
||||
if params[:statsd]
|
||||
metrics = Vmpooler::Statsd.new(params[:statsd])
|
||||
elsif params[:graphite]
|
||||
metrics = Vmpooler::Graphite.new(params[:graphite])
|
||||
elsif params[:prometheus]
|
||||
metrics = Vmpooler::Promstats.new(params[:prometheus])
|
||||
else
|
||||
metrics = Vmpooler::DummyStatsd.new
|
||||
end
|
||||
metrics
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require 'vmpooler/metrics/statsd'
|
||||
require 'vmpooler/metrics/dummy_statsd'
|
||||
require 'vmpooler/metrics/graphite'
|
||||
require 'vmpooler/metrics/promstats'
|
||||
Loading…
Add table
Add a link
Reference in a new issue