Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Network/DogStatsd.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ decrement client stat = count client stat (-1)
count :: UdpClient -> Stat -> Int -> Tags -> IO ()
count client stat value tags = void . send client $ fmtDogStatsdDatagram stat value Count tags

gauge :: UdpClient -> Stat -> Int -> Tags -> IO ()
gauge :: (Show a, Num a) => UdpClient -> Stat -> a -> Tags -> IO ()
gauge client stat value tags = void . send client $ fmtDogStatsdDatagram stat value Gauge tags

timing :: UdpClient -> Stat -> Millisecond -> Tags -> IO ()
timing client stat value tags = void . send client $ fmtDogStatsdDatagram stat (fromIntegral value) Timing tags

histogram :: UdpClient -> Stat -> Int -> Tags -> IO ()
histogram :: (Show a, Num a) => UdpClient -> Stat -> a -> Tags -> IO ()
histogram client stat value tags = void . send client $ fmtDogStatsdDatagram stat value Histogram tags

fmtTag :: (Name, Value) -> String
fmtTag (a, "") = a
fmtTag (a, b) = a ++ ":" ++ b

fmtDogStatsdDatagram :: Stat -> Int -> Type -> Tags -> String
fmtDogStatsdDatagram :: (Show a, Num a) => Stat -> a -> Type -> Tags -> String
fmtDogStatsdDatagram stat value statType [] = fmtDatagram stat value statType
fmtDogStatsdDatagram stat value statType tags =
let statsdDatagram = fmtDatagram stat value statType
Expand Down
6 changes: 3 additions & 3 deletions src/Network/Statsd.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ decrement client stat = count client stat (-1)
count :: UdpClient -> Stat -> Int -> IO ()
count client stat value = void . send client $ fmtDatagram stat value Count

gauge :: UdpClient -> Stat -> Int -> IO ()
gauge :: (Show a, Num a) => UdpClient -> Stat -> a -> IO ()
gauge client stat value = void . send client $ fmtDatagram stat value Gauge

timing :: UdpClient -> Stat -> Millisecond -> IO ()
timing client stat value = void . send client $ fmtDatagram stat (fromIntegral value) Timing

histogram :: UdpClient -> Stat -> Int -> IO ()
histogram :: (Show a, Num a) => UdpClient -> Stat -> a -> IO ()
histogram client stat value = void . send client $ fmtDatagram stat value Histogram

fmtDatagram :: Stat -> Int -> Type -> String
fmtDatagram:: (Show a, Num a) => Stat -> a -> Type -> String
fmtDatagram stat value statType = printf "%s:%s|%s" stat (show value) (show statType)
2 changes: 1 addition & 1 deletion statsd-client.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: statsd-client
version: 0.3.0.0
version: 0.3.0.1
cabal-version: >=1.10
build-type: Simple
license: MIT
Expand Down