Skip to content

Commit

Permalink
remove critical/warning actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mcorbin committed Sep 27, 2024
1 parent d950d89 commit 4bda766
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 74 deletions.
44 changes: 0 additions & 44 deletions src/clojure/mirabelle/action.clj
Original file line number Diff line number Diff line change
Expand Up @@ -647,48 +647,6 @@
(time/s->ns (:duration config))]
:children children})

(defn critical*
[_ & children]
(fn stream [event]
(when (e/critical? event)
(call-rescue event children))))

(defn critical
"Keep all events in state critical.
```clojure
(critical
(error))
```
In this example, all events with `:state` \"critical\" will be logged.
"
[& children]
{:action :critical
:description {:message "Keep critical events"}
:children children})

(defn warning*
[_ & children]
(fn stream [event]
(when (e/warning? event)
(call-rescue event children))))

(defn warning
"Keep all events in state warning.
```clojure
(warning
(warning))
```
In this example, all events with `:state` \"warning\" will be logged.
"
[& children]
{:action :warning
:description {:message "Keep warning events"}
:children children})

(defn default*
[_ field value & children]
(let [get-fn (if (sequential? field)
Expand Down Expand Up @@ -3152,7 +3110,6 @@
:coll-sum coll-sum*
:coll-top coll-top*
:coll-where coll-where*
:critical critical*
:cond-dt cond-dt*
:debug debug*
:default default*
Expand Down Expand Up @@ -3208,7 +3165,6 @@
:top aggregation*
:under under*
:untag untag*
:warning warning*
:where where*
:with with*})

Expand Down
26 changes: 0 additions & 26 deletions test/mirabelle/action_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -225,19 +225,6 @@
{:time 22 :metric 13}
{:time 36 :metric 12}])))

(deftest critical*-test
(let [[rec state] (recorder)]
(test-actions (a/critical* nil rec)
state
[{:state "ok" :metric 1}
{:state "critical" :metric 2}
{:state "critical" :metric 3}
{:state "ok" :metric 1}
{:state "critical" :metric 5}]
[{:state "critical" :metric 2}
{:state "critical" :metric 3}
{:state "critical" :metric 5}])))

(deftest default*-test
(let [[rec state] (recorder)]
(test-actions (a/default* nil :state "ok" rec)
Expand Down Expand Up @@ -694,19 +681,6 @@
{:metric 0.75 :time 1 :state "ok"}
{:metric 0.875 :time 2 :state "ok"}])))

(deftest warning*-test
(let [[rec state] (recorder)]
(test-actions (a/warning* nil rec)
state
[{:state "ok" :metric 1}
{:state "warning" :metric 2}
{:state "warning" :metric 3}
{:state "critical" :metric 1}
{:state "warning" :metric 5}]
[{:state "warning" :metric 2}
{:state "warning" :metric 3}
{:state "warning" :metric 5}])))

(deftest over*-test
(let [[rec state] (recorder)]
(test-actions (a/over* nil 10 rec)
Expand Down
6 changes: 2 additions & 4 deletions test/mirabelle/stream_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,6 @@
(a/by {:fields [:host :service]})
(a/sdissoc [:host :service])
(a/throttle {:count 1 :duration 10})
(a/warning)
(a/ewma-timeless 1)
(a/over 1)
(a/under 1)
Expand All @@ -771,8 +770,7 @@
(a/by {:fields [:host]}))
(a/fixed-time-window {:duration 5})
(a/split
[:> :metric 10] (a/critical))
(a/critical)
[:> :metric 10] (a/debug))
(a/cond-dt {:duration 10 :condition [:= :state "critical"]})
(a/debug)
(a/info)
Expand Down Expand Up @@ -827,7 +825,7 @@
(a/with {:foo 1})
(a/where [:> :metric 10])
(a/where [:always-true]
(a/critical))
(a/debug))
(a/where [:and
[:< :metric 10]
[:> :metric 1]]))}
Expand Down

0 comments on commit 4bda766

Please sign in to comment.