ekg-elasticsearch 0.3.0.0 → 0.3.1.0
raw patch · 2 files changed
+12/−3 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ System.Remote.Monitoring.ElasticSearch: [_onError] :: ESOptions -> !(HttpException -> IO ())
- System.Remote.Monitoring.ElasticSearch: ESOptions :: !Text -> !Int -> !Text -> !Bool -> !Text -> !Int -> !Bool -> !Text -> !Text -> ![Text] -> ESOptions
+ System.Remote.Monitoring.ElasticSearch: ESOptions :: !Text -> !Int -> !(HttpException -> IO ()) -> !Text -> !Bool -> !Text -> !Int -> !Bool -> !Text -> !Text -> ![Text] -> ESOptions
Files
System/Remote/Monitoring/ElasticSearch.hs view
@@ -26,6 +26,7 @@ ) where import Control.Concurrent (ThreadId, forkIO, threadDelay)+import Control.Exception (catch) import Control.Lens import Control.Monad (forever, void) import qualified Data.HashMap.Strict as M@@ -38,6 +39,7 @@ import Data.Time.Clock.POSIX (getPOSIXTime) import Data.Time.Format (defaultTimeLocale, formatTime) import Network.HostName (getHostName)+import Network.HTTP.Client (HttpException) import Network.Wreq as Wreq import qualified System.Metrics as Metrics @@ -66,6 +68,9 @@ -- | Server port , _port :: !Int + -- | Error handler+ , _onError :: !(HttpException -> IO ())+ -- | The elasticsearch index to insert into , _indexBase :: !Text @@ -101,6 +106,8 @@ -- -- * @port@ = @8125@ --+-- * @onException@ = @print@+-- -- * @indexBase@ = @metricbeats@ -- -- * @indexByDate@ = @True@@@ -114,6 +121,7 @@ defaultESOptions = ESOptions { _host = "127.0.0.1" , _port = 9200+ , _onError = print , _indexBase = "metricbeat" , _indexByDate = True , _beatName = "ekg"@@ -185,4 +193,5 @@ flushSample store eo = do createBulk <- mkIndex eo bulkEvts <- sampleBeatEvents store eo- void $ Wreq.post (elasticURL eo) $ BulkRequest $ (createBulk,) <$> bulkEvts+ (void $ Wreq.post (elasticURL eo) $ BulkRequest $ (createBulk, ) <$> bulkEvts) `catch`+ (_onError eo)
ekg-elasticsearch.cabal view
@@ -1,5 +1,5 @@ name: ekg-elasticsearch-version: 0.3.0.0+version: 0.3.1.0 synopsis: Push metrics to elasticsearch description: This library lets you push system metrics to a elasticsearch server.@@ -37,4 +37,4 @@ source-repository head type: git- location: https://github.com/cdodev/ekg-elastic.git+ location: https://github.com/cdodev/ekg-elasticsearch.git