Hello community,

here is the log from the commit of package ghc-wai-middleware-prometheus for 
openSUSE:Factory checked in at 2017-08-31 21:01:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-wai-middleware-prometheus (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-wai-middleware-prometheus.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-wai-middleware-prometheus"

Thu Aug 31 21:01:24 2017 rev:3 rq:513531 version:0.2.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/ghc-wai-middleware-prometheus/ghc-wai-middleware-prometheus.changes
      2017-06-04 01:56:00.420597890 +0200
+++ 
/work/SRC/openSUSE:Factory/.ghc-wai-middleware-prometheus.new/ghc-wai-middleware-prometheus.changes
 2017-08-31 21:01:27.573298918 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:06:28 UTC 2017 - [email protected]
+
+- Update to version 0.2.0.
+
+-------------------------------------------------------------------

Old:
----
  wai-middleware-prometheus-0.1.1.tar.gz

New:
----
  wai-middleware-prometheus-0.2.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-wai-middleware-prometheus.spec ++++++
--- /var/tmp/diff_new_pack.OXGvh0/_old  2017-08-31 21:01:28.797126967 +0200
+++ /var/tmp/diff_new_pack.OXGvh0/_new  2017-08-31 21:01:28.813124720 +0200
@@ -19,7 +19,7 @@
 %global pkg_name wai-middleware-prometheus
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.1.1
+Version:        0.2.0
 Release:        0
 Summary:        WAI middlware for exposing http://prometheus.io metrics
 License:        Apache-2.0
@@ -28,12 +28,12 @@
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
 BuildRequires:  ghc-Cabal-devel
 BuildRequires:  ghc-bytestring-devel
+BuildRequires:  ghc-clock-devel
 BuildRequires:  ghc-data-default-devel
 BuildRequires:  ghc-http-types-devel
 BuildRequires:  ghc-prometheus-client-devel
 BuildRequires:  ghc-rpm-macros
 BuildRequires:  ghc-text-devel
-BuildRequires:  ghc-time-devel
 BuildRequires:  ghc-wai-devel
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %if %{with tests}

++++++ wai-middleware-prometheus-0.1.1.tar.gz -> 
wai-middleware-prometheus-0.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/wai-middleware-prometheus-0.1.1/src/Network/Wai/Middleware/Prometheus.hs 
new/wai-middleware-prometheus-0.2.0/src/Network/Wai/Middleware/Prometheus.hs
--- 
old/wai-middleware-prometheus-0.1.1/src/Network/Wai/Middleware/Prometheus.hs    
    2017-04-30 00:58:18.000000000 +0200
+++ 
new/wai-middleware-prometheus-0.2.0/src/Network/Wai/Middleware/Prometheus.hs    
    2017-07-02 23:55:13.000000000 +0200
@@ -11,15 +11,16 @@
 ,   metricsApp
 ) where
 
-import Data.Time.Clock (UTCTime, diffUTCTime, getCurrentTime)
 import qualified Data.ByteString.Builder as BS
 import qualified Data.ByteString.Char8 as BS
 import qualified Data.Default as Default
 import Data.Maybe (fromMaybe)
+import Data.Ratio ((%))
 import qualified Data.Text as T
 import qualified Network.HTTP.Types as HTTP
 import qualified Network.Wai as Wai
 import qualified Prometheus as Prom
+import System.Clock (Clock(..), TimeSpec, diffTimeSpec, getTime, toNanoSecs)
 
 
 -- | Settings that control the behavior of the Prometheus middleware.
@@ -48,11 +49,11 @@
 {-# NOINLINE requestLatency #-}
 -- XXX: https://prometheus.io/docs/practices/naming/ says this should be
 -- _seconds, not _microseconds.
-requestLatency :: Prom.Metric (Prom.Vector Prom.Label3 Prom.Summary)
+requestLatency :: Prom.Metric (Prom.Vector Prom.Label3 Prom.Histogram)
 requestLatency = Prom.unsafeRegisterIO $ Prom.vector ("handler", "method", 
"status_code")
-                                       $ Prom.summary info 
Prom.defaultQuantiles
-    where info = Prom.Info "http_request_duration_microseconds"
-                           "The HTTP request latencies in microseconds."
+                                       $ Prom.histogram info 
Prom.defaultBuckets
+    where info = Prom.Info "http_request_duration_seconds"
+                           "The HTTP request latencies in seconds."
 
 -- | Instrument a WAI app with the default WAI metrics.
 --
@@ -63,12 +64,12 @@
               -> Wai.Application  -- ^ The app to instrument
               -> Wai.Application  -- ^ The instrumented app
 instrumentApp handler app req respond = do
-    start <- getCurrentTime
+    start <- getTime Monotonic
     app req $ \res -> do
-        end <- getCurrentTime
+        end <- getTime Monotonic
         let method = Just $ BS.unpack (Wai.requestMethod req)
         let status = Just $ show (HTTP.statusCode (Wai.responseStatus res))
-        observeMicroSeconds handler method status start end
+        observeSeconds handler method status start end
         respond res
 
 -- | Instrument an IO action with timing metrics. This function can be used if
@@ -82,15 +83,15 @@
              -> IO a    -- ^ The IO action to instrument
              -> IO a    -- ^ The instrumented app
 instrumentIO label io = do
-    start  <- getCurrentTime
+    start  <- getTime Monotonic
     result <- io
-    end    <- getCurrentTime
-    observeMicroSeconds label Nothing Nothing start end
+    end    <- getTime Monotonic
+    observeSeconds label Nothing Nothing start end
     return result
 
-observeMicroSeconds :: String -> Maybe String -> Maybe String -> UTCTime -> 
UTCTime -> IO ()
-observeMicroSeconds handler method status start end = do
-    let latency = fromRational $ toRational (end `diffUTCTime` start) * 1000000
+observeSeconds :: String -> Maybe String -> Maybe String -> TimeSpec -> 
TimeSpec -> IO ()
+observeSeconds handler method status start end = do
+    let latency = fromRational $ toRational (toNanoSecs (end `diffTimeSpec` 
start) % 1000000000)
     Prom.withLabel (handler, fromMaybe "" method, fromMaybe "" status)
                    (Prom.observe latency)
                    requestLatency
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/wai-middleware-prometheus-0.1.1/wai-middleware-prometheus.cabal 
new/wai-middleware-prometheus-0.2.0/wai-middleware-prometheus.cabal
--- old/wai-middleware-prometheus-0.1.1/wai-middleware-prometheus.cabal 
2017-04-30 23:30:12.000000000 +0200
+++ new/wai-middleware-prometheus-0.2.0/wai-middleware-prometheus.cabal 
2017-07-03 00:06:02.000000000 +0200
@@ -1,5 +1,5 @@
 name:                wai-middleware-prometheus
-version:             0.1.1
+version:             0.2.0
 synopsis:
     WAI middlware for exposing http://prometheus.io metrics.
 description:
@@ -26,11 +26,11 @@
   build-depends:
       base               >=4.7 && <5
     , bytestring         >=0.9
+    , clock
     , data-default
     , http-types
     , prometheus-client
     , text               >=0.11
-    , time
     , wai                >=3.0
   ghc-options: -Wall
 


Reply via email to