Skip to content

Commit

Permalink
Merge pull request riemann#695 from riemann/liberror
Browse files Browse the repository at this point in the history
Fixes riemann#374 - Librato error without metric
  • Loading branch information
pyr authored Jul 28, 2016
2 parents dfd1775 + ae0b67e commit f6fcecd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/riemann/librato.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
(:require [clojure.string :as string])
(:use [clj-librato.metrics :only [collate annotate connection-manager
update-annotation]]
[clojure.tools.logging :only [error]]
clojure.math.numeric-tower))

(defn safe-name
Expand All @@ -18,10 +19,12 @@
(defn event->gauge
"Converts an event to a gauge."
[event]
{:name (safe-name (:service event))
:source (safe-name (:host event))
:value (:metric event)
:measure-time (round (:time event))})
(if-not (:metric event)
(error "Can't send events without metrics")
{:name (safe-name (:service event))
:source (safe-name (:host event))
:value (:metric event)
:measure-time (round (:time event))}))

(def event->counter event->gauge)

Expand Down

0 comments on commit f6fcecd

Please sign in to comment.