prometheus-metrics-ghc 1.0.0 → 1.0.1
raw patch · 2 files changed
+17/−13 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Prometheus.Metric.GHC: ghcMetricsWithLabels :: LabelPairs -> Metric GHCMetrics
Files
- prometheus-metrics-ghc.cabal +1/−1
- src/Prometheus/Metric/GHC.hs +16/−12
prometheus-metrics-ghc.cabal view
@@ -1,5 +1,5 @@ name: prometheus-metrics-ghc-version: 1.0.0+version: 1.0.1 synopsis: Metrics exposing GHC runtime information for use with prometheus-client. description:
src/Prometheus/Metric/GHC.hs view
@@ -13,6 +13,7 @@ module Prometheus.Metric.GHC ( GHCMetrics , ghcMetrics+, ghcMetricsWithLabels ) where import Control.Applicative ((<$>))@@ -32,10 +33,13 @@ data GHCMetrics = GHCMetrics ghcMetrics :: Metric GHCMetrics-ghcMetrics = Metric (return (GHCMetrics, concat <$> sequence ghcCollectors))+ghcMetrics = ghcMetricsWithLabels [] +ghcMetricsWithLabels :: LabelPairs -> Metric GHCMetrics+ghcMetricsWithLabels labels = Metric (return (GHCMetrics, concat <$> mapM ($ labels) ghcCollectors))+ #if __GLASGOW_HASKELL__ < 804-ghcCollectors :: [IO [SampleGroup]]+ghcCollectors :: [LabelPairs -> IO [SampleGroup]] ghcCollectors = [ showCollector "ghc_sparks"@@ -136,7 +140,7 @@ #else -ghcCollectors :: [IO [SampleGroup]]+ghcCollectors :: [LabelPairs -> IO [SampleGroup]] ghcCollectors = [ statsCollector "ghc_gcs_total"@@ -306,25 +310,25 @@ #if __GLASGOW_HASKELL__ < 804 statsCollector :: Show a- => Text -> Text -> SampleType -> (GCStats -> a) -> IO [SampleGroup]-statsCollector name help sampleType stat = do+ => Text -> Text -> SampleType -> (GCStats -> a) -> LabelPairs -> IO [SampleGroup]+statsCollector name help sampleType stat labels = do statsEnabled <- getGCStatsEnabled if statsEnabled- then showCollector name help sampleType (stat <$> getGCStats)+ then showCollector name help sampleType (stat <$> getGCStats) labels else return [] #else statsCollector :: Show a- => Text -> Text -> SampleType -> (RTSStats -> a) -> IO [SampleGroup]-statsCollector name help sampleType stat = do+ => Text -> Text -> SampleType -> (RTSStats -> a) -> LabelPairs -> IO [SampleGroup]+statsCollector name help sampleType stat labels = do statsEnabled <- getRTSStatsEnabled if statsEnabled- then showCollector name help sampleType (stat <$> getRTSStats)+ then showCollector name help sampleType (stat <$> getRTSStats) labels else return [] #endif -showCollector :: Show a => Text -> Text -> SampleType -> IO a -> IO [SampleGroup]-showCollector name help sampleType ioInt = do+showCollector :: Show a => Text -> Text -> SampleType -> IO a -> LabelPairs -> IO [SampleGroup]+showCollector name help sampleType ioInt labels = do value <- ioInt let info = Info name help let valueBS = BS.fromString $ show value- return [SampleGroup info sampleType [Sample name [] valueBS]]+ return [SampleGroup info sampleType [Sample name labels valueBS]]