diff --git a/project.clj b/project.clj index 4af812d..e60da44 100644 --- a/project.clj +++ b/project.clj @@ -8,16 +8,18 @@ :scm {:name "git" :url "https://github.com/BrunoBonacci/bad-boy.git"} - :dependencies [[org.clojure/clojure "1.10.1"] - [org.clojure/tools.logging "1.0.0"] - [com.cognitect.aws/api "0.8.445"] - [com.cognitect.aws/endpoints "1.1.11.732"] - [com.cognitect.aws/ec2 "793.2.627.0"] - [com.cognitect.aws/autoscaling "792.2.622.0"] - [instaparse "1.4.10"] - [com.brunobonacci/where "0.5.5"] - [com.brunobonacci/safely "0.5.0"] - [com.brunobonacci/mulog "0.2.0"]] + :dependencies [[org.clojure/clojure "1.10.1"] + [org.clojure/tools.logging "1.1.0"] + [com.cognitect.aws/api "0.8.484"] + [com.cognitect.aws/endpoints "1.1.11.914"] + [com.cognitect.aws/ec2 "810.2.805.0"] + [com.cognitect.aws/autoscaling "810.2.801.0"] + [instaparse "1.4.10"] + [com.brunobonacci/where "0.5.5"] + [com.brunobonacci/safely "0.7.0-alpha1"] + [com.brunobonacci/mulog "0.5.0"] + [com.brunobonacci/mulog-elasticsearch "0.5.0"] + [com.brunobonacci/mulog-cloudwatch "0.5.0"]] :global-vars {*warn-on-reflection* true} @@ -32,8 +34,7 @@ {:aot :all ;; temp fix for logging :dependencies [[ch.qos.logback/logback-classic "1.2.3"] - [org.codehaus.janino/janino "3.1.1"] - [com.brunobonacci/mulog-elasticsearch "0.2.0"] + [org.codehaus.janino/janino "3.1.2"] [com.internetitem/logback-elasticsearch-appender "1.6" :exclusions [com.fasterxml.jackson.core/jackson-core]] [clj-time "0.15.2"]] @@ -41,8 +42,8 @@ :dev {:dependencies [[midje "1.9.9"] - [org.clojure/test.check "1.0.0"] - [criterium "0.4.5"] + [org.clojure/test.check "1.1.0"] + [criterium "0.4.6"] [ch.qos.logback/logback-classic "1.2.3"]] :resource-paths ["dev-resources"] diff --git a/resources/bad-boy.version b/resources/bad-boy.version index a45be46..0d91a54 100644 --- a/resources/bad-boy.version +++ b/resources/bad-boy.version @@ -1 +1 @@ -0.2.8 +0.3.0 diff --git a/src/com/brunobonacci/bad_boy/main.clj b/src/com/brunobonacci/bad_boy/main.clj index d9e0be6..6eb4273 100644 --- a/src/com/brunobonacci/bad_boy/main.clj +++ b/src/com/brunobonacci/bad_boy/main.clj @@ -35,18 +35,17 @@ "start the events publisher, returns a function to stop the publishers" [] (u/set-global-context! - {:app-name "bad-boy" :env (env) - :version (version) :puid (ut/puid)}) + {:app-name "bad-boy" :env (env) + :version (version) :puid (ut/puid)}) (let [stop* - (when (= "1" (System/getenv "BADBOY_METRICS_ENABLED")) - (let [publisher-type (keyword (or (System/getenv "BADBOY_METRICS_REPORTER") "console")) - destination (or (System/getenv "BADBOY_METRICS_DEST") "http://localhost:9200/")] - (log/info "Starting metrics reporting to: " publisher-type "-" destination) - (if (= :elasticsearch publisher-type) - (u/start-publisher! {:type :elasticsearch :url destination}) - (u/start-publisher! {:type :console}))))] + (let [publisher-conf + (read-string + (or (System/getenv "BADBOY_PUBLISHER_CONF") + (pr-str {:type :console :pretty? true})))] + (log/info "Starting metrics reporting to: " publisher-conf) + (u/start-publisher! publisher-conf))] (fn [] (when stop* @@ -60,8 +59,8 @@ (defn header [cmd] (println - (format - " + (format + " ============================================================ ---==| B A D - B O Y |==--- @@ -77,13 +76,13 @@ Killer-run : %s group, rate: %s ============================================================ " (version) - (java.util.Date.) - (boolean (or (:dry-run cmd) (System/getenv "DRY_RUN"))) - (pr-str (:targets cmd)) - (pr-str (:killer-run cmd)) - (if (:killer-run cmd) - (get-in core/DEFAULT-CONFIG [:groups (:killer-run cmd) :attack-rate] "???") - "none")))) + (java.util.Date.) + (boolean (or (:dry-run cmd) (System/getenv "DRY_RUN"))) + (pr-str (:targets cmd)) + (pr-str (:killer-run cmd)) + (if (:killer-run cmd) + (get-in core/DEFAULT-CONFIG [:groups (:killer-run cmd) :attack-rate] "???") + "none")))) @@ -122,8 +121,8 @@ Killer-run : %s group, rate: %s (:killer-run cmd) (let [cfg (if (:targets cmd) (assoc-in core/DEFAULT-CONFIG - [:groups (:killer-run cmd) :targets] - (cli/build-filters cmd)) + [:groups (:killer-run cmd) :targets] + (cli/build-filters cmd)) core/DEFAULT-CONFIG) _ (header cmd) stop (start-events-publisher!)]