ekg 0.4.0.5 → 0.4.0.6
raw patch · 3 files changed
+38/−8 lines, 3 filesdep ~basedep ~filepathdep ~timePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, filepath, time
API changes (from Hackage documentation)
Files
- CHANGES.md +8/−0
- System/Remote/Monitoring.hs +26/−4
- ekg.cabal +4/−4
CHANGES.md view
@@ -1,3 +1,11 @@+## 0.4.0.6 (2015-05-08)++ * Support GHC 7.10.+ + * Re-raise exceptions in the server thread in the main thread.+ + * Improve Windows support.+ ## 0.4.0.5 (2014-11-30) * Support network-2.6.
System/Remote/Monitoring.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE CPP, OverloadedStrings #-} -- | This module provides remote monitoring of a running process over -- HTTP. It can be used to run an HTTP server that provides both a@@ -43,7 +43,7 @@ , getDistribution ) where -import Control.Concurrent (ThreadId, forkIO)+import Control.Concurrent (ThreadId, myThreadId, throwTo) import qualified Data.ByteString as S import Data.Int (Int64) import qualified Data.Text as T@@ -56,7 +56,15 @@ import qualified System.Metrics.Gauge as Gauge import qualified System.Metrics.Label as Label import System.Remote.Snap+import Network.Socket (withSocketsDo) +#if __GLASGOW_HASKELL__ >= 706+import Control.Concurrent (forkFinally)+#else+import Control.Concurrent (forkIO)+import Control.Exception (SomeException, mask, try)+#endif+ -- $configuration -- -- To make full use out of this this module you must first enable GC@@ -203,7 +211,7 @@ -- either a numeric network address (dotted quad for IPv4, -- colon-separated hex for IPv6) or a hostname (e.g. \"localhost\".) -- The client can control the Content-Type used in responses by--- setting the Accept header. At the moment three content types are+-- setting the Accept header. At the moment two content types are -- available: \"application\/json\" and \"text\/html\". -- -- Registers the following counter, used by the UI:@@ -223,7 +231,11 @@ -> IO Server forkServerWith store host port = do Metrics.registerCounter "ekg.server_timestamp_ms" getTimeMs store- tid <- forkIO $ startServer store host port+ me <- myThreadId+ tid <- withSocketsDo $ forkFinally (startServer store host port) $ \ r ->+ case r of+ Left e -> throwTo me e+ Right _ -> return () return $! Server tid store where getTimeMs :: IO Int64@@ -264,3 +276,13 @@ -> IO Distribution.Distribution getDistribution name server = Metrics.createDistribution name (serverMetricStore server)++------------------------------------------------------------------------+-- Backwards compatibility shims++#if __GLASGOW_HASKELL__ < 706+forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId+forkFinally action and_then =+ mask $ \restore ->+ forkIO $ try (restore action) >>= and_then+#endif
ekg.cabal view
@@ -1,5 +1,5 @@ name: ekg-version: 0.4.0.5+version: 0.4.0.6 synopsis: Remote monitoring of processes description: This library lets you remotely monitor a running process over HTTP.@@ -38,15 +38,15 @@ build-depends: aeson < 0.9,- base >= 4.5 && < 4.8,+ base >= 4.5 && < 4.9, bytestring < 1.0, ekg-core >= 0.1 && < 0.2,- filepath < 1.4,+ filepath < 1.5, network < 2.7, snap-core < 0.10, snap-server < 0.10, text < 1.3,- time < 1.5,+ time < 1.6, transformers < 0.5, unordered-containers < 0.3