lib/splash/logs.rb in prometheus-splash-0.6.0 vs lib/splash/logs.rb in prometheus-splash-0.6.1

- old
+ new

@@ -54,11 +54,11 @@ # @param [Hash] options # @option options [String] :session a session number for log daemon # @return [Hash] Exiter case :quiet_exit def notify(options = {}) log = get_logger - unless verify_service host: @config.prometheus_pushgateway_host ,port: @config.prometheus_pushgateway_port then + unless verify_service url: @config.prometheus_pushgateway_url then return { :case => :service_dependence_missing, :more => "Prometheus Notification not send." } end session = (options[:session]) ? options[:session] : log.get_session log.info "Sending metrics to Prometheus Pushgateway", session @logs_target.each do |item| @@ -68,10 +68,10 @@ @metric_missing.set(missing, labels: { log: item[:log] }) lines = (item[:lines])? item[:lines] : 0 @metric_lines.set(lines, labels: { log: item[:log] }) end hostname = Socket.gethostname - url = "http://#{@config.prometheus_pushgateway_host}:#{@config.prometheus_pushgateway_port}/#{@config.prometheus_pushgateway_path}" + url = @config.prometheus_pushgateway_url Prometheus::Client::Push.new('Splash',hostname, url).add(@registry) log.ok "Sending to Prometheus PushGateway done.", session return {:case => :quiet_exit } end