module Hasura.Eventing.ScheduledTrigger.Types
( CronTriggerStats (CronTriggerStats, _ctsMaxScheduledTime, _ctsName),
FetchedCronTriggerStats (..),
FetchedCronTriggerStatsLogger,
RetryContext (RetryContext, _rctxConf),
ScheduledEventOp (..),
ScheduledEventWebhookPayload (ScheduledEventWebhookPayload, sewpName, sewpScheduledTime, sewpRequestTransform, sewpResponseTransform),
ScheduledTriggerInternalErr (ScheduledTriggerInternalErr),
CronEventsCount (..),
OneOffScheduledEventsCount (..),
FetchedScheduledEventsStats (..),
FetchedScheduledEventsStatsLogger,
)
where
import Control.FoldDebounce qualified as FDebounce
import Data.Aeson qualified as J
import Data.Time.Clock
import Hasura.Base.Error
import Hasura.Eventing.HTTP
import Hasura.Logging qualified as L
import Hasura.Prelude
import Hasura.RQL.DDL.Webhook.Transform (MetadataResponseTransform, RequestTransform)
import Hasura.RQL.Types.EventTrigger
import Hasura.RQL.Types.ScheduledTrigger
newtype ScheduledTriggerInternalErr
= ScheduledTriggerInternalErr QErr
deriving (ScheduledTriggerInternalErr -> ScheduledTriggerInternalErr -> Bool
(ScheduledTriggerInternalErr
-> ScheduledTriggerInternalErr -> Bool)
-> (ScheduledTriggerInternalErr
-> ScheduledTriggerInternalErr -> Bool)
-> Eq ScheduledTriggerInternalErr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ScheduledTriggerInternalErr -> ScheduledTriggerInternalErr -> Bool
== :: ScheduledTriggerInternalErr -> ScheduledTriggerInternalErr -> Bool
$c/= :: ScheduledTriggerInternalErr -> ScheduledTriggerInternalErr -> Bool
/= :: ScheduledTriggerInternalErr -> ScheduledTriggerInternalErr -> Bool
Eq)
instance L.ToEngineLog ScheduledTriggerInternalErr L.Hasura where
toEngineLog :: ScheduledTriggerInternalErr
-> (LogLevel, EngineLogType Hasura, Value)
toEngineLog (ScheduledTriggerInternalErr QErr
qerr) =
(LogLevel
L.LevelError, EngineLogType Hasura
L.scheduledTriggerLogType, QErr -> Value
forall a. ToJSON a => a -> Value
J.toJSON QErr
qerr)
data CronTriggerStats = CronTriggerStats
{ CronTriggerStats -> TriggerName
_ctsName :: !TriggerName,
CronTriggerStats -> Int
_ctsUpcomingEventsCount :: !Int,
CronTriggerStats -> UTCTime
_ctsMaxScheduledTime :: !UTCTime
}
deriving (CronTriggerStats -> CronTriggerStats -> Bool
(CronTriggerStats -> CronTriggerStats -> Bool)
-> (CronTriggerStats -> CronTriggerStats -> Bool)
-> Eq CronTriggerStats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CronTriggerStats -> CronTriggerStats -> Bool
== :: CronTriggerStats -> CronTriggerStats -> Bool
$c/= :: CronTriggerStats -> CronTriggerStats -> Bool
/= :: CronTriggerStats -> CronTriggerStats -> Bool
Eq, (forall x. CronTriggerStats -> Rep CronTriggerStats x)
-> (forall x. Rep CronTriggerStats x -> CronTriggerStats)
-> Generic CronTriggerStats
forall x. Rep CronTriggerStats x -> CronTriggerStats
forall x. CronTriggerStats -> Rep CronTriggerStats x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CronTriggerStats -> Rep CronTriggerStats x
from :: forall x. CronTriggerStats -> Rep CronTriggerStats x
$cto :: forall x. Rep CronTriggerStats x -> CronTriggerStats
to :: forall x. Rep CronTriggerStats x -> CronTriggerStats
Generic)
instance J.ToJSON CronTriggerStats where
toJSON :: CronTriggerStats -> Value
toJSON = Options -> CronTriggerStats -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
J.genericToJSON Options
hasuraJSON
toEncoding :: CronTriggerStats -> Encoding
toEncoding = Options -> CronTriggerStats -> Encoding
forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
J.genericToEncoding Options
hasuraJSON
data FetchedCronTriggerStats = FetchedCronTriggerStats
{ FetchedCronTriggerStats -> [CronTriggerStats]
_fctsCronTriggers :: [CronTriggerStats],
FetchedCronTriggerStats -> Int
_fctsNumFetches :: Int
}
deriving (FetchedCronTriggerStats -> FetchedCronTriggerStats -> Bool
(FetchedCronTriggerStats -> FetchedCronTriggerStats -> Bool)
-> (FetchedCronTriggerStats -> FetchedCronTriggerStats -> Bool)
-> Eq FetchedCronTriggerStats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FetchedCronTriggerStats -> FetchedCronTriggerStats -> Bool
== :: FetchedCronTriggerStats -> FetchedCronTriggerStats -> Bool
$c/= :: FetchedCronTriggerStats -> FetchedCronTriggerStats -> Bool
/= :: FetchedCronTriggerStats -> FetchedCronTriggerStats -> Bool
Eq, (forall x.
FetchedCronTriggerStats -> Rep FetchedCronTriggerStats x)
-> (forall x.
Rep FetchedCronTriggerStats x -> FetchedCronTriggerStats)
-> Generic FetchedCronTriggerStats
forall x. Rep FetchedCronTriggerStats x -> FetchedCronTriggerStats
forall x. FetchedCronTriggerStats -> Rep FetchedCronTriggerStats x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FetchedCronTriggerStats -> Rep FetchedCronTriggerStats x
from :: forall x. FetchedCronTriggerStats -> Rep FetchedCronTriggerStats x
$cto :: forall x. Rep FetchedCronTriggerStats x -> FetchedCronTriggerStats
to :: forall x. Rep FetchedCronTriggerStats x -> FetchedCronTriggerStats
Generic)
instance J.ToJSON FetchedCronTriggerStats where
toJSON :: FetchedCronTriggerStats -> Value
toJSON = Options -> FetchedCronTriggerStats -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
J.genericToJSON Options
hasuraJSON
toEncoding :: FetchedCronTriggerStats -> Encoding
toEncoding = Options -> FetchedCronTriggerStats -> Encoding
forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
J.genericToEncoding Options
hasuraJSON
instance L.ToEngineLog FetchedCronTriggerStats L.Hasura where
toEngineLog :: FetchedCronTriggerStats -> (LogLevel, EngineLogType Hasura, Value)
toEngineLog FetchedCronTriggerStats
stats =
(LogLevel
L.LevelInfo, EngineLogType Hasura
L.cronEventGeneratorProcessType, FetchedCronTriggerStats -> Value
forall a. ToJSON a => a -> Value
J.toJSON FetchedCronTriggerStats
stats)
instance Semigroup FetchedCronTriggerStats where
(FetchedCronTriggerStats [CronTriggerStats]
lTriggers Int
lFetches) <> :: FetchedCronTriggerStats
-> FetchedCronTriggerStats -> FetchedCronTriggerStats
<> (FetchedCronTriggerStats [CronTriggerStats]
rTriggers Int
rFetches) =
[CronTriggerStats] -> Int -> FetchedCronTriggerStats
FetchedCronTriggerStats ([CronTriggerStats]
lTriggers [CronTriggerStats] -> [CronTriggerStats] -> [CronTriggerStats]
forall a. Semigroup a => a -> a -> a
<> [CronTriggerStats]
rTriggers) (Int
lFetches Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
rFetches)
instance Monoid FetchedCronTriggerStats where
mempty :: FetchedCronTriggerStats
mempty = [CronTriggerStats] -> Int -> FetchedCronTriggerStats
FetchedCronTriggerStats [CronTriggerStats]
forall a. Monoid a => a
mempty Int
0
type FetchedCronTriggerStatsLogger = FDebounce.Trigger FetchedCronTriggerStats FetchedCronTriggerStats
data RetryContext = RetryContext
{ RetryContext -> Int
_rctxTries :: !Int,
RetryContext -> STRetryConf
_rctxConf :: !STRetryConf
}
deriving (RetryContext -> RetryContext -> Bool
(RetryContext -> RetryContext -> Bool)
-> (RetryContext -> RetryContext -> Bool) -> Eq RetryContext
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RetryContext -> RetryContext -> Bool
== :: RetryContext -> RetryContext -> Bool
$c/= :: RetryContext -> RetryContext -> Bool
/= :: RetryContext -> RetryContext -> Bool
Eq)
data ScheduledEventWebhookPayload = ScheduledEventWebhookPayload
{ ScheduledEventWebhookPayload -> EventId
sewpId :: !EventId,
ScheduledEventWebhookPayload -> Maybe TriggerName
sewpName :: !(Maybe TriggerName),
ScheduledEventWebhookPayload -> UTCTime
sewpScheduledTime :: !UTCTime,
ScheduledEventWebhookPayload -> Value
sewpPayload :: !J.Value,
:: !(Maybe Text),
ScheduledEventWebhookPayload -> Maybe UTCTime
sewpCreatedAt :: !(Maybe UTCTime),
ScheduledEventWebhookPayload -> Maybe RequestTransform
sewpRequestTransform :: !(Maybe RequestTransform),
ScheduledEventWebhookPayload -> Maybe MetadataResponseTransform
sewpResponseTransform :: !(Maybe MetadataResponseTransform)
}
deriving (Int -> ScheduledEventWebhookPayload -> ShowS
[ScheduledEventWebhookPayload] -> ShowS
ScheduledEventWebhookPayload -> String
(Int -> ScheduledEventWebhookPayload -> ShowS)
-> (ScheduledEventWebhookPayload -> String)
-> ([ScheduledEventWebhookPayload] -> ShowS)
-> Show ScheduledEventWebhookPayload
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ScheduledEventWebhookPayload -> ShowS
showsPrec :: Int -> ScheduledEventWebhookPayload -> ShowS
$cshow :: ScheduledEventWebhookPayload -> String
show :: ScheduledEventWebhookPayload -> String
$cshowList :: [ScheduledEventWebhookPayload] -> ShowS
showList :: [ScheduledEventWebhookPayload] -> ShowS
Show, (forall x.
ScheduledEventWebhookPayload -> Rep ScheduledEventWebhookPayload x)
-> (forall x.
Rep ScheduledEventWebhookPayload x -> ScheduledEventWebhookPayload)
-> Generic ScheduledEventWebhookPayload
forall x.
Rep ScheduledEventWebhookPayload x -> ScheduledEventWebhookPayload
forall x.
ScheduledEventWebhookPayload -> Rep ScheduledEventWebhookPayload x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
ScheduledEventWebhookPayload -> Rep ScheduledEventWebhookPayload x
from :: forall x.
ScheduledEventWebhookPayload -> Rep ScheduledEventWebhookPayload x
$cto :: forall x.
Rep ScheduledEventWebhookPayload x -> ScheduledEventWebhookPayload
to :: forall x.
Rep ScheduledEventWebhookPayload x -> ScheduledEventWebhookPayload
Generic, ScheduledEventWebhookPayload
-> ScheduledEventWebhookPayload -> Bool
(ScheduledEventWebhookPayload
-> ScheduledEventWebhookPayload -> Bool)
-> (ScheduledEventWebhookPayload
-> ScheduledEventWebhookPayload -> Bool)
-> Eq ScheduledEventWebhookPayload
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ScheduledEventWebhookPayload
-> ScheduledEventWebhookPayload -> Bool
== :: ScheduledEventWebhookPayload
-> ScheduledEventWebhookPayload -> Bool
$c/= :: ScheduledEventWebhookPayload
-> ScheduledEventWebhookPayload -> Bool
/= :: ScheduledEventWebhookPayload
-> ScheduledEventWebhookPayload -> Bool
Eq)
instance J.ToJSON ScheduledEventWebhookPayload where
toJSON :: ScheduledEventWebhookPayload -> Value
toJSON = Options -> ScheduledEventWebhookPayload -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
J.genericToJSON Options
hasuraJSON {omitNothingFields :: Bool
J.omitNothingFields = Bool
True}
toEncoding :: ScheduledEventWebhookPayload -> Encoding
toEncoding = Options -> ScheduledEventWebhookPayload -> Encoding
forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
J.genericToEncoding Options
hasuraJSON {omitNothingFields :: Bool
J.omitNothingFields = Bool
True}
data ScheduledEventOp
= SEOpRetry !UTCTime
| SEOpStatus !ScheduledEventStatus
deriving (Int -> ScheduledEventOp -> ShowS
[ScheduledEventOp] -> ShowS
ScheduledEventOp -> String
(Int -> ScheduledEventOp -> ShowS)
-> (ScheduledEventOp -> String)
-> ([ScheduledEventOp] -> ShowS)
-> Show ScheduledEventOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ScheduledEventOp -> ShowS
showsPrec :: Int -> ScheduledEventOp -> ShowS
$cshow :: ScheduledEventOp -> String
show :: ScheduledEventOp -> String
$cshowList :: [ScheduledEventOp] -> ShowS
showList :: [ScheduledEventOp] -> ShowS
Show, ScheduledEventOp -> ScheduledEventOp -> Bool
(ScheduledEventOp -> ScheduledEventOp -> Bool)
-> (ScheduledEventOp -> ScheduledEventOp -> Bool)
-> Eq ScheduledEventOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ScheduledEventOp -> ScheduledEventOp -> Bool
== :: ScheduledEventOp -> ScheduledEventOp -> Bool
$c/= :: ScheduledEventOp -> ScheduledEventOp -> Bool
/= :: ScheduledEventOp -> ScheduledEventOp -> Bool
Eq)
newtype CronEventsCount = CronEventsCount {CronEventsCount -> Int
unCronEventsCount :: Int}
deriving (CronEventsCount -> CronEventsCount -> Bool
(CronEventsCount -> CronEventsCount -> Bool)
-> (CronEventsCount -> CronEventsCount -> Bool)
-> Eq CronEventsCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CronEventsCount -> CronEventsCount -> Bool
== :: CronEventsCount -> CronEventsCount -> Bool
$c/= :: CronEventsCount -> CronEventsCount -> Bool
/= :: CronEventsCount -> CronEventsCount -> Bool
Eq, Int -> CronEventsCount -> ShowS
[CronEventsCount] -> ShowS
CronEventsCount -> String
(Int -> CronEventsCount -> ShowS)
-> (CronEventsCount -> String)
-> ([CronEventsCount] -> ShowS)
-> Show CronEventsCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CronEventsCount -> ShowS
showsPrec :: Int -> CronEventsCount -> ShowS
$cshow :: CronEventsCount -> String
show :: CronEventsCount -> String
$cshowList :: [CronEventsCount] -> ShowS
showList :: [CronEventsCount] -> ShowS
Show, [CronEventsCount] -> Value
[CronEventsCount] -> Encoding
CronEventsCount -> Value
CronEventsCount -> Encoding
(CronEventsCount -> Value)
-> (CronEventsCount -> Encoding)
-> ([CronEventsCount] -> Value)
-> ([CronEventsCount] -> Encoding)
-> ToJSON CronEventsCount
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: CronEventsCount -> Value
toJSON :: CronEventsCount -> Value
$ctoEncoding :: CronEventsCount -> Encoding
toEncoding :: CronEventsCount -> Encoding
$ctoJSONList :: [CronEventsCount] -> Value
toJSONList :: [CronEventsCount] -> Value
$ctoEncodingList :: [CronEventsCount] -> Encoding
toEncodingList :: [CronEventsCount] -> Encoding
J.ToJSON, Value -> Parser [CronEventsCount]
Value -> Parser CronEventsCount
(Value -> Parser CronEventsCount)
-> (Value -> Parser [CronEventsCount]) -> FromJSON CronEventsCount
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser CronEventsCount
parseJSON :: Value -> Parser CronEventsCount
$cparseJSONList :: Value -> Parser [CronEventsCount]
parseJSONList :: Value -> Parser [CronEventsCount]
J.FromJSON, Integer -> CronEventsCount
CronEventsCount -> CronEventsCount
CronEventsCount -> CronEventsCount -> CronEventsCount
(CronEventsCount -> CronEventsCount -> CronEventsCount)
-> (CronEventsCount -> CronEventsCount -> CronEventsCount)
-> (CronEventsCount -> CronEventsCount -> CronEventsCount)
-> (CronEventsCount -> CronEventsCount)
-> (CronEventsCount -> CronEventsCount)
-> (CronEventsCount -> CronEventsCount)
-> (Integer -> CronEventsCount)
-> Num CronEventsCount
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: CronEventsCount -> CronEventsCount -> CronEventsCount
+ :: CronEventsCount -> CronEventsCount -> CronEventsCount
$c- :: CronEventsCount -> CronEventsCount -> CronEventsCount
- :: CronEventsCount -> CronEventsCount -> CronEventsCount
$c* :: CronEventsCount -> CronEventsCount -> CronEventsCount
* :: CronEventsCount -> CronEventsCount -> CronEventsCount
$cnegate :: CronEventsCount -> CronEventsCount
negate :: CronEventsCount -> CronEventsCount
$cabs :: CronEventsCount -> CronEventsCount
abs :: CronEventsCount -> CronEventsCount
$csignum :: CronEventsCount -> CronEventsCount
signum :: CronEventsCount -> CronEventsCount
$cfromInteger :: Integer -> CronEventsCount
fromInteger :: Integer -> CronEventsCount
Num)
newtype OneOffScheduledEventsCount = OneOffScheduledEventsCount {OneOffScheduledEventsCount -> Int
unOneOffScheduledEventsCount :: Int}
deriving (OneOffScheduledEventsCount -> OneOffScheduledEventsCount -> Bool
(OneOffScheduledEventsCount -> OneOffScheduledEventsCount -> Bool)
-> (OneOffScheduledEventsCount
-> OneOffScheduledEventsCount -> Bool)
-> Eq OneOffScheduledEventsCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OneOffScheduledEventsCount -> OneOffScheduledEventsCount -> Bool
== :: OneOffScheduledEventsCount -> OneOffScheduledEventsCount -> Bool
$c/= :: OneOffScheduledEventsCount -> OneOffScheduledEventsCount -> Bool
/= :: OneOffScheduledEventsCount -> OneOffScheduledEventsCount -> Bool
Eq, Int -> OneOffScheduledEventsCount -> ShowS
[OneOffScheduledEventsCount] -> ShowS
OneOffScheduledEventsCount -> String
(Int -> OneOffScheduledEventsCount -> ShowS)
-> (OneOffScheduledEventsCount -> String)
-> ([OneOffScheduledEventsCount] -> ShowS)
-> Show OneOffScheduledEventsCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OneOffScheduledEventsCount -> ShowS
showsPrec :: Int -> OneOffScheduledEventsCount -> ShowS
$cshow :: OneOffScheduledEventsCount -> String
show :: OneOffScheduledEventsCount -> String
$cshowList :: [OneOffScheduledEventsCount] -> ShowS
showList :: [OneOffScheduledEventsCount] -> ShowS
Show, [OneOffScheduledEventsCount] -> Value
[OneOffScheduledEventsCount] -> Encoding
OneOffScheduledEventsCount -> Value
OneOffScheduledEventsCount -> Encoding
(OneOffScheduledEventsCount -> Value)
-> (OneOffScheduledEventsCount -> Encoding)
-> ([OneOffScheduledEventsCount] -> Value)
-> ([OneOffScheduledEventsCount] -> Encoding)
-> ToJSON OneOffScheduledEventsCount
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: OneOffScheduledEventsCount -> Value
toJSON :: OneOffScheduledEventsCount -> Value
$ctoEncoding :: OneOffScheduledEventsCount -> Encoding
toEncoding :: OneOffScheduledEventsCount -> Encoding
$ctoJSONList :: [OneOffScheduledEventsCount] -> Value
toJSONList :: [OneOffScheduledEventsCount] -> Value
$ctoEncodingList :: [OneOffScheduledEventsCount] -> Encoding
toEncodingList :: [OneOffScheduledEventsCount] -> Encoding
J.ToJSON, Value -> Parser [OneOffScheduledEventsCount]
Value -> Parser OneOffScheduledEventsCount
(Value -> Parser OneOffScheduledEventsCount)
-> (Value -> Parser [OneOffScheduledEventsCount])
-> FromJSON OneOffScheduledEventsCount
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser OneOffScheduledEventsCount
parseJSON :: Value -> Parser OneOffScheduledEventsCount
$cparseJSONList :: Value -> Parser [OneOffScheduledEventsCount]
parseJSONList :: Value -> Parser [OneOffScheduledEventsCount]
J.FromJSON, Integer -> OneOffScheduledEventsCount
OneOffScheduledEventsCount -> OneOffScheduledEventsCount
OneOffScheduledEventsCount
-> OneOffScheduledEventsCount -> OneOffScheduledEventsCount
(OneOffScheduledEventsCount
-> OneOffScheduledEventsCount -> OneOffScheduledEventsCount)
-> (OneOffScheduledEventsCount
-> OneOffScheduledEventsCount -> OneOffScheduledEventsCount)
-> (OneOffScheduledEventsCount
-> OneOffScheduledEventsCount -> OneOffScheduledEventsCount)
-> (OneOffScheduledEventsCount -> OneOffScheduledEventsCount)
-> (OneOffScheduledEventsCount -> OneOffScheduledEventsCount)
-> (OneOffScheduledEventsCount -> OneOffScheduledEventsCount)
-> (Integer -> OneOffScheduledEventsCount)
-> Num OneOffScheduledEventsCount
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: OneOffScheduledEventsCount
-> OneOffScheduledEventsCount -> OneOffScheduledEventsCount
+ :: OneOffScheduledEventsCount
-> OneOffScheduledEventsCount -> OneOffScheduledEventsCount
$c- :: OneOffScheduledEventsCount
-> OneOffScheduledEventsCount -> OneOffScheduledEventsCount
- :: OneOffScheduledEventsCount
-> OneOffScheduledEventsCount -> OneOffScheduledEventsCount
$c* :: OneOffScheduledEventsCount
-> OneOffScheduledEventsCount -> OneOffScheduledEventsCount
* :: OneOffScheduledEventsCount
-> OneOffScheduledEventsCount -> OneOffScheduledEventsCount
$cnegate :: OneOffScheduledEventsCount -> OneOffScheduledEventsCount
negate :: OneOffScheduledEventsCount -> OneOffScheduledEventsCount
$cabs :: OneOffScheduledEventsCount -> OneOffScheduledEventsCount
abs :: OneOffScheduledEventsCount -> OneOffScheduledEventsCount
$csignum :: OneOffScheduledEventsCount -> OneOffScheduledEventsCount
signum :: OneOffScheduledEventsCount -> OneOffScheduledEventsCount
$cfromInteger :: Integer -> OneOffScheduledEventsCount
fromInteger :: Integer -> OneOffScheduledEventsCount
Num)
data FetchedScheduledEventsStats = FetchedScheduledEventsStats
{ FetchedScheduledEventsStats -> CronEventsCount
_fsesNumCronEventsFetched :: CronEventsCount,
FetchedScheduledEventsStats -> OneOffScheduledEventsCount
_fsesNumOneOffScheduledEventsFetched :: OneOffScheduledEventsCount,
FetchedScheduledEventsStats -> Int
_fsesNumFetches :: Int
}
deriving (FetchedScheduledEventsStats -> FetchedScheduledEventsStats -> Bool
(FetchedScheduledEventsStats
-> FetchedScheduledEventsStats -> Bool)
-> (FetchedScheduledEventsStats
-> FetchedScheduledEventsStats -> Bool)
-> Eq FetchedScheduledEventsStats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FetchedScheduledEventsStats -> FetchedScheduledEventsStats -> Bool
== :: FetchedScheduledEventsStats -> FetchedScheduledEventsStats -> Bool
$c/= :: FetchedScheduledEventsStats -> FetchedScheduledEventsStats -> Bool
/= :: FetchedScheduledEventsStats -> FetchedScheduledEventsStats -> Bool
Eq, (forall x.
FetchedScheduledEventsStats -> Rep FetchedScheduledEventsStats x)
-> (forall x.
Rep FetchedScheduledEventsStats x -> FetchedScheduledEventsStats)
-> Generic FetchedScheduledEventsStats
forall x.
Rep FetchedScheduledEventsStats x -> FetchedScheduledEventsStats
forall x.
FetchedScheduledEventsStats -> Rep FetchedScheduledEventsStats x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
FetchedScheduledEventsStats -> Rep FetchedScheduledEventsStats x
from :: forall x.
FetchedScheduledEventsStats -> Rep FetchedScheduledEventsStats x
$cto :: forall x.
Rep FetchedScheduledEventsStats x -> FetchedScheduledEventsStats
to :: forall x.
Rep FetchedScheduledEventsStats x -> FetchedScheduledEventsStats
Generic, Int -> FetchedScheduledEventsStats -> ShowS
[FetchedScheduledEventsStats] -> ShowS
FetchedScheduledEventsStats -> String
(Int -> FetchedScheduledEventsStats -> ShowS)
-> (FetchedScheduledEventsStats -> String)
-> ([FetchedScheduledEventsStats] -> ShowS)
-> Show FetchedScheduledEventsStats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FetchedScheduledEventsStats -> ShowS
showsPrec :: Int -> FetchedScheduledEventsStats -> ShowS
$cshow :: FetchedScheduledEventsStats -> String
show :: FetchedScheduledEventsStats -> String
$cshowList :: [FetchedScheduledEventsStats] -> ShowS
showList :: [FetchedScheduledEventsStats] -> ShowS
Show)
instance J.ToJSON FetchedScheduledEventsStats where
toJSON :: FetchedScheduledEventsStats -> Value
toJSON = Options -> FetchedScheduledEventsStats -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
J.genericToJSON Options
hasuraJSON
toEncoding :: FetchedScheduledEventsStats -> Encoding
toEncoding = Options -> FetchedScheduledEventsStats -> Encoding
forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
J.genericToEncoding Options
hasuraJSON
instance L.ToEngineLog FetchedScheduledEventsStats L.Hasura where
toEngineLog :: FetchedScheduledEventsStats
-> (LogLevel, EngineLogType Hasura, Value)
toEngineLog FetchedScheduledEventsStats
stats =
(LogLevel
L.LevelInfo, EngineLogType Hasura
L.scheduledTriggerProcessLogType, FetchedScheduledEventsStats -> Value
forall a. ToJSON a => a -> Value
J.toJSON FetchedScheduledEventsStats
stats)
instance Semigroup FetchedScheduledEventsStats where
(FetchedScheduledEventsStats CronEventsCount
lCron OneOffScheduledEventsCount
lOneOff Int
lFetches) <> :: FetchedScheduledEventsStats
-> FetchedScheduledEventsStats -> FetchedScheduledEventsStats
<> (FetchedScheduledEventsStats CronEventsCount
rCron OneOffScheduledEventsCount
rOneOff Int
rFetches) =
CronEventsCount
-> OneOffScheduledEventsCount -> Int -> FetchedScheduledEventsStats
FetchedScheduledEventsStats (CronEventsCount
lCron CronEventsCount -> CronEventsCount -> CronEventsCount
forall a. Num a => a -> a -> a
+ CronEventsCount
rCron) (OneOffScheduledEventsCount
lOneOff OneOffScheduledEventsCount
-> OneOffScheduledEventsCount -> OneOffScheduledEventsCount
forall a. Num a => a -> a -> a
+ OneOffScheduledEventsCount
rOneOff) (Int
lFetches Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
rFetches)
instance Monoid FetchedScheduledEventsStats where
mempty :: FetchedScheduledEventsStats
mempty = CronEventsCount
-> OneOffScheduledEventsCount -> Int -> FetchedScheduledEventsStats
FetchedScheduledEventsStats (Int -> CronEventsCount
CronEventsCount Int
0) (Int -> OneOffScheduledEventsCount
OneOffScheduledEventsCount Int
0) Int
0
type FetchedScheduledEventsStatsLogger = FDebounce.Trigger FetchedScheduledEventsStats FetchedScheduledEventsStats