mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -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
|
|
@ -15,7 +15,10 @@ module Vmpooler
|
|||
require 'timeout'
|
||||
require 'yaml'
|
||||
|
||||
%w[api graphite logger pool_manager statsd dummy_statsd generic_connection_pool].each do |lib|
|
||||
require 'prometheus/middleware/collector'
|
||||
require 'prometheus/middleware/exporter'
|
||||
|
||||
%w[api metrics logger pool_manager generic_connection_pool].each do |lib|
|
||||
require "vmpooler/#{lib}"
|
||||
end
|
||||
|
||||
|
|
@ -103,6 +106,12 @@ module Vmpooler
|
|||
parsed_config[:graphite]['prefix'] = ENV['GRAPHITE_PREFIX'] if ENV['GRAPHITE_PREFIX']
|
||||
parsed_config[:graphite]['port'] = string_to_int(ENV['GRAPHITE_PORT']) if ENV['GRAPHITE_PORT']
|
||||
|
||||
if parsed_config.key? :prometheus
|
||||
# parsed_config[:prometheus]['endpoint'] = ENV['PROMETHEUS_ENDPOINT'] if ENV['PROMETHEUS_ENDPOINT']
|
||||
# parsed_config[:prometheus]['prefix'] = ENV['PROMETHEUS_PREFIX'] if ENV['PROMETHEUS_PREFIX']
|
||||
# parsed_config[:prometheus]['metrics_prefix'] = ENV['PROMETHEUS_METRICS_PREFIX'] if ENV['PROMETHEUS_METRICS_PREFIX']
|
||||
end
|
||||
|
||||
parsed_config[:auth] = parsed_config[:auth] || {} if ENV['AUTH_PROVIDER']
|
||||
if parsed_config.key? :auth
|
||||
parsed_config[:auth]['provider'] = ENV['AUTH_PROVIDER'] if ENV['AUTH_PROVIDER']
|
||||
|
|
@ -184,16 +193,6 @@ module Vmpooler
|
|||
Vmpooler::Logger.new logfile
|
||||
end
|
||||
|
||||
def self.new_metrics(params)
|
||||
if params[:statsd]
|
||||
Vmpooler::Statsd.new(params[:statsd])
|
||||
elsif params[:graphite]
|
||||
Vmpooler::Graphite.new(params[:graphite])
|
||||
else
|
||||
Vmpooler::DummyStatsd.new
|
||||
end
|
||||
end
|
||||
|
||||
def self.pools(conf)
|
||||
conf[:pools]
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue