class Splash::Transfers::TxNotifier
Public Class Methods
new(options={})
click to toggle source
# File lib/splash/transfers.rb, line 24 def initialize(options={}) @config = get_config @url = @config.prometheus_pushgateway_url @name = "tx_#{options[:name].to_s}" @nbfiles = options[:nbfiles] @nbfiles_failed = options[:nbfiles_failed] @time = options[:time] end
Public Instance Methods
notify()
click to toggle source
send metrics to Prometheus PushGateway @return [Bool]
# File lib/splash/transfers.rb, line 35 def notify unless verify_service url: @url then return { :case => :service_dependence_missing, :more => "Prometheus Notification not send."} end @@metric_nbfiles.set(@nbfiles) @@metric_nbfiles_failed.set(@nbfiles_failed) @@metric_time.set(@time) hostname = Socket.gethostname return Prometheus::Client::Push.new(@name, hostname, @url).add(@@registry) end