Skip to content

Commit

Permalink
refactor(sut): Dumblog, refactor Metrics to own module
Browse files Browse the repository at this point in the history
  • Loading branch information
symbiont-daniel-gustafsson committed Feb 4, 2022
1 parent 5c1aa35 commit 9395acf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
17 changes: 1 addition & 16 deletions src/sut/dumblog/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,7 @@ import Journal.Internal.Metrics (MetricsSchema, Metrics) -- should maybe be move
import qualified Journal.Internal.Metrics as Metrics

import Blocker

data DumblogCounters
= CurrentNumberTransactions
| NumberOfWrites
| NumberOfReads
| ErrorsEncountered
deriving (Eq, Show, Enum, Bounded)

data DumblogHistograms
= ResponseTime
deriving (Eq, Show, Enum, Bounded)

type DumblogMetrics = Metrics DumblogCounters DumblogHistograms

dumblogSchema :: MetricsSchema DumblogCounters DumblogHistograms
dumblogSchema = Metrics.MetricsSchema 1
import Metrics

data FrontEndInfo = FrontEndInfo
{ sequenceNumber :: AtomicCounter
Expand Down
4 changes: 3 additions & 1 deletion src/sut/dumblog/dumblog.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ library
build-depends:
, base ^>=4.14.1.0
, containers
, journal
exposed-modules:
Blocker
Blocker
, Metrics
hs-source-dirs: src
default-language: Haskell2010
20 changes: 20 additions & 0 deletions src/sut/dumblog/src/Metrics.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Metrics where

import Journal.Internal.Metrics (MetricsSchema, Metrics) -- should maybe be moved to separate package
import qualified Journal.Internal.Metrics as Metrics

data DumblogCounters
= CurrentNumberTransactions
| NumberOfWrites
| NumberOfReads
| ErrorsEncountered
deriving (Eq, Show, Enum, Bounded)

data DumblogHistograms
= ResponseTime
deriving (Eq, Show, Enum, Bounded)

type DumblogMetrics = Metrics DumblogCounters DumblogHistograms

dumblogSchema :: MetricsSchema DumblogCounters DumblogHistograms
dumblogSchema = Metrics.MetricsSchema 1

0 comments on commit 9395acf

Please sign in to comment.