class Splash::Logs::LogsNotifier
Public Class Methods
new(options={})
click to toggle source
# File lib/splash/logs.rb, line 19 def initialize(options={}) @config = get_config @url = @config.prometheus_pushgateway_url @name = options[:name] @missing = options[:missing] @lines = options[:lines] @errors = options[:errors] end
Public Instance Methods
notify()
click to toggle source
send metrics to Prometheus PushGateway @return [Bool]
# File lib/splash/logs.rb, line 30 def notify unless verify_service url: @url then return { :case => :service_dependence_missing, :more => "Prometheus Notification not send."} end @@metric_missing.set(@missing, labels: { log: @name }) @@metric_count.set(@errors, labels: { log: @name }) @@metric_lines.set(@lines, labels: { log: @name }) hostname = Socket.gethostname return Prometheus::Client::Push.new("Splash", hostname, @url).add(@@registry) end