Thanks for the reply.
I am not sure I fully understand the 2nd example of how to replace the multi-arity functions. I am guessing I have to somehow use the args parameter and use a map to pass this function. I understand the first example though, and already incorporated to the code
I have another issue now that is quite weird. It happens downstream. I am pasting the full code with no changes, I had to add a 'dummy' (where true ...) statement in alert_threshold_specific to be able to print the current variables and event. Line 172 which is the last in the stack trace has been highligted in red
(defn alert_threshold_specific
[event threshold keyword email_list rate_threshold rate_deadline]
(where true
#(info "alert_threshold_specific" threshold keyword email_list rate_threshold rate_deadline %)
(where (> (:metric event) threshold)
(with {:service keyword
:description (str keyword " at critical level")}
(throttle 1 43200
#(warn (str keyword " usage above " threshold) %)
(email email_list))
)
(else
(when (> rate_threshold 0)
(alert_rate event rate_threshold rate_deadline keyword email_list))))))
(defn alert_threshold_with_rate
([event keyword] (alert_threshold_with_rate event 92 keyword default_mailist 0 0))
([event keyword email_list] (alert_threshold_with_rate event 92 keyword email_list 0 0))
([event keyword threshold email_list] (alert_threshold_with_rate event threshold keyword email_list 0 0))
([event keyword threshold email_list rate_threshold rate_deadline] (alert_threshold_specific event threshold keyword email_list rate_threshold rate_deadline)))
(defn alert_performance_specific
[event tag service_list keyword email_list window_duration threshold rate_threshold rate_deadline]
(project* (vec (map (fn [metric] (fn [e] (= (:service e) metric) )) service_list))
(smap folds/sum
(coalesce 3
(smap flatten_one_vector
(moving-time-window window_duration
;Note for the 0.25 * window_duration. We need to wait fill the window before generating alerts. We are looking for 75%
;of the window events to be present. Since we receive a new event every 3 seconds, the factor is 0.75/3
(where (>= (count event) (* 0.25 window_duration) )
(smap flatten_multiple_vectors
(alert_threshold_with_rate event keyword threshold email_list rate_threshold rate_deadline)))))))))
Here is the error with the stack trace. It also includes the info printout before the if statement. Unless I read something wrong there is no nill in there.
INFO [2022-10-21 17:10:35,477] riemann task 3 - renesas.etc.alerts - alert_threshold_specific 30 Memory (
bob.the...@example.com) 0 0 #riemann.codec.Event{:host ree-du1rws3, :service memory/percent-buffered, :state ok, :description nil, :metric 1.1666448619992935, :tags [collectd vm etx], :time 1666365026, :ttl 6.0, :plugin memory, :type percent, :ds_name value, :type_instance buffered, :ds_type gauge, :ds_index 0, :rate 0.5132878512984761}
WARN [2022-10-21 17:10:35,480] riemann task 3 - renesas.etc.alerts - threw
java.lang.NullPointerException: null
at renesas.etc.alerts$alert_threshold_specific$stream__9318__auto____1176$fn__1205.invoke(alerts.clj:172)
at renesas.etc.alerts$alert_threshold_specific$stream__9318__auto____1176.invoke(alerts.clj:172)
at renesas.etc.alerts$alert_threshold_specific$stream__9318__auto____1235$fn__1240.invoke(alerts.clj:170)
at renesas.etc.alerts$alert_threshold_specific$stream__9318__auto____1235.invoke(alerts.clj:170)
at riemann.streams$smap$stream__7207$fn__7222.invoke(streams.clj:175)
at riemann.streams$smap$stream__7207.invoke(streams.clj:175)
at renesas.etc.alerts$alert_performance_specific$stream__9318__auto____1304$fn__1309.invoke(alerts.clj:205)
at renesas.etc.alerts$alert_performance_specific$stream__9318__auto____1304.invoke(alerts.clj:205)
at riemann.streams$moving_time_window$stream__7565$fn__7588.invoke(streams.clj:353)
at riemann.streams$moving_time_window$stream__7565.invoke(streams.clj:353)
at riemann.streams$smap$stream__7207$fn__7222.invoke(streams.clj:175)
at riemann.streams$smap$stream__7207.invoke(streams.clj:175)
at riemann.streams$coalesce$callback__8658$fn__8677.invoke(streams.clj:1237)
at riemann.streams$coalesce$callback__8658.invoke(streams.clj:1237)
at riemann.streams$periodically_until_expired$wrapper__7695.invoke(streams.clj:515)
at riemann.time.Every.run(time.clj:55)
at riemann.time$run_tasks_BANG_$fn__5402$fn__5403.invoke(time.clj:154)
at riemann.time$run_tasks_BANG_$fn__5402.invoke(time.clj:153)
at riemann.time$run_tasks_BANG_.invokeStatic(time.clj:147)
at riemann.time$run_tasks_BANG_.invoke(time.clj:142)
at riemann.time$start_BANG_$fn__5422$fn__5423.invoke(time.clj:193)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:657)
at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1965)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1965)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invokeStatic(core.clj:661)
at clojure.core$bound_fn_STAR_$fn__5471.doInvoke(core.clj:1995)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:750)
Is there a better way to find which symbol has a null value other than the stack trace?