packages feed

prometheus-wai 0.2.0.0 → 0.2.0.1

raw patch · 3 files changed

+13/−7 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,5 +1,12 @@ # Changelog +## [0.2.0.1] - 2025-12-18++### Changed++* Fixed that the caching mechanism was completely broken: it would never+  refresh the samples, ever.+ ## [0.2.0.0] - 2025-12-17  ### Added
prometheus-wai.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           prometheus-wai-version:        0.2.0.0+version:        0.2.0.1 description:    Prometheus metrics for WAI applications homepage:       https://github.com/NorfairKing/prometheus-wai#readme bug-reports:    https://github.com/NorfairKing/prometheus-wai/issues
src/System/Metrics/Prometheus/Wai/Middleware.hs view
@@ -167,15 +167,14 @@         sampleWithCache = case mCache of           Nothing -> metricsEndpointSample           Just (cacheDurationNanos, var) -> do-            modifyMVar var $ \lastTup@(lastSampleTime, lastSample) -> do-              now <- getMonotonicTimeNSec+            now <- getMonotonicTimeNSec+            modifyMVar var $ \lastTup@(lastSampleTime, lastSample) ->               if now - lastSampleTime < cacheDurationNanos                 then pure (lastTup, lastSample)                 else do-                  newSample <- metricsEndpointSample-                  let combinedSample = combineRegistrySample lastSample newSample-                  let newTup = (now, combinedSample)-                  pure (newTup, combinedSample)+                  freshSample <- metricsEndpointSample+                  let freshTup = (now, freshSample)+                  pure (freshTup, freshSample)      pure $ \application request sendResponse ->       if Request.rawPathInfo request == metricsEndpointPath