{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Instrument.Types
( createInstrumentPool
, Samplers
, Counters
, Instrument(..)
, InstrumentConfig(..)
, SubmissionPacket(..)
, MetricName(..)
, DimensionName(..)
, DimensionValue(..)
, Dimensions
, Payload(..)
, Aggregated(..)
, AggPayload(..)
, Stats(..)
, hostDimension
, HostDimensionPolicy(..)
, Quantile(..)
) where
import Control.Applicative as A
import qualified Data.ByteString.Char8 as B
import Data.Default
import Data.IORef
import qualified Data.Map as M
import Data.Monoid as Monoid
import qualified Data.SafeCopy as SC
import Data.Serialize as Ser
import Data.Serialize.Text ()
import Data.String
import Data.Text (Text)
import qualified Data.Text as T
#if MIN_VERSION_hedis(0,12,0)
import Database.Redis as R
#else
import Database.Redis as R hiding (HostName, time)
#endif
import GHC.Generics
import Network.HostName
import qualified Instrument.Counter as C
import qualified Instrument.Sampler as S
createInstrumentPool :: ConnectInfo -> IO Connection
createInstrumentPool :: ConnectInfo -> IO Connection
createInstrumentPool ConnectInfo
ci = do
Connection
c <- ConnectInfo -> IO Connection
connect ConnectInfo
ci {
connectMaxIdleTime :: NominalDiffTime
connectMaxIdleTime = NominalDiffTime
15
, connectMaxConnections :: Int
connectMaxConnections = Int
1 }
Connection -> IO Connection
forall (m :: * -> *) a. Monad m => a -> m a
return Connection
c
type Samplers = M.Map (MetricName, Dimensions) S.Sampler
type Counters = M.Map (MetricName, Dimensions) C.Counter
type Dimensions = M.Map DimensionName DimensionValue
newtype MetricName = MetricName {
MetricName -> String
metricName :: String
} deriving (MetricName -> MetricName -> Bool
(MetricName -> MetricName -> Bool)
-> (MetricName -> MetricName -> Bool) -> Eq MetricName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetricName -> MetricName -> Bool
$c/= :: MetricName -> MetricName -> Bool
== :: MetricName -> MetricName -> Bool
$c== :: MetricName -> MetricName -> Bool
Eq,Int -> MetricName -> ShowS
[MetricName] -> ShowS
MetricName -> String
(Int -> MetricName -> ShowS)
-> (MetricName -> String)
-> ([MetricName] -> ShowS)
-> Show MetricName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetricName] -> ShowS
$cshowList :: [MetricName] -> ShowS
show :: MetricName -> String
$cshow :: MetricName -> String
showsPrec :: Int -> MetricName -> ShowS
$cshowsPrec :: Int -> MetricName -> ShowS
Show,(forall x. MetricName -> Rep MetricName x)
-> (forall x. Rep MetricName x -> MetricName) -> Generic MetricName
forall x. Rep MetricName x -> MetricName
forall x. MetricName -> Rep MetricName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetricName x -> MetricName
$cfrom :: forall x. MetricName -> Rep MetricName x
Generic,Eq MetricName
Eq MetricName
-> (MetricName -> MetricName -> Ordering)
-> (MetricName -> MetricName -> Bool)
-> (MetricName -> MetricName -> Bool)
-> (MetricName -> MetricName -> Bool)
-> (MetricName -> MetricName -> Bool)
-> (MetricName -> MetricName -> MetricName)
-> (MetricName -> MetricName -> MetricName)
-> Ord MetricName
MetricName -> MetricName -> Bool
MetricName -> MetricName -> Ordering
MetricName -> MetricName -> MetricName
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: MetricName -> MetricName -> MetricName
$cmin :: MetricName -> MetricName -> MetricName
max :: MetricName -> MetricName -> MetricName
$cmax :: MetricName -> MetricName -> MetricName
>= :: MetricName -> MetricName -> Bool
$c>= :: MetricName -> MetricName -> Bool
> :: MetricName -> MetricName -> Bool
$c> :: MetricName -> MetricName -> Bool
<= :: MetricName -> MetricName -> Bool
$c<= :: MetricName -> MetricName -> Bool
< :: MetricName -> MetricName -> Bool
$c< :: MetricName -> MetricName -> Bool
compare :: MetricName -> MetricName -> Ordering
$ccompare :: MetricName -> MetricName -> Ordering
$cp1Ord :: Eq MetricName
Ord,String -> MetricName
(String -> MetricName) -> IsString MetricName
forall a. (String -> a) -> IsString a
fromString :: String -> MetricName
$cfromString :: String -> MetricName
IsString,Get MetricName
Putter MetricName
Putter MetricName -> Get MetricName -> Serialize MetricName
forall t. Putter t -> Get t -> Serialize t
get :: Get MetricName
$cget :: Get MetricName
put :: Putter MetricName
$cput :: Putter MetricName
Serialize)
data Instrument = I {
Instrument -> String
hostName :: HostName
, Instrument -> IORef Samplers
samplers :: !(IORef Samplers)
, Instrument -> IORef Counters
counters :: !(IORef Counters)
, Instrument -> Connection
redis :: Connection
}
data InstrumentConfig = ICfg {
InstrumentConfig -> Maybe Integer
redisQueueBound :: Maybe Integer
}
instance Default InstrumentConfig where
def :: InstrumentConfig
def = Maybe Integer -> InstrumentConfig
ICfg Maybe Integer
forall a. Maybe a
Nothing
data SubmissionPacket_v0 = SP_v0 {
SubmissionPacket_v0 -> Double
spTimeStamp_v0 :: !Double
, SubmissionPacket_v0 -> String
spHostName_v0 :: !HostName
, SubmissionPacket_v0 -> String
spName_v0 :: String
, SubmissionPacket_v0 -> Payload
spPayload_v0 :: Payload
} deriving (SubmissionPacket_v0 -> SubmissionPacket_v0 -> Bool
(SubmissionPacket_v0 -> SubmissionPacket_v0 -> Bool)
-> (SubmissionPacket_v0 -> SubmissionPacket_v0 -> Bool)
-> Eq SubmissionPacket_v0
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubmissionPacket_v0 -> SubmissionPacket_v0 -> Bool
$c/= :: SubmissionPacket_v0 -> SubmissionPacket_v0 -> Bool
== :: SubmissionPacket_v0 -> SubmissionPacket_v0 -> Bool
$c== :: SubmissionPacket_v0 -> SubmissionPacket_v0 -> Bool
Eq,Int -> SubmissionPacket_v0 -> ShowS
[SubmissionPacket_v0] -> ShowS
SubmissionPacket_v0 -> String
(Int -> SubmissionPacket_v0 -> ShowS)
-> (SubmissionPacket_v0 -> String)
-> ([SubmissionPacket_v0] -> ShowS)
-> Show SubmissionPacket_v0
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubmissionPacket_v0] -> ShowS
$cshowList :: [SubmissionPacket_v0] -> ShowS
show :: SubmissionPacket_v0 -> String
$cshow :: SubmissionPacket_v0 -> String
showsPrec :: Int -> SubmissionPacket_v0 -> ShowS
$cshowsPrec :: Int -> SubmissionPacket_v0 -> ShowS
Show,(forall x. SubmissionPacket_v0 -> Rep SubmissionPacket_v0 x)
-> (forall x. Rep SubmissionPacket_v0 x -> SubmissionPacket_v0)
-> Generic SubmissionPacket_v0
forall x. Rep SubmissionPacket_v0 x -> SubmissionPacket_v0
forall x. SubmissionPacket_v0 -> Rep SubmissionPacket_v0 x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SubmissionPacket_v0 x -> SubmissionPacket_v0
$cfrom :: forall x. SubmissionPacket_v0 -> Rep SubmissionPacket_v0 x
Generic)
instance Serialize SubmissionPacket_v0
data SubmissionPacket = SP {
SubmissionPacket -> Double
spTimeStamp :: !Double
, SubmissionPacket -> MetricName
spName :: !MetricName
, SubmissionPacket -> Payload
spPayload :: !Payload
, SubmissionPacket -> Dimensions
spDimensions :: !Dimensions
} deriving (SubmissionPacket -> SubmissionPacket -> Bool
(SubmissionPacket -> SubmissionPacket -> Bool)
-> (SubmissionPacket -> SubmissionPacket -> Bool)
-> Eq SubmissionPacket
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubmissionPacket -> SubmissionPacket -> Bool
$c/= :: SubmissionPacket -> SubmissionPacket -> Bool
== :: SubmissionPacket -> SubmissionPacket -> Bool
$c== :: SubmissionPacket -> SubmissionPacket -> Bool
Eq,Int -> SubmissionPacket -> ShowS
[SubmissionPacket] -> ShowS
SubmissionPacket -> String
(Int -> SubmissionPacket -> ShowS)
-> (SubmissionPacket -> String)
-> ([SubmissionPacket] -> ShowS)
-> Show SubmissionPacket
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubmissionPacket] -> ShowS
$cshowList :: [SubmissionPacket] -> ShowS
show :: SubmissionPacket -> String
$cshow :: SubmissionPacket -> String
showsPrec :: Int -> SubmissionPacket -> ShowS
$cshowsPrec :: Int -> SubmissionPacket -> ShowS
Show,(forall x. SubmissionPacket -> Rep SubmissionPacket x)
-> (forall x. Rep SubmissionPacket x -> SubmissionPacket)
-> Generic SubmissionPacket
forall x. Rep SubmissionPacket x -> SubmissionPacket
forall x. SubmissionPacket -> Rep SubmissionPacket x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SubmissionPacket x -> SubmissionPacket
$cfrom :: forall x. SubmissionPacket -> Rep SubmissionPacket x
Generic)
instance Serialize SubmissionPacket where
get :: Get SubmissionPacket
get = (D1
('MetaData
"SubmissionPacket"
"Instrument.Types"
"instrument-0.6.0.0-F93FQDczdiYH6Ea7c21UCQ"
'False)
(C1
('MetaCons "SP" 'PrefixI 'True)
((S1
('MetaSel
('Just "spTimeStamp")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 Double)
:*: S1
('MetaSel
('Just "spName")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 MetricName))
:*: (S1
('MetaSel
('Just "spPayload")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 Payload)
:*: S1
('MetaSel
('Just "spDimensions")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 Dimensions))))
Any
-> SubmissionPacket
forall a x. Generic a => Rep a x -> a
to (D1
('MetaData
"SubmissionPacket"
"Instrument.Types"
"instrument-0.6.0.0-F93FQDczdiYH6Ea7c21UCQ"
'False)
(C1
('MetaCons "SP" 'PrefixI 'True)
((S1
('MetaSel
('Just "spTimeStamp")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 Double)
:*: S1
('MetaSel
('Just "spName")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 MetricName))
:*: (S1
('MetaSel
('Just "spPayload")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 Payload)
:*: S1
('MetaSel
('Just "spDimensions")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 Dimensions))))
Any
-> SubmissionPacket)
-> Get
(D1
('MetaData
"SubmissionPacket"
"Instrument.Types"
"instrument-0.6.0.0-F93FQDczdiYH6Ea7c21UCQ"
'False)
(C1
('MetaCons "SP" 'PrefixI 'True)
((S1
('MetaSel
('Just "spTimeStamp")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 Double)
:*: S1
('MetaSel
('Just "spName")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 MetricName))
:*: (S1
('MetaSel
('Just "spPayload")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 Payload)
:*: S1
('MetaSel
('Just "spDimensions")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 Dimensions))))
Any)
-> Get SubmissionPacket
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get
(D1
('MetaData
"SubmissionPacket"
"Instrument.Types"
"instrument-0.6.0.0-F93FQDczdiYH6Ea7c21UCQ"
'False)
(C1
('MetaCons "SP" 'PrefixI 'True)
((S1
('MetaSel
('Just "spTimeStamp")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 Double)
:*: S1
('MetaSel
('Just "spName")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 MetricName))
:*: (S1
('MetaSel
('Just "spPayload")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 Payload)
:*: S1
('MetaSel
('Just "spDimensions")
'NoSourceUnpackedness
'SourceStrict
'DecidedStrict)
(Rec0 Dimensions))))
Any)
forall (f :: * -> *) a. GSerializeGet f => Get (f a)
gGet) Get SubmissionPacket
-> Get SubmissionPacket -> Get SubmissionPacket
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (SubmissionPacket_v0 -> SubmissionPacket
upgradeSP0 (SubmissionPacket_v0 -> SubmissionPacket)
-> Get SubmissionPacket_v0 -> Get SubmissionPacket
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get SubmissionPacket_v0
forall t. Serialize t => Get t
Ser.get)
instance SC.Migrate SubmissionPacket where
type MigrateFrom SubmissionPacket = SubmissionPacket_v0
migrate :: MigrateFrom SubmissionPacket -> SubmissionPacket
migrate = MigrateFrom SubmissionPacket -> SubmissionPacket
SubmissionPacket_v0 -> SubmissionPacket
upgradeSP0
upgradeSP0 :: SubmissionPacket_v0 -> SubmissionPacket
upgradeSP0 :: SubmissionPacket_v0 -> SubmissionPacket
upgradeSP0 SP_v0 {Double
String
Payload
spPayload_v0 :: Payload
spName_v0 :: String
spHostName_v0 :: String
spTimeStamp_v0 :: Double
spPayload_v0 :: SubmissionPacket_v0 -> Payload
spName_v0 :: SubmissionPacket_v0 -> String
spHostName_v0 :: SubmissionPacket_v0 -> String
spTimeStamp_v0 :: SubmissionPacket_v0 -> Double
..} = SP :: Double -> MetricName -> Payload -> Dimensions -> SubmissionPacket
SP
{ spTimeStamp :: Double
spTimeStamp = Double
spTimeStamp_v0
, spName :: MetricName
spName = String -> MetricName
MetricName String
spName_v0
, spPayload :: Payload
spPayload = Payload
spPayload_v0
, spDimensions :: Dimensions
spDimensions = DimensionName -> DimensionValue -> Dimensions
forall k a. k -> a -> Map k a
M.singleton DimensionName
hostDimension (Text -> DimensionValue
DimensionValue (String -> Text
T.pack String
spHostName_v0))
}
hostDimension :: DimensionName
hostDimension :: DimensionName
hostDimension = DimensionName
"host"
data HostDimensionPolicy = AddHostDimension
| DoNotAddHostDimension
deriving (Int -> HostDimensionPolicy -> ShowS
[HostDimensionPolicy] -> ShowS
HostDimensionPolicy -> String
(Int -> HostDimensionPolicy -> ShowS)
-> (HostDimensionPolicy -> String)
-> ([HostDimensionPolicy] -> ShowS)
-> Show HostDimensionPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HostDimensionPolicy] -> ShowS
$cshowList :: [HostDimensionPolicy] -> ShowS
show :: HostDimensionPolicy -> String
$cshow :: HostDimensionPolicy -> String
showsPrec :: Int -> HostDimensionPolicy -> ShowS
$cshowsPrec :: Int -> HostDimensionPolicy -> ShowS
Show, HostDimensionPolicy -> HostDimensionPolicy -> Bool
(HostDimensionPolicy -> HostDimensionPolicy -> Bool)
-> (HostDimensionPolicy -> HostDimensionPolicy -> Bool)
-> Eq HostDimensionPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HostDimensionPolicy -> HostDimensionPolicy -> Bool
$c/= :: HostDimensionPolicy -> HostDimensionPolicy -> Bool
== :: HostDimensionPolicy -> HostDimensionPolicy -> Bool
$c== :: HostDimensionPolicy -> HostDimensionPolicy -> Bool
Eq)
newtype DimensionName = DimensionName {
DimensionName -> Text
dimensionName :: Text
} deriving (DimensionName -> DimensionName -> Bool
(DimensionName -> DimensionName -> Bool)
-> (DimensionName -> DimensionName -> Bool) -> Eq DimensionName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DimensionName -> DimensionName -> Bool
$c/= :: DimensionName -> DimensionName -> Bool
== :: DimensionName -> DimensionName -> Bool
$c== :: DimensionName -> DimensionName -> Bool
Eq,Eq DimensionName
Eq DimensionName
-> (DimensionName -> DimensionName -> Ordering)
-> (DimensionName -> DimensionName -> Bool)
-> (DimensionName -> DimensionName -> Bool)
-> (DimensionName -> DimensionName -> Bool)
-> (DimensionName -> DimensionName -> Bool)
-> (DimensionName -> DimensionName -> DimensionName)
-> (DimensionName -> DimensionName -> DimensionName)
-> Ord DimensionName
DimensionName -> DimensionName -> Bool
DimensionName -> DimensionName -> Ordering
DimensionName -> DimensionName -> DimensionName
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: DimensionName -> DimensionName -> DimensionName
$cmin :: DimensionName -> DimensionName -> DimensionName
max :: DimensionName -> DimensionName -> DimensionName
$cmax :: DimensionName -> DimensionName -> DimensionName
>= :: DimensionName -> DimensionName -> Bool
$c>= :: DimensionName -> DimensionName -> Bool
> :: DimensionName -> DimensionName -> Bool
$c> :: DimensionName -> DimensionName -> Bool
<= :: DimensionName -> DimensionName -> Bool
$c<= :: DimensionName -> DimensionName -> Bool
< :: DimensionName -> DimensionName -> Bool
$c< :: DimensionName -> DimensionName -> Bool
compare :: DimensionName -> DimensionName -> Ordering
$ccompare :: DimensionName -> DimensionName -> Ordering
$cp1Ord :: Eq DimensionName
Ord,Int -> DimensionName -> ShowS
[DimensionName] -> ShowS
DimensionName -> String
(Int -> DimensionName -> ShowS)
-> (DimensionName -> String)
-> ([DimensionName] -> ShowS)
-> Show DimensionName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DimensionName] -> ShowS
$cshowList :: [DimensionName] -> ShowS
show :: DimensionName -> String
$cshow :: DimensionName -> String
showsPrec :: Int -> DimensionName -> ShowS
$cshowsPrec :: Int -> DimensionName -> ShowS
Show,(forall x. DimensionName -> Rep DimensionName x)
-> (forall x. Rep DimensionName x -> DimensionName)
-> Generic DimensionName
forall x. Rep DimensionName x -> DimensionName
forall x. DimensionName -> Rep DimensionName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DimensionName x -> DimensionName
$cfrom :: forall x. DimensionName -> Rep DimensionName x
Generic,Get DimensionName
Putter DimensionName
Putter DimensionName
-> Get DimensionName -> Serialize DimensionName
forall t. Putter t -> Get t -> Serialize t
get :: Get DimensionName
$cget :: Get DimensionName
put :: Putter DimensionName
$cput :: Putter DimensionName
Serialize,String -> DimensionName
(String -> DimensionName) -> IsString DimensionName
forall a. (String -> a) -> IsString a
fromString :: String -> DimensionName
$cfromString :: String -> DimensionName
IsString)
newtype DimensionValue = DimensionValue {
DimensionValue -> Text
dimensionValue :: Text
} deriving (DimensionValue -> DimensionValue -> Bool
(DimensionValue -> DimensionValue -> Bool)
-> (DimensionValue -> DimensionValue -> Bool) -> Eq DimensionValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DimensionValue -> DimensionValue -> Bool
$c/= :: DimensionValue -> DimensionValue -> Bool
== :: DimensionValue -> DimensionValue -> Bool
$c== :: DimensionValue -> DimensionValue -> Bool
Eq,Eq DimensionValue
Eq DimensionValue
-> (DimensionValue -> DimensionValue -> Ordering)
-> (DimensionValue -> DimensionValue -> Bool)
-> (DimensionValue -> DimensionValue -> Bool)
-> (DimensionValue -> DimensionValue -> Bool)
-> (DimensionValue -> DimensionValue -> Bool)
-> (DimensionValue -> DimensionValue -> DimensionValue)
-> (DimensionValue -> DimensionValue -> DimensionValue)
-> Ord DimensionValue
DimensionValue -> DimensionValue -> Bool
DimensionValue -> DimensionValue -> Ordering
DimensionValue -> DimensionValue -> DimensionValue
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: DimensionValue -> DimensionValue -> DimensionValue
$cmin :: DimensionValue -> DimensionValue -> DimensionValue
max :: DimensionValue -> DimensionValue -> DimensionValue
$cmax :: DimensionValue -> DimensionValue -> DimensionValue
>= :: DimensionValue -> DimensionValue -> Bool
$c>= :: DimensionValue -> DimensionValue -> Bool
> :: DimensionValue -> DimensionValue -> Bool
$c> :: DimensionValue -> DimensionValue -> Bool
<= :: DimensionValue -> DimensionValue -> Bool
$c<= :: DimensionValue -> DimensionValue -> Bool
< :: DimensionValue -> DimensionValue -> Bool
$c< :: DimensionValue -> DimensionValue -> Bool
compare :: DimensionValue -> DimensionValue -> Ordering
$ccompare :: DimensionValue -> DimensionValue -> Ordering
$cp1Ord :: Eq DimensionValue
Ord,Int -> DimensionValue -> ShowS
[DimensionValue] -> ShowS
DimensionValue -> String
(Int -> DimensionValue -> ShowS)
-> (DimensionValue -> String)
-> ([DimensionValue] -> ShowS)
-> Show DimensionValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DimensionValue] -> ShowS
$cshowList :: [DimensionValue] -> ShowS
show :: DimensionValue -> String
$cshow :: DimensionValue -> String
showsPrec :: Int -> DimensionValue -> ShowS
$cshowsPrec :: Int -> DimensionValue -> ShowS
Show,(forall x. DimensionValue -> Rep DimensionValue x)
-> (forall x. Rep DimensionValue x -> DimensionValue)
-> Generic DimensionValue
forall x. Rep DimensionValue x -> DimensionValue
forall x. DimensionValue -> Rep DimensionValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DimensionValue x -> DimensionValue
$cfrom :: forall x. DimensionValue -> Rep DimensionValue x
Generic,Get DimensionValue
Putter DimensionValue
Putter DimensionValue
-> Get DimensionValue -> Serialize DimensionValue
forall t. Putter t -> Get t -> Serialize t
get :: Get DimensionValue
$cget :: Get DimensionValue
put :: Putter DimensionValue
$cput :: Putter DimensionValue
Serialize,String -> DimensionValue
(String -> DimensionValue) -> IsString DimensionValue
forall a. (String -> a) -> IsString a
fromString :: String -> DimensionValue
$cfromString :: String -> DimensionValue
IsString)
data Payload
= Samples { Payload -> [Double]
unSamples :: [Double] }
| Counter { Payload -> Int
unCounter :: Int }
deriving (Payload -> Payload -> Bool
(Payload -> Payload -> Bool)
-> (Payload -> Payload -> Bool) -> Eq Payload
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Payload -> Payload -> Bool
$c/= :: Payload -> Payload -> Bool
== :: Payload -> Payload -> Bool
$c== :: Payload -> Payload -> Bool
Eq, Int -> Payload -> ShowS
[Payload] -> ShowS
Payload -> String
(Int -> Payload -> ShowS)
-> (Payload -> String) -> ([Payload] -> ShowS) -> Show Payload
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Payload] -> ShowS
$cshowList :: [Payload] -> ShowS
show :: Payload -> String
$cshow :: Payload -> String
showsPrec :: Int -> Payload -> ShowS
$cshowsPrec :: Int -> Payload -> ShowS
Show, (forall x. Payload -> Rep Payload x)
-> (forall x. Rep Payload x -> Payload) -> Generic Payload
forall x. Rep Payload x -> Payload
forall x. Payload -> Rep Payload x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Payload x -> Payload
$cfrom :: forall x. Payload -> Rep Payload x
Generic)
instance Serialize Payload
data Aggregated_v0 = Aggregated_v0 {
Aggregated_v0 -> Double
aggTS_v0 :: Double
, Aggregated_v0 -> String
aggName_v0 :: String
, Aggregated_v0 -> ByteString
aggGroup_v0 :: B.ByteString
, Aggregated_v0 -> AggPayload
aggPayload_v0 :: AggPayload
} deriving (Aggregated_v0 -> Aggregated_v0 -> Bool
(Aggregated_v0 -> Aggregated_v0 -> Bool)
-> (Aggregated_v0 -> Aggregated_v0 -> Bool) -> Eq Aggregated_v0
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Aggregated_v0 -> Aggregated_v0 -> Bool
$c/= :: Aggregated_v0 -> Aggregated_v0 -> Bool
== :: Aggregated_v0 -> Aggregated_v0 -> Bool
$c== :: Aggregated_v0 -> Aggregated_v0 -> Bool
Eq,Int -> Aggregated_v0 -> ShowS
[Aggregated_v0] -> ShowS
Aggregated_v0 -> String
(Int -> Aggregated_v0 -> ShowS)
-> (Aggregated_v0 -> String)
-> ([Aggregated_v0] -> ShowS)
-> Show Aggregated_v0
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Aggregated_v0] -> ShowS
$cshowList :: [Aggregated_v0] -> ShowS
show :: Aggregated_v0 -> String
$cshow :: Aggregated_v0 -> String
showsPrec :: Int -> Aggregated_v0 -> ShowS
$cshowsPrec :: Int -> Aggregated_v0 -> ShowS
Show,(forall x. Aggregated_v0 -> Rep Aggregated_v0 x)
-> (forall x. Rep Aggregated_v0 x -> Aggregated_v0)
-> Generic Aggregated_v0
forall x. Rep Aggregated_v0 x -> Aggregated_v0
forall x. Aggregated_v0 -> Rep Aggregated_v0 x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Aggregated_v0 x -> Aggregated_v0
$cfrom :: forall x. Aggregated_v0 -> Rep Aggregated_v0 x
Generic)
instance Serialize Aggregated_v0
data Aggregated_v1 = Aggregated_v1 {
Aggregated_v1 -> Double
aggTS_v1 :: Double
, Aggregated_v1 -> MetricName
aggName_v1 :: MetricName
, Aggregated_v1 -> ByteString
aggGroup_v1 :: B.ByteString
, Aggregated_v1 -> AggPayload
aggPayload_v1 :: AggPayload
} deriving (Aggregated_v1 -> Aggregated_v1 -> Bool
(Aggregated_v1 -> Aggregated_v1 -> Bool)
-> (Aggregated_v1 -> Aggregated_v1 -> Bool) -> Eq Aggregated_v1
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Aggregated_v1 -> Aggregated_v1 -> Bool
$c/= :: Aggregated_v1 -> Aggregated_v1 -> Bool
== :: Aggregated_v1 -> Aggregated_v1 -> Bool
$c== :: Aggregated_v1 -> Aggregated_v1 -> Bool
Eq,Int -> Aggregated_v1 -> ShowS
[Aggregated_v1] -> ShowS
Aggregated_v1 -> String
(Int -> Aggregated_v1 -> ShowS)
-> (Aggregated_v1 -> String)
-> ([Aggregated_v1] -> ShowS)
-> Show Aggregated_v1
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Aggregated_v1] -> ShowS
$cshowList :: [Aggregated_v1] -> ShowS
show :: Aggregated_v1 -> String
$cshow :: Aggregated_v1 -> String
showsPrec :: Int -> Aggregated_v1 -> ShowS
$cshowsPrec :: Int -> Aggregated_v1 -> ShowS
Show,(forall x. Aggregated_v1 -> Rep Aggregated_v1 x)
-> (forall x. Rep Aggregated_v1 x -> Aggregated_v1)
-> Generic Aggregated_v1
forall x. Rep Aggregated_v1 x -> Aggregated_v1
forall x. Aggregated_v1 -> Rep Aggregated_v1 x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Aggregated_v1 x -> Aggregated_v1
$cfrom :: forall x. Aggregated_v1 -> Rep Aggregated_v1 x
Generic)
instance SC.Migrate Aggregated_v1 where
type MigrateFrom Aggregated_v1 = Aggregated_v0
migrate :: MigrateFrom Aggregated_v1 -> Aggregated_v1
migrate = MigrateFrom Aggregated_v1 -> Aggregated_v1
Aggregated_v0 -> Aggregated_v1
upgradeAggregated_v0
upgradeAggregated_v0 :: Aggregated_v0 -> Aggregated_v1
upgradeAggregated_v0 :: Aggregated_v0 -> Aggregated_v1
upgradeAggregated_v0 Aggregated_v0
a = Aggregated_v1 :: Double -> MetricName -> ByteString -> AggPayload -> Aggregated_v1
Aggregated_v1
{ aggTS_v1 :: Double
aggTS_v1 = Aggregated_v0 -> Double
aggTS_v0 Aggregated_v0
a
, aggName_v1 :: MetricName
aggName_v1 = String -> MetricName
MetricName (Aggregated_v0 -> String
aggName_v0 Aggregated_v0
a)
, aggGroup_v1 :: ByteString
aggGroup_v1 = (Aggregated_v0 -> ByteString
aggGroup_v0 Aggregated_v0
a)
, aggPayload_v1 :: AggPayload
aggPayload_v1 = (Aggregated_v0 -> AggPayload
aggPayload_v0 Aggregated_v0
a)
}
instance Serialize Aggregated_v1 where
get :: Get Aggregated_v1
get = (D1
('MetaData
"Aggregated_v1"
"Instrument.Types"
"instrument-0.6.0.0-F93FQDczdiYH6Ea7c21UCQ"
'False)
(C1
('MetaCons "Aggregated_v1" 'PrefixI 'True)
((S1
('MetaSel
('Just "aggTS_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 Double)
:*: S1
('MetaSel
('Just "aggName_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 MetricName))
:*: (S1
('MetaSel
('Just "aggGroup_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 ByteString)
:*: S1
('MetaSel
('Just "aggPayload_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 AggPayload))))
Any
-> Aggregated_v1
forall a x. Generic a => Rep a x -> a
to (D1
('MetaData
"Aggregated_v1"
"Instrument.Types"
"instrument-0.6.0.0-F93FQDczdiYH6Ea7c21UCQ"
'False)
(C1
('MetaCons "Aggregated_v1" 'PrefixI 'True)
((S1
('MetaSel
('Just "aggTS_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 Double)
:*: S1
('MetaSel
('Just "aggName_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 MetricName))
:*: (S1
('MetaSel
('Just "aggGroup_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 ByteString)
:*: S1
('MetaSel
('Just "aggPayload_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 AggPayload))))
Any
-> Aggregated_v1)
-> Get
(D1
('MetaData
"Aggregated_v1"
"Instrument.Types"
"instrument-0.6.0.0-F93FQDczdiYH6Ea7c21UCQ"
'False)
(C1
('MetaCons "Aggregated_v1" 'PrefixI 'True)
((S1
('MetaSel
('Just "aggTS_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 Double)
:*: S1
('MetaSel
('Just "aggName_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 MetricName))
:*: (S1
('MetaSel
('Just "aggGroup_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 ByteString)
:*: S1
('MetaSel
('Just "aggPayload_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 AggPayload))))
Any)
-> Get Aggregated_v1
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get
(D1
('MetaData
"Aggregated_v1"
"Instrument.Types"
"instrument-0.6.0.0-F93FQDczdiYH6Ea7c21UCQ"
'False)
(C1
('MetaCons "Aggregated_v1" 'PrefixI 'True)
((S1
('MetaSel
('Just "aggTS_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 Double)
:*: S1
('MetaSel
('Just "aggName_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 MetricName))
:*: (S1
('MetaSel
('Just "aggGroup_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 ByteString)
:*: S1
('MetaSel
('Just "aggPayload_v1")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 AggPayload))))
Any)
forall (f :: * -> *) a. GSerializeGet f => Get (f a)
gGet) Get Aggregated_v1 -> Get Aggregated_v1 -> Get Aggregated_v1
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (Aggregated_v0 -> Aggregated_v1
upgradeAggregated_v0 (Aggregated_v0 -> Aggregated_v1)
-> Get Aggregated_v0 -> Get Aggregated_v1
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Aggregated_v0
forall t. Serialize t => Get t
Ser.get)
data Aggregated = Aggregated {
Aggregated -> Double
aggTS :: Double
, Aggregated -> MetricName
aggName :: MetricName
, Aggregated -> AggPayload
aggPayload :: AggPayload
, Aggregated -> Dimensions
aggDimensions :: Dimensions
} deriving (Aggregated -> Aggregated -> Bool
(Aggregated -> Aggregated -> Bool)
-> (Aggregated -> Aggregated -> Bool) -> Eq Aggregated
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Aggregated -> Aggregated -> Bool
$c/= :: Aggregated -> Aggregated -> Bool
== :: Aggregated -> Aggregated -> Bool
$c== :: Aggregated -> Aggregated -> Bool
Eq,Int -> Aggregated -> ShowS
[Aggregated] -> ShowS
Aggregated -> String
(Int -> Aggregated -> ShowS)
-> (Aggregated -> String)
-> ([Aggregated] -> ShowS)
-> Show Aggregated
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Aggregated] -> ShowS
$cshowList :: [Aggregated] -> ShowS
show :: Aggregated -> String
$cshow :: Aggregated -> String
showsPrec :: Int -> Aggregated -> ShowS
$cshowsPrec :: Int -> Aggregated -> ShowS
Show, (forall x. Aggregated -> Rep Aggregated x)
-> (forall x. Rep Aggregated x -> Aggregated) -> Generic Aggregated
forall x. Rep Aggregated x -> Aggregated
forall x. Aggregated -> Rep Aggregated x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Aggregated x -> Aggregated
$cfrom :: forall x. Aggregated -> Rep Aggregated x
Generic)
upgradeAggregated_v1 :: Aggregated_v1 -> Aggregated
upgradeAggregated_v1 :: Aggregated_v1 -> Aggregated
upgradeAggregated_v1 Aggregated_v1
a = Aggregated :: Double -> MetricName -> AggPayload -> Dimensions -> Aggregated
Aggregated
{ aggTS :: Double
aggTS = Aggregated_v1 -> Double
aggTS_v1 Aggregated_v1
a
, aggName :: MetricName
aggName = Aggregated_v1 -> MetricName
aggName_v1 Aggregated_v1
a
, aggPayload :: AggPayload
aggPayload = Aggregated_v1 -> AggPayload
aggPayload_v1 Aggregated_v1
a
, aggDimensions :: Dimensions
aggDimensions = Dimensions
forall a. Monoid a => a
Monoid.mempty
}
instance SC.Migrate Aggregated where
type MigrateFrom Aggregated = Aggregated_v1
migrate :: MigrateFrom Aggregated -> Aggregated
migrate = MigrateFrom Aggregated -> Aggregated
Aggregated_v1 -> Aggregated
upgradeAggregated_v1
instance Serialize Aggregated where
get :: Get Aggregated
get = (D1
('MetaData
"Aggregated"
"Instrument.Types"
"instrument-0.6.0.0-F93FQDczdiYH6Ea7c21UCQ"
'False)
(C1
('MetaCons "Aggregated" 'PrefixI 'True)
((S1
('MetaSel
('Just "aggTS")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 Double)
:*: S1
('MetaSel
('Just "aggName")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 MetricName))
:*: (S1
('MetaSel
('Just "aggPayload")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 AggPayload)
:*: S1
('MetaSel
('Just "aggDimensions")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 Dimensions))))
Any
-> Aggregated
forall a x. Generic a => Rep a x -> a
to (D1
('MetaData
"Aggregated"
"Instrument.Types"
"instrument-0.6.0.0-F93FQDczdiYH6Ea7c21UCQ"
'False)
(C1
('MetaCons "Aggregated" 'PrefixI 'True)
((S1
('MetaSel
('Just "aggTS")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 Double)
:*: S1
('MetaSel
('Just "aggName")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 MetricName))
:*: (S1
('MetaSel
('Just "aggPayload")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 AggPayload)
:*: S1
('MetaSel
('Just "aggDimensions")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 Dimensions))))
Any
-> Aggregated)
-> Get
(D1
('MetaData
"Aggregated"
"Instrument.Types"
"instrument-0.6.0.0-F93FQDczdiYH6Ea7c21UCQ"
'False)
(C1
('MetaCons "Aggregated" 'PrefixI 'True)
((S1
('MetaSel
('Just "aggTS")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 Double)
:*: S1
('MetaSel
('Just "aggName")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 MetricName))
:*: (S1
('MetaSel
('Just "aggPayload")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 AggPayload)
:*: S1
('MetaSel
('Just "aggDimensions")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 Dimensions))))
Any)
-> Get Aggregated
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get
(D1
('MetaData
"Aggregated"
"Instrument.Types"
"instrument-0.6.0.0-F93FQDczdiYH6Ea7c21UCQ"
'False)
(C1
('MetaCons "Aggregated" 'PrefixI 'True)
((S1
('MetaSel
('Just "aggTS")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 Double)
:*: S1
('MetaSel
('Just "aggName")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 MetricName))
:*: (S1
('MetaSel
('Just "aggPayload")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 AggPayload)
:*: S1
('MetaSel
('Just "aggDimensions")
'NoSourceUnpackedness
'NoSourceStrictness
'DecidedLazy)
(Rec0 Dimensions))))
Any)
forall (f :: * -> *) a. GSerializeGet f => Get (f a)
gGet) Get Aggregated -> Get Aggregated -> Get Aggregated
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (Aggregated_v1 -> Aggregated
upgradeAggregated_v1 (Aggregated_v1 -> Aggregated)
-> Get Aggregated_v1 -> Get Aggregated
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Aggregated_v1
forall t. Serialize t => Get t
Ser.get)
data AggPayload
= AggStats Stats
| AggCount Int
deriving (AggPayload -> AggPayload -> Bool
(AggPayload -> AggPayload -> Bool)
-> (AggPayload -> AggPayload -> Bool) -> Eq AggPayload
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggPayload -> AggPayload -> Bool
$c/= :: AggPayload -> AggPayload -> Bool
== :: AggPayload -> AggPayload -> Bool
$c== :: AggPayload -> AggPayload -> Bool
Eq,Int -> AggPayload -> ShowS
[AggPayload] -> ShowS
AggPayload -> String
(Int -> AggPayload -> ShowS)
-> (AggPayload -> String)
-> ([AggPayload] -> ShowS)
-> Show AggPayload
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggPayload] -> ShowS
$cshowList :: [AggPayload] -> ShowS
show :: AggPayload -> String
$cshow :: AggPayload -> String
showsPrec :: Int -> AggPayload -> ShowS
$cshowsPrec :: Int -> AggPayload -> ShowS
Show, (forall x. AggPayload -> Rep AggPayload x)
-> (forall x. Rep AggPayload x -> AggPayload) -> Generic AggPayload
forall x. Rep AggPayload x -> AggPayload
forall x. AggPayload -> Rep AggPayload x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AggPayload x -> AggPayload
$cfrom :: forall x. AggPayload -> Rep AggPayload x
Generic)
instance Serialize AggPayload
instance Default AggPayload where
def :: AggPayload
def = Stats -> AggPayload
AggStats Stats
forall a. Default a => a
def
instance Default Aggregated where
def :: Aggregated
def = Double -> MetricName -> AggPayload -> Dimensions -> Aggregated
Aggregated Double
0 MetricName
"" AggPayload
forall a. Default a => a
def Dimensions
forall a. Monoid a => a
mempty
data Stats = Stats {
Stats -> Double
smean :: Double
, Stats -> Double
ssum :: Double
, Stats -> Int
scount :: Int
, Stats -> Double
smax :: Double
, Stats -> Double
smin :: Double
, Stats -> Double
srange :: Double
, Stats -> Double
sstdev :: Double
, Stats -> Double
sskewness :: Double
, Stats -> Double
skurtosis :: Double
, Stats -> Map Int Double
squantiles :: M.Map Int Double
} deriving (Stats -> Stats -> Bool
(Stats -> Stats -> Bool) -> (Stats -> Stats -> Bool) -> Eq Stats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Stats -> Stats -> Bool
$c/= :: Stats -> Stats -> Bool
== :: Stats -> Stats -> Bool
$c== :: Stats -> Stats -> Bool
Eq, Int -> Stats -> ShowS
[Stats] -> ShowS
Stats -> String
(Int -> Stats -> ShowS)
-> (Stats -> String) -> ([Stats] -> ShowS) -> Show Stats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Stats] -> ShowS
$cshowList :: [Stats] -> ShowS
show :: Stats -> String
$cshow :: Stats -> String
showsPrec :: Int -> Stats -> ShowS
$cshowsPrec :: Int -> Stats -> ShowS
Show, (forall x. Stats -> Rep Stats x)
-> (forall x. Rep Stats x -> Stats) -> Generic Stats
forall x. Rep Stats x -> Stats
forall x. Stats -> Rep Stats x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Stats x -> Stats
$cfrom :: forall x. Stats -> Rep Stats x
Generic)
instance Default Stats where
def :: Stats
def = Double
-> Double
-> Int
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Map Int Double
-> Stats
Stats Double
0 Double
0 Int
0 Double
0 Double
0 Double
0 Double
0 Double
0 Double
0 Map Int Double
forall a. Monoid a => a
mempty
instance Serialize Stats
newtype Quantile = Q { Quantile -> Int
quantile :: Int } deriving (Int -> Quantile -> ShowS
[Quantile] -> ShowS
Quantile -> String
(Int -> Quantile -> ShowS)
-> (Quantile -> String) -> ([Quantile] -> ShowS) -> Show Quantile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Quantile] -> ShowS
$cshowList :: [Quantile] -> ShowS
show :: Quantile -> String
$cshow :: Quantile -> String
showsPrec :: Int -> Quantile -> ShowS
$cshowsPrec :: Int -> Quantile -> ShowS
Show, Quantile -> Quantile -> Bool
(Quantile -> Quantile -> Bool)
-> (Quantile -> Quantile -> Bool) -> Eq Quantile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Quantile -> Quantile -> Bool
$c/= :: Quantile -> Quantile -> Bool
== :: Quantile -> Quantile -> Bool
$c== :: Quantile -> Quantile -> Bool
Eq, Eq Quantile
Eq Quantile
-> (Quantile -> Quantile -> Ordering)
-> (Quantile -> Quantile -> Bool)
-> (Quantile -> Quantile -> Bool)
-> (Quantile -> Quantile -> Bool)
-> (Quantile -> Quantile -> Bool)
-> (Quantile -> Quantile -> Quantile)
-> (Quantile -> Quantile -> Quantile)
-> Ord Quantile
Quantile -> Quantile -> Bool
Quantile -> Quantile -> Ordering
Quantile -> Quantile -> Quantile
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Quantile -> Quantile -> Quantile
$cmin :: Quantile -> Quantile -> Quantile
max :: Quantile -> Quantile -> Quantile
$cmax :: Quantile -> Quantile -> Quantile
>= :: Quantile -> Quantile -> Bool
$c>= :: Quantile -> Quantile -> Bool
> :: Quantile -> Quantile -> Bool
$c> :: Quantile -> Quantile -> Bool
<= :: Quantile -> Quantile -> Bool
$c<= :: Quantile -> Quantile -> Bool
< :: Quantile -> Quantile -> Bool
$c< :: Quantile -> Quantile -> Bool
compare :: Quantile -> Quantile -> Ordering
$ccompare :: Quantile -> Quantile -> Ordering
$cp1Ord :: Eq Quantile
Ord)
instance Bounded Quantile where
minBound :: Quantile
minBound = Int -> Quantile
Q Int
1
maxBound :: Quantile
maxBound = Int -> Quantile
Q Int
99
$(SC.deriveSafeCopy 0 'SC.base ''Payload)
$(SC.deriveSafeCopy 0 'SC.base ''SubmissionPacket_v0)
$(SC.deriveSafeCopy 1 'SC.extension ''SubmissionPacket)
$(SC.deriveSafeCopy 0 'SC.base ''AggPayload)
$(SC.deriveSafeCopy 0 'SC.base ''Aggregated_v0)
$(SC.deriveSafeCopy 1 'SC.extension ''Aggregated_v1)
$(SC.deriveSafeCopy 2 'SC.extension ''Aggregated)
$(SC.deriveSafeCopy 0 'SC.base ''Stats)
$(SC.deriveSafeCopy 0 'SC.base ''DimensionName)
$(SC.deriveSafeCopy 0 'SC.base ''DimensionValue)
$(SC.deriveSafeCopy 0 'SC.base ''MetricName)