lib/splash/logs.rb in prometheus-splash-0.8.3 vs lib/splash/logs.rb in prometheus-splash-0.8.4
- old
+ new
@@ -46,10 +46,14 @@
def initialize(name)
@name = name
@backend = get_backend :logs_trace
end
+ def clear
+ @backend.del({:key => @name}) if @backend.exist?({key: @name})
+ end
+
def purge(retention)
retention = {} if retention.nil?
if retention.include? :hours then
adjusted_datetime = DateTime.now - retention[:hours].to_f / 24
elsif retention.include? :hours then
@@ -130,10 +134,10 @@
log.info "Sending metrics to Prometheus Pushgateway", session
@logs_target.each do |item|
logsrec = LogsRecords::new item[:label]
errors = (item[:count])? item[:count] : 0
lines = (item[:lines])? item[:lines] : 0
- missing = (item[:status] = :missing)? 1 : 0
+ missing = (item[:status] == :missing)? 1 : 0
file = item[:log]
logsrec.purge(item[:retention])
logsrec.add_record :status => item[:status],
:errors => errors,
:lines => lines,