Skip to content

Commit

Permalink
replace datadog key with statsd key in the config
Browse files Browse the repository at this point in the history
  • Loading branch information
macalimlim committed Apr 3, 2020
1 parent ef95aad commit a15da03
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: clojure

lein: 2.8.1
lein: 2.8.2
jdk:
- openjdk8

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ All Ziggurat configs should be in your `clonfig` `config.edn` under the `:ziggur
:datadog {:host "localhost"
:port [8125 :int]
:enabled [false :bool]}
:statsd {:host "localhost"
:port [8125 :int]
:enabled [false :bool]}
:sentry {:enabled [false :bool]
:dsn "dummy"
:worker-count [5 :int]
Expand Down Expand Up @@ -331,6 +334,7 @@ All Ziggurat configs should be in your `clonfig` `config.edn` under the `:ziggur
* enable.idempotence - When set to 'true', the producer will ensure that exactly one copy of each message is written in the stream. If 'false', producer retries due to broker failures, etc., may write duplicates of the retried message in the stream.

* datadog - The statsd host and port that metrics should be sent to, although the key name is datadog, it supports statsd as well to send metrics.
* statsd - Same as datadog but with a more appropriate name, the :datadog key will be deprecated in the future.
* sentry - Whenever a :failure keyword is returned from the mapper-function or an exception is raised while executing the mapper-function, an event is sent to sentry. You can skip this flow by disabling it.
* rabbit-mq-connection - The details required to make a connection to rabbitmq. We use rabbitmq for the retry mechanism.
* rabbit-mq - The queues that are part of the retry mechanism
Expand Down
3 changes: 3 additions & 0 deletions resources/config.test.ci.edn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
:datadog {:host "localhost"
:port [8125 :int]
:enabled [false :bool]}
:statsd {:host "localhost"
:port [8125 :int]
:enabled [false :bool]}
:sentry {:enabled [false :bool]
:dsn "dummy"
:worker-count [10 :int]
Expand Down
3 changes: 3 additions & 0 deletions resources/config.test.edn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
:datadog {:host "localhost"
:port [8125 :int]
:enabled [false :bool]}
:statsd {:host "localhost"
:port [8125 :int]
:enabled [false :bool]}
:sentry {:enabled [false :bool]
:dsn "dummy"
:worker-count [10 :int]
Expand Down
10 changes: 5 additions & 5 deletions src/ziggurat/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
[mount.core :refer [defstate]]
[ziggurat.util.java-util :as util])
(:gen-class
:name tech.gojek.ziggurat.internal.Config
:methods [^{:static true} [get [String] Object]
^{:static true} [getIn [java.lang.Iterable] Object]]))
:methods [^{:static true} [get [String] Object] ^{:static true} [getIn [java.lang.Iterable] Object]]
:name tech.gojek.ziggurat.internal.Config))

(def config-file "config.edn")

(def default-config {:ziggurat {:nrepl-server {:port 70171}
:datadog {:port 8125
:enabled false}
:statsd {:port 8125
:enabled false}
:sentry {:enabled false
:worker-count 10
:queue-size 10
Expand Down Expand Up @@ -66,7 +67,7 @@

(defstate config
:start (let [config-values-from-env (config-from-env config-file)
app-name (-> config-values-from-env :ziggurat :app-name)]
app-name (-> config-values-from-env :ziggurat :app-name)]
(deep-merge (interpolate-config default-config app-name) config-values-from-env)))

(defn ziggurat-config []
Expand Down Expand Up @@ -97,4 +98,3 @@
(defn -get [^String key]
(let [config-vals (get config (keyword key))]
(java-response config-vals)))

10 changes: 5 additions & 5 deletions src/ziggurat/init.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
[ziggurat.sentry :refer [sentry-reporter]]
[ziggurat.server :as server]
[ziggurat.streams :as streams]
[ziggurat.util.java-util :as util]
[ziggurat.tracer :as tracer])
[ziggurat.tracer :as tracer]
[ziggurat.util.java-util :as util])
(:gen-class
:name tech.gojek.ziggurat.internal.Init
:methods [^{:static true} [init [java.util.Map] void]]))
:methods [^{:static true} [init [java.util.Map] void]]
:name tech.gojek.ziggurat.internal.Init))

(defstate statsd-reporter
:start (metrics/start-statsd-reporter (:datadog (ziggurat-config))
:start (metrics/start-statsd-reporter (get (ziggurat-config) :statsd (:datadog (ziggurat-config))) ;; TODO: remove datadog in the future
(:env (ziggurat-config)))
:stop (metrics/stop-statsd-reporter statsd-reporter))

Expand Down

0 comments on commit a15da03

Please sign in to comment.