Skip to content

Commit

Permalink
Make all Sample types showable
Browse files Browse the repository at this point in the history
This commit derives `Show` for all of our *Sample types:

- `CounterSample`
- `GaugeSample`
- `HistogramSample`
- `SummarySample`
  • Loading branch information
cdepillabout committed Dec 19, 2023
1 parent 27fa227 commit c881277
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/System/Metrics/Prometheus/Metric/Counter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Data.Atomics.Counter (AtomicCounter, incrCounter, newCounter, writeCounte


newtype Counter = Counter {unCounter :: AtomicCounter}
newtype CounterSample = CounterSample {unCounterSample :: Int}
newtype CounterSample = CounterSample {unCounterSample :: Int} deriving Show


new :: IO Counter
Expand Down
2 changes: 1 addition & 1 deletion src/System/Metrics/Prometheus/Metric/Gauge.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Data.IORef (IORef, atomicModifyIORef', newIORef)


newtype Gauge = Gauge {unGauge :: IORef Double}
newtype GaugeSample = GaugeSample {unGaugeSample :: Double}
newtype GaugeSample = GaugeSample {unGaugeSample :: Double} deriving Show


new :: IO Gauge
Expand Down
1 change: 1 addition & 0 deletions src/System/Metrics/Prometheus/Metric/Histogram.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ data HistogramSample = HistogramSample
, histSum :: !Double
, histCount :: !Int
}
deriving Show


new :: [UpperBound] -> IO Histogram
Expand Down
1 change: 1 addition & 0 deletions src/System/Metrics/Prometheus/Metric/Summary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ data SummarySample = SummarySample
, sumSum :: !Int
, sumCount :: !Int
}
deriving Show

0 comments on commit c881277

Please sign in to comment.