Skip to content

Commit

Permalink
Add Graphite instance argument to reporter
Browse files Browse the repository at this point in the history
in case you need to use a non-InetSocketAddress Graphite constructor
  • Loading branch information
taylorwood committed Jun 28, 2017
1 parent 2c1061b commit c7d68d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/source/aggregation.rst
Expand Up @@ -37,6 +37,7 @@ ten seconds.

Optional arguments to graphite/reporter are:

- :graphite
- :host
- :port
- :prefix
Expand All @@ -45,6 +46,11 @@ Optional arguments to graphite/reporter are:
- :duration-unit
- :filter

Note: The :graphite argument allows an existing ``com.codahale.metrics.graphite.Graphite``
instance to be specified. If specified, this instance will be used rather than a new
instance constructed using the :host and :port arguments. This is useful if you need
to supply a specially-constructed Graphite instance.

Sending Metrics to Ganglia
--------------------------

Expand Down
5 changes: 3 additions & 2 deletions metrics-clojure-graphite/src/metrics/reporters/graphite.clj
Expand Up @@ -22,9 +22,10 @@
(defn ^com.codahale.metrics.graphite.GraphiteReporter reporter
([opts]
(reporter default-registry opts))
([^MetricRegistry reg {:keys [host hostname port prefix clock rate-unit duration-unit filter] :as opts
([^MetricRegistry reg {:keys [graphite host hostname port prefix clock rate-unit duration-unit filter] :as opts
:or {port 2003}}]
(let [g (graphite-sender (or host hostname "localhost") port)
(let [g (or graphite
(graphite-sender (or host hostname "localhost") port))
b (builder-for-registry reg)]
(when-let [^String s prefix]
(.prefixedWith b s))
Expand Down

0 comments on commit c7d68d0

Please sign in to comment.