                  :metric      self-time
                  :ttl         (* 2 dt)
                  :tags        tags}))
-         (concat [{:service (str prefix "profiler rate")
+         (concat [{:host    host
+                   :service (str prefix "profiler rate")
                    :state   "ok"
                    :metric  rate
                    :ttl     (* 2 dt)

            [riemann.client.http :as client])
  (:import (java.lang StackTraceElement)))

(defn http-client
  [& args]
  (apply client/client args))

(def tags
  ["jvm" "profile"])

(defn report
  "Send information about stack statistics to Riemann."
  [client dt prefix stats]
  (let [{:keys [rate sample]} stats]
    (->> sample
         stack/hotspots
         (map (fn [[^StackTraceElement frame
                    {:keys [self-time top-trace top-trace-time]}]]
                {:service     (str prefix "profiler fn "
                                   (.getClassName frame) " "
                                   (.getMethodName frame))
                 :file        (.getFileName frame)

  (let [dt (or (:dt opts) 5)]
    (stack/start (or (:load opts) 0.02)
                 dt
                 (partial report (:client opts)
                          dt
                          (:host opts)
                          (or (:prefix opts) "")))))

(defn stop!
  "Stop profiling."
