ekg-statsd 0.2.4.0 → 0.2.4.1
raw patch · 3 files changed
+20/−6 lines, 3 filesdep ~basenew-uploaderPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGES.md +6/−0
- System/Remote/Monitoring/Statsd.hs +8/−1
- ekg-statsd.cabal +6/−5
CHANGES.md view
@@ -1,3 +1,9 @@+## 0.2.4.1 (2020-05-21)++ * Sanitize metric names by replacing `:` with `_` to adhere to the StatsD+ protocol ([#26](https://github.com/tibbe/ekg-statsd/pull/26)).+ * Add support for GHC 8.10 in base bounds and CI.+ ## 0.2.4.0 (2018-08-01) * Don't rethrow `ThreadKilled` exceptions to the thread that invoked
System/Remote/Monitoring/Statsd.hs view
@@ -13,6 +13,9 @@ -- You probably want to include some of the predefined metrics defined -- in the ekg-core package, by calling e.g. the 'registerGcStats' -- function defined in that package.+--+-- Note that the StatsD protocol does not allow @':'@ in metric names, so+-- any occurrences are replaced by @'_'@. module System.Remote.Monitoring.Statsd ( -- * The statsd syncer@@ -175,9 +178,13 @@ flushSample :: Metrics.Sample -> (B8.ByteString -> IO ()) -> StatsdOptions -> IO () flushSample sample sendSample opts = do forM_ (M.toList sample) $ \ (name, val) ->- let fullName = dottedPrefix <> name <> dottedSuffix+ let fullName = dottedPrefix <> sanitizeName name <> dottedSuffix in flushMetric fullName val where+ sanitizeName = T.map sanitizeChar+ sanitizeChar ':' = '_'+ sanitizeChar c = c+ flushMetric name (Metrics.Counter n) = send "|c" name (show n) flushMetric name (Metrics.Gauge n) = send "|g" name (show n) flushMetric name (Metrics.Distribution d) = sendDistribution name d
ekg-statsd.cabal view
@@ -1,5 +1,5 @@ name: ekg-statsd-version: 0.2.4.0+version: 0.2.4.1 synopsis: Push metrics to statsd description: This library lets you push system metrics to a statsd server.@@ -14,7 +14,8 @@ build-type: Simple extra-source-files: CHANGES.md cabal-version: >=1.10-tested-with: GHC == 8.4.3, GHC == 8.2.2, GHC == 8.0.2,+tested-with: GHC == 8.10.1, GHC == 8.8.3, GHC == 8.6.5,+ GHC == 8.4.4, GHC == 8.2.2, GHC == 8.0.2, GHC == 7.10.3, GHC == 7.8.4, GHC == 7.6.3 library@@ -22,12 +23,12 @@ System.Remote.Monitoring.Statsd build-depends:- base >= 4.5 && < 4.12,+ base >= 4.6 && < 4.15, bytestring < 1.0, ekg-core >= 0.1 && < 1.0,- network < 2.8,+ network < 3.2, text < 1.3,- time < 1.9,+ time < 1.10, unordered-containers < 0.3 default-language: Haskell2010