lib/syslogstash/prometheus_exporter.rb in syslogstash-1.0.2 vs lib/syslogstash/prometheus_exporter.rb in syslogstash-1.1.0
- old
+ new
@@ -9,10 +9,11 @@
def initialize
@msg_in = prom.counter(:syslogstash_messages_received, "The number of syslog messages received from each log socket")
@msg_out = prom.counter(:syslogstash_messages_sent, "The number of logstash messages sent to each logstash server")
@lag = prom.gauge(:syslogstash_lag_ms, "How far behind we are in relaying messages")
@queue = prom.gauge(:syslogstash_queue_size, "How many messages are queued to be sent")
+ @dropped = prom.counter(:syslogstash_messages_dropped, "How many syslog messages have been dropped from the backlog queue")
end
def received(socket, stamp)
@msg_in.increment(socket_path: socket)
@queue.set({}, (@queue.get({}) || 0) + 1)
@@ -31,9 +32,14 @@
if @most_recent_sent.nil? || @most_recent_sent < stamp
@most_recent_sent = stamp
refresh_lag
end
+ end
+
+ def dropped
+ @queue.set({}, @queue.get({}) - 1)
+ @dropped.increment(logstash_server: server)
end
def run
@thread = Thread.new do
app = Rack::Builder.new