kiroku-metrics 0.1.0.10 → 0.2.0.0
raw patch · 9 files changed
+201/−63 lines, 9 filesdep ~kiroku-clidep ~kiroku-storePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: kiroku-cli, kiroku-store
API changes (from Hackage documentation)
+ Kiroku.Metrics.Types: [publisherDecodeFailures] :: LifecycleCounters -> !Int64
+ Kiroku.Metrics.Types: [subscriptionHandlerStalls] :: LifecycleCounters -> !Int64
+ Kiroku.Metrics.Types: [subscriptionsStoppedUndecodable] :: LifecycleCounters -> !Int64
- Kiroku.Metrics.Types: LifecycleCounters :: !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> LifecycleCounters
+ Kiroku.Metrics.Types: LifecycleCounters :: !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> LifecycleCounters
Files
- CHANGELOG.md +19/−0
- LICENSE +11/−0
- kiroku-metrics.cabal +54/−53
- src/Kiroku/Metrics/Collector.hs +13/−0
- src/Kiroku/Metrics/Prometheus.hs +3/−0
- src/Kiroku/Metrics/Types.hs +6/−0
- src/Kiroku/Metrics/WebSocket.hs +20/−8
- test/Test/CollectorSpec.hs +48/−1
- test/Test/WebSocketSpec.hs +27/−1
CHANGELOG.md view
@@ -1,5 +1,24 @@ # Revision history for kiroku-metrics +## 0.2.0.0 — 2026-10-10++### Breaking Changes++* `LifecycleCounters` adds `publisherDecodeFailures`,+ `subscriptionsStoppedUndecodable` and `subscriptionHandlerStalls`.++### New Features++* JSON and Prometheus distinguish typed publisher decode failures and+ undecodable stops from programming failures. JSON adds+ `subscription_handler_stalls`; Prometheus adds+ `kiroku_subscription_handler_stalls_total`. Advisory warnings do not advance+ the collector's subscription position.++### Other Changes++* Require `kiroku-store ^>=0.10.0.0` and `kiroku-cli ^>=0.2.0.9`.+ ## 0.1.0.10 -- 2026-09-25 ### Other Changes
+ LICENSE view
@@ -0,0 +1,11 @@+Copyright (c) 2026 Nadeem Bitar.++Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:++1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.++3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
kiroku-metrics.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: kiroku-metrics-version: 0.1.0.10+version: 0.2.0.0 synopsis: Metrics, health, and event-streaming HTTP endpoints for Kiroku @@ -13,6 +13,7 @@ author: Nadeem Bitar maintainer: nadeem@gmail.com license: BSD-3-Clause+license-file: LICENSE build-type: Simple category: Database, Eventing, Observability extra-doc-files: CHANGELOG.md@@ -51,25 +52,25 @@ Kiroku.Metrics.WebSocket build-depends:- , aeson >=2.1 && <2.3- , async >=2.2 && <2.3- , base >=4.18 && <5- , bytestring >=0.11 && <0.13- , containers >=0.6 && <0.8- , hasql >=1.10 && <1.11- , hasql-pool >=1.2 && <1.5- , http-types >=0.12 && <0.13- , kiroku-cli ^>=0.2.0.8- , kiroku-store ^>=0.9.0.1- , stm >=2.5 && <2.6- , text >=2.0 && <2.2- , time >=1.12 && <1.15- , uuid >=1.3 && <1.4- , vector >=0.13 && <0.14- , wai >=3.2 && <3.3- , wai-websockets >=3.0 && <3.1- , warp >=3.4 && <3.5- , websockets >=0.13 && <0.14+ , aeson >=2.1 && <2.3+ , async >=2.2 && <2.3+ , base >=4.18 && <5+ , bytestring >=0.11 && <0.13+ , containers >=0.6 && <0.8+ , hasql >=1.10 && <1.11+ , hasql-pool >=1.2 && <1.5+ , http-types >=0.12 && <0.13+ , kiroku-cli ^>=0.2.0.9+ , kiroku-store ^>=0.10.0.0+ , stm >=2.5 && <2.6+ , text >=2.0 && <2.2+ , time >=1.12 && <1.15+ , uuid >=1.3 && <1.4+ , vector >=0.13 && <0.14+ , wai >=3.2 && <3.3+ , wai-websockets >=3.0 && <3.1+ , warp >=3.4 && <3.5+ , websockets >=0.13 && <0.14 hs-source-dirs: src @@ -94,21 +95,21 @@ buildable: False build-depends:- , aeson >=2.1 && <2.3- , async >=2.2 && <2.3- , base >=4.18 && <5- , bytestring >=0.11 && <0.13- , containers >=0.6 && <0.8- , http-client >=0.7 && <0.8- , http-types >=0.12 && <0.13+ , aeson >=2.1 && <2.3+ , async >=2.2 && <2.3+ , base >=4.18 && <5+ , bytestring >=0.11 && <0.13+ , containers >=0.6 && <0.8+ , http-client >=0.7 && <0.8+ , http-types >=0.12 && <0.13 , kiroku-metrics- , kiroku-store ^>=0.9.0.1+ , kiroku-store ^>=0.10.0.0 , kiroku-test-support ^>=0.1- , lens >=5.2 && <5.4- , scientific >=0.3 && <0.4- , stm >=2.5 && <2.6- , text >=2.0 && <2.2- , websockets >=0.13 && <0.14+ , lens >=5.2 && <5.4+ , scientific >=0.3 && <0.4+ , stm >=2.5 && <2.6+ , text >=2.0 && <2.2+ , websockets >=0.13 && <0.14 test-suite kiroku-metrics-test import: common@@ -124,25 +125,25 @@ hs-source-dirs: test ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends:- , aeson >=2.1 && <2.3- , async >=2.2 && <2.3- , base >=4.18 && <5- , bytestring >=0.11 && <0.13- , containers >=0.6 && <0.8- , generic-lens >=2.2 && <2.4- , hasql >=1.10 && <1.11- , hasql-pool >=1.2 && <1.5- , hspec >=2.10 && <2.12- , http-client >=0.7 && <0.8- , http-types >=0.12 && <0.13- , kiroku-cli ^>=0.2.0.8+ , aeson >=2.1 && <2.3+ , async >=2.2 && <2.3+ , base >=4.18 && <5+ , bytestring >=0.11 && <0.13+ , containers >=0.6 && <0.8+ , generic-lens >=2.2 && <2.4+ , hasql >=1.10 && <1.11+ , hasql-pool >=1.2 && <1.5+ , hspec >=2.10 && <2.12+ , http-client >=0.7 && <0.8+ , http-types >=0.12 && <0.13+ , kiroku-cli ^>=0.2.0.9 , kiroku-metrics- , kiroku-store ^>=0.9.0.1+ , kiroku-store ^>=0.10.0.0 , kiroku-test-support- , lens >=5.2 && <5.4- , scientific >=0.3 && <0.4- , stm >=2.5 && <2.6- , text >=2.0 && <2.2- , uuid >=1.3 && <1.4- , warp >=3.4 && <3.5- , websockets >=0.13 && <0.14+ , lens >=5.2 && <5.4+ , scientific >=0.3 && <0.4+ , stm >=2.5 && <2.6+ , text >=2.0 && <2.2+ , uuid >=1.3 && <1.4+ , warp >=3.4 && <3.5+ , websockets >=0.13 && <0.14
src/Kiroku/Metrics/Collector.hs view
@@ -52,6 +52,7 @@ ) import Kiroku.Store.Subscription.Types ( CheckpointInitialization (..),+ ConsumerGroupSizeMismatch (..), SubscriptionCheckpointKey (..), SubscriptionCheckpointMissing (..), SubscriptionName (..),@@ -90,6 +91,8 @@ , notifierReconnected = 0 , publisherPoolErrors = 0 , publisherLoopErrors = 0+ , publisherDecodeFailures = 0+ , subscriptionHandlerStalls = 0 , subscriptionDbErrorsLoad = 0 , subscriptionDbErrorsFetch = 0 , subscriptionDbErrorsSave = 0@@ -104,6 +107,7 @@ , subscriptionsStoppedCancelled = 0 , subscriptionsStoppedOverflow = 0 , subscriptionsStoppedCrashed = 0+ , subscriptionsStoppedUndecodable = 0 , liveFetches = 0 , batchesDelivered = 0 , eventsDelivered = 0@@ -168,6 +172,10 @@ bumpCounters km (\c -> c{notifierReconnected = c.notifierReconnected + 1}) KirokuEventPublisherPoolError _ -> bumpCounters km (\c -> c{publisherPoolErrors = c.publisherPoolErrors + 1})+ KirokuEventSubscriptionHandlerStalled{} ->+ bumpCounters km (\c -> c{subscriptionHandlerStalls = c.subscriptionHandlerStalls + 1})+ KirokuEventPublisherDecodeFailed{} ->+ bumpCounters km (\c -> c{publisherDecodeFailures = c.publisherDecodeFailures + 1}) KirokuEventPublisherLoopError _ -> bumpCounters km (\c -> c{publisherLoopErrors = c.publisherLoopErrors + 1}) KirokuEventSubscriptionDbError name phase _ _ -> do@@ -179,6 +187,9 @@ InitializedCheckpoint _ (SubscriptionCheckpointKey name _) pos -> recordPosition km name pos KirokuEventSubscriptionCheckpointMissing (SubscriptionCheckpointMissing (SubscriptionCheckpointKey name _)) _ -> touchSub km name id+ KirokuEventSubscriptionTargetBound name _ _ -> touchSub km name id+ KirokuEventSubscriptionGroupSizeMismatch (ConsumerGroupSizeMismatch name _ _) _ ->+ touchSub km name id KirokuEventSubscriptionStarted name pos _ -> do bumpCounters km (\c -> c{subscriptionsStarted = c.subscriptionsStarted + 1}) recordPosition km name pos@@ -240,6 +251,7 @@ StopCancelled -> c{subscriptionsStoppedCancelled = c.subscriptionsStoppedCancelled + 1} StopOverflowed -> c{subscriptionsStoppedOverflow = c.subscriptionsStoppedOverflow + 1} StopWorkerCrashed _ -> c{subscriptionsStoppedCrashed = c.subscriptionsStoppedCrashed + 1}+ StopUndecodable _ -> c{subscriptionsStoppedUndecodable = c.subscriptionsStoppedUndecodable + 1} stopReasonText :: SubscriptionStopReason -> Text stopReasonText = \case@@ -247,6 +259,7 @@ StopCancelled -> "cancelled" StopOverflowed -> "overflow" StopWorkerCrashed _ -> "crashed"+ StopUndecodable _ -> "undecodable" -- | Apply a single pool 'Observation' to the collector state. applyObservation :: KirokuMetrics -> Observation -> STM ()
src/Kiroku/Metrics/Prometheus.hs view
@@ -64,6 +64,8 @@ [ metric "kiroku_notifier_reconnecting_total" "counter" "Notifier reconnection attempts started." c.notifierReconnecting , metric "kiroku_notifier_reconnected_total" "counter" "Notifier reconnections completed." c.notifierReconnected , metric "kiroku_publisher_pool_errors_total" "counter" "EventPublisher read-query pool errors." c.publisherPoolErrors+ , metric "kiroku_subscription_handler_stalls_total" "counter" "Advisory handler stall warnings." c.subscriptionHandlerStalls+ , metric "kiroku_publisher_decode_failures_total" "counter" "Typed undecodable events broadcast by the publisher." c.publisherDecodeFailures , metric "kiroku_publisher_loop_errors_total" "counter" "EventPublisher callback or broadcast loop errors." c.publisherLoopErrors , help "kiroku_subscription_db_errors_by_phase_total" "Subscription database errors by phase." , typ "kiroku_subscription_db_errors_by_phase_total" "counter"@@ -83,6 +85,7 @@ , labelled "kiroku_subscriptions_stopped_total" "reason" "cancelled" c.subscriptionsStoppedCancelled , labelled "kiroku_subscriptions_stopped_total" "reason" "overflow" c.subscriptionsStoppedOverflow , labelled "kiroku_subscriptions_stopped_total" "reason" "crashed" c.subscriptionsStoppedCrashed+ , labelled "kiroku_subscriptions_stopped_total" "reason" "undecodable" c.subscriptionsStoppedUndecodable , metric "kiroku_live_fetches_total" "counter" "Live-mode database fetches." c.liveFetches , metric "kiroku_batches_delivered_total" "counter" "Non-empty batches delivered to handlers." c.batchesDelivered , metric "kiroku_events_delivered_total" "counter" "Events delivered to handlers." c.eventsDelivered
src/Kiroku/Metrics/Types.hs view
@@ -66,6 +66,8 @@ , notifierReconnected :: !Int64 , publisherPoolErrors :: !Int64 , publisherLoopErrors :: !Int64+ , publisherDecodeFailures :: !Int64+ , subscriptionHandlerStalls :: !Int64 , subscriptionDbErrorsLoad :: !Int64 , subscriptionDbErrorsFetch :: !Int64 , subscriptionDbErrorsSave :: !Int64@@ -80,6 +82,7 @@ , subscriptionsStoppedCancelled :: !Int64 , subscriptionsStoppedOverflow :: !Int64 , subscriptionsStoppedCrashed :: !Int64+ , subscriptionsStoppedUndecodable :: !Int64 , liveFetches :: !Int64 -- ^ Count of live-mode DB fetches ('KirokuEventSubscriptionFetched'). , batchesDelivered :: !Int64@@ -129,6 +132,8 @@ , "notifier_reconnected" .= c.notifierReconnected , "publisher_pool_errors" .= c.publisherPoolErrors , "publisher_loop_errors" .= c.publisherLoopErrors+ , "publisher_decode_failures" .= c.publisherDecodeFailures+ , "subscription_handler_stalls" .= c.subscriptionHandlerStalls , "subscription_db_errors_load" .= c.subscriptionDbErrorsLoad , "subscription_db_errors_fetch" .= c.subscriptionDbErrorsFetch , "subscription_db_errors_save" .= c.subscriptionDbErrorsSave@@ -143,6 +148,7 @@ , "subscriptions_stopped_cancelled" .= c.subscriptionsStoppedCancelled , "subscriptions_stopped_overflow" .= c.subscriptionsStoppedOverflow , "subscriptions_stopped_crashed" .= c.subscriptionsStoppedCrashed+ , "subscriptions_stopped_undecodable" .= c.subscriptionsStoppedUndecodable , "live_fetches" .= c.liveFetches , "batches_delivered" .= c.batchesDelivered , "events_delivered" .= c.eventsDelivered
src/Kiroku/Metrics/WebSocket.hs view
@@ -88,6 +88,7 @@ readCategory, runStoreIO, )+import Kiroku.Store.Settings (DecodedBatch (..), DecodedEvent (..), decodedEventRecorded) import Kiroku.Store.Subscription.EventPublisher ( SubscriberStatus (..), publisherPosition,@@ -409,17 +410,28 @@ broadcastLoop :: WS.Connection -> -- | broadcast queue- TBQueue (Vector RecordedEvent) ->+ TBQueue DecodedBatch -> TVar SubscriberStatus -> (RecordedEvent -> Bool) -> IO ()-broadcastLoop conn queue statusVar keep = forever $ do- batch <- atomically (readTBQueue queue)- sendEvents conn (V.filter keep batch)- status <- atomically (readTVar statusVar)- case status of- Overflowed -> sendMsg conn (ErrorMsg "event stream overflowed; some events dropped")- _ -> pure ()+broadcastLoop conn queue statusVar keep = go+ where+ go = do+ batch <- atomically (readTBQueue queue)+ let decoded = case batch of+ UnchangedBatch events -> Right (V.filter keep events)+ TransformedBatch events -> V.mapM unwrap (V.filter (keep . decodedEventRecorded) events)+ unwrap (Decoded event) = Right event+ unwrap (Undecodable _ failure) = Left failure+ case decoded of+ Left failure -> sendMsg conn (ErrorMsg (T.pack ("live decode error: " <> show failure)))+ Right events -> do+ sendEvents conn events+ status <- atomically (readTVar statusVar)+ case status of+ Overflowed -> sendMsg conn (ErrorMsg "event stream overflowed; some events dropped")+ _ -> pure ()+ go {- | DB-driven category live loop. Mirrors the subscription worker's @liveLoopDbDriven@: gate on the publisher advancing past the /last observed/
test/Test/CollectorSpec.hs view
@@ -8,9 +8,14 @@ import Control.Concurrent.STM (STM) import Control.Exception (SomeException, toException) import Control.Monad (forM_)+import Data.Aeson (Value (..), toJSON)+import Data.Aeson.KeyMap qualified as KM+import Data.ByteString.Lazy.Char8 qualified as LBS+import Data.List (isInfixOf) import Data.Map.Strict qualified as Map import Data.UUID (UUID, fromWords) import Hasql.Pool (UsageError (..))+import Kiroku.Metrics.Prometheus (renderPrometheus) import Test.Hspec import Kiroku.Metrics (@@ -34,13 +39,14 @@ SubscriptionStopReason (..), ) import Kiroku.Store.Observability (SubscriptionDeliveryPhase (..))+import Kiroku.Store.Settings (DecodeFailure (..)) import Kiroku.Store.Subscription.Types ( CheckpointInitialization (..), MissingCheckpointPolicy (..), SubscriptionCheckpointKey (..), SubscriptionName (..), )-import Kiroku.Store.Types (GlobalPosition (..))+import Kiroku.Store.Types (EventId (..), GlobalPosition (..)) {- | A collector whose fake store readers report the given global position and active-subscriber count, fed the given scripted events and observations.@@ -98,6 +104,47 @@ [] snap.counters.publisherPoolErrors `shouldBe` 1 snap.counters.publisherLoopErrors `shouldBe` 2++ it "counts typed decode failures and undecodable stops separately from programming errors" $ do+ let eid = EventId (uuidN 3)+ failure = DecodeFailure eid "cannot decrypt"+ snap <-+ runScript+ (pure (GlobalPosition 4))+ (pure 0)+ [ KirokuEventPublisherDecodeFailed (GlobalPosition 3) eid failure+ , KirokuEventSubscriptionStopped sub (GlobalPosition 2) (StopUndecodable failure) NonGroup+ ]+ []+ case toJSON snap.counters of+ Object fields -> do+ KM.lookup "publisher_decode_failures" fields `shouldBe` Just (Number 1)+ KM.lookup "subscriptions_stopped_undecodable" fields `shouldBe` Just (Number 1)+ other -> expectationFailure ("expected lifecycle object, got " <> show other)+ let exposition = LBS.unpack (renderPrometheus snap)+ exposition `shouldSatisfy` isInfixOf "kiroku_publisher_decode_failures_total 1"+ exposition `shouldSatisfy` isInfixOf "kiroku_subscriptions_stopped_total{reason=\"undecodable\"} 1"+ snap.counters.publisherDecodeFailures `shouldBe` 1+ snap.counters.publisherLoopErrors `shouldBe` 0+ snap.counters.subscriptionsStoppedUndecodable `shouldBe` 1+ snap.counters.subscriptionsStoppedCrashed `shouldBe` 0+ (Map.lookup "p" snap.subscriptions >>= (.lastStopReason)) `shouldBe` Just "undecodable"++ it "counts advisory stalls without advancing the subscription position" $ do+ snap <-+ runScript+ (pure (GlobalPosition 12))+ (pure 1)+ [ KirokuEventSubscriptionStarted sub (GlobalPosition 2) NonGroup+ , KirokuEventSubscriptionHandlerStalled sub (GlobalPosition 3) (EventId (uuidN 3)) 0.2 NonGroup+ ]+ []+ snap.counters.subscriptionHandlerStalls `shouldBe` 1+ (Map.lookup "p" snap.subscriptions >>= Just . (.lastKnownPosition)) `shouldBe` Just 2+ case toJSON snap.counters of+ Object fields -> KM.lookup "subscription_handler_stalls" fields `shouldBe` Just (Number 1)+ other -> expectationFailure ("expected lifecycle object, got " <> show other)+ LBS.unpack (renderPrometheus snap) `shouldSatisfy` isInfixOf "kiroku_subscription_handler_stalls_total 1" it "records subscription position and derives lag from the global position" $ do snap <-
test/Test/WebSocketSpec.hs view
@@ -62,12 +62,14 @@ EventType (..), ExpectedVersion (..), KirokuStore (..),+ RecordedEvent (..), StreamName (..), appendToStream, defaultConnectionSettings, runStoreIO, withStore, )+import Kiroku.Store.Settings (DecodeFailure (..)) import Kiroku.Store.Subscription.EventPublisher (EventPublisher (..), publisherPosition, subscribePublisher) import Kiroku.Store.Subscription.Types (OverflowPolicy (..)) import Kiroku.Store.Types (GlobalPosition (..))@@ -119,6 +121,30 @@ stopMetricsServer srv + it "reports a typed live decode failure and releases the publisher queue" $+ withMigratedTestDatabase $ \connStr -> do+ storeVar <- newTVarIO Nothing+ km <- newKirokuMetricsWith (readPosition storeVar) (readSubscribers storeVar)+ let settings =+ defaultConnectionSettings connStr+ & #storeSettings . #decodeHook .~ Just (\event -> pure (Left (DecodeFailure event.eventId "cannot decrypt")))+ withStore settings $ \store -> do+ atomically (writeTVar storeVar (Just store))+ srv <- startMetricsServerWithStore (defaultConfig{port = 0}) km store []+ result <- requireJust "ws decode failure timed out" $+ timeout 15_000_000 $+ WS.runClient "127.0.0.1" srv.serverPort "/ws/events" $ \conn -> do+ sendJSON conn (object ["type" .= ("subscribe_events" :: Text)])+ _ <- waitForType conn "event_stream_started"+ appendStoreEvents store (StreamName "ws-decode") 1+ waitForType conn "error"+ case result of+ Object fields -> KM.lookup "type" fields `shouldBe` Just (String "error")+ other -> expectationFailure ("expected error frame, got " <> show other)+ waitForSubscriberCount store 0 5_000_000+ waitForPublisherPosition store 1 5_000_000+ stopMetricsServer srv+ it "replays history from a position then continues live without duplicating the boundary" $ withMigratedTestDatabase $ \connStr -> do storeVar <- newTVarIO Nothing@@ -168,7 +194,7 @@ tid <- myThreadId when (tid == asyncThreadId (publisherThread s.publisher)) $ atomically (readTVar gateVar >>= check)- pure e+ pure (Right e) settings = defaultConnectionSettings connStr & #storeSettings . #decodeHook .~ Just publisherGate