-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Throttle" is not working as expected #1034
Comments
Is it related to your In order to test your code, I replaced it with (logging/init {:file "/var/log/riemann/riemann.log"})
(let [host "127.0.0.1"]
(tcp-server {:host host})
(udp-server {:host host})
(ws-server {:host host}))
; Expire old events from the index every 5 seconds.
(periodically-expire 5)
(let [index (index)]
; Inbound events will be passed to these streams:
(streams
(default :ttl 60
; Index all events immediately.
;index
(by [:host :service]
(where (state "critical")
(where (tagged "dummy_alert")
(throttle 3 30
#(info %)))))
; Log expired events.
(expired
(fn [event] (info "expired" event))))))
Then send some events: r = Riemann::Client.new.tcp
['n1', 'n2', 'n3'].each do |service|
10.times do |n|
r << {
host: "TESTING",
service: service,
state: 'critical',
tags: ["dummy_alert"],
ttl: 3600,
description: n,
}
end
end and got the expected outcome in the log file:
|
Hi @smortex, Your observation is very insightful, thank you. Since |
Hum 🤔 I can't find any I adjusted my test example like this, defining my own --- /usr/local/etc/riemann/riemann.config.orig 2023-04-10 10:45:38.625538000 -1000
+++ /usr/local/etc/riemann/riemann.config 2023-04-10 10:46:30.465567000 -1000
@@ -13,7 +13,9 @@
; Expire old events from the index every 5 seconds.
(periodically-expire 5)
-(let [index (index)]
+
+(let [index (index)
+ email (mailer)]
; Inbound events will be passed to these streams:
(streams
(default :ttl 60
@@ -24,6 +26,7 @@
(where (state "critical")
(where (tagged "dummy_alert")
(throttle 3 30
+ (email "romain@localhost")
#(info %)))))
; Log expired events. I received the 9 expected messages, the 3 first of each host. Maybe you can post your |
Apologies for the delayed response, the definition of email function is as follows: |
@Magesh-B can you create a simple |
Describe the bug
As per the Riemann documentation, "Throttle" allows the first n events through, then ignores all the rest for the defined duration.
So I have used the throttle to send an email for the first 3 events and skip the rest for an hour. It was working when I implemented it, but recently only I noticed that instead of sending emails for the first 3 events, Riemann is sending 3 emails for the first event alone and skipping the rest of the events for an hour.
To Reproduce
Riemann config:
(streams (by [:host, :service] (where (state "critical") (where (tagged "dummy_alert") (throttle 3 3600 (email "[email protected]")) ) ) ) )
Event data:
{ host: "TESTING", service: "TESTING", state: 'critical', tags: ["dummy_alert"], ttl: 3600 }
Expected behavior
Emails should be sent for the first n events and the rest of the events should be skipped for the defined duration
Background (please complete the following information):
The text was updated successfully, but these errors were encountered: