prodapi-0.1.0.0: Some curated and opinionated packages for building Haskell services.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Prod.Healthcheck

Synopsis

Documentation

type Host = Text Source #

type Port = Int Source #

data Track Source #

Instances

Instances details
Show Track Source # 
Instance details

Defined in Prod.Healthcheck

Methods

showsPrec :: Int -> Track -> ShowS #

show :: Track -> String #

showList :: [Track] -> ShowS #

data Check Source #

Instances

Instances details
FromJSON Check Source # 
Instance details

Defined in Prod.Healthcheck

ToJSON Check Source # 
Instance details

Defined in Prod.Healthcheck

Generic Check Source # 
Instance details

Defined in Prod.Healthcheck

Associated Types

type Rep Check :: Type -> Type #

Methods

from :: Check -> Rep Check x #

to :: Rep Check x -> Check #

Show Check Source # 
Instance details

Defined in Prod.Healthcheck

Methods

showsPrec :: Int -> Check -> ShowS #

show :: Check -> String #

showList :: [Check] -> ShowS #

type Rep Check Source # 
Instance details

Defined in Prod.Healthcheck

data CheckSummary Source #

Instances

Instances details
FromJSON CheckSummary Source # 
Instance details

Defined in Prod.Healthcheck

ToJSON CheckSummary Source # 
Instance details

Defined in Prod.Healthcheck

Generic CheckSummary Source # 
Instance details

Defined in Prod.Healthcheck

Associated Types

type Rep CheckSummary :: Type -> Type #

Show CheckSummary Source # 
Instance details

Defined in Prod.Healthcheck

type Rep CheckSummary Source # 
Instance details

Defined in Prod.Healthcheck

type Rep CheckSummary = D1 ('MetaData "CheckSummary" "Prod.Healthcheck" "prodapi-0.1.0.0-JQUOoBQvqFbCBOZ6p0aEZ7" 'False) (C1 ('MetaCons "CheckSummary" 'PrefixI 'True) (S1 ('MetaSel ('Just "lastReady") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Check)) :*: S1 ('MetaSel ('Just "recentChecks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Either Error Check])))

healthChecked :: CheckSummary -> Bool Source #

Predicate to tell if a Summary contains a long-enough check history to be considered.

neverHealthy :: CheckSummary -> Bool Source #

Predicate to tell if a Summary contains no recent successful healthcheck.

recentlyHealthy :: CheckSummary -> Bool Source #

Predicate to tell if the most recent summary exists and is successful.

type WithSpaceCounter = (Counter -> IO ()) -> IO () Source #

setChecks :: Space -> [(Host, Port)] -> IO () Source #

setChecksFromDNSDiscovery :: Space -> DNSTrack [(Host, Port)] -> IO () Source #

Helper to build a Tracer to update hosts to check based on DNS-discovered answers. Note that the DNSTrack only gives Host, so you need to fmap the port.

addChecksFromDNSDiscovery :: Space -> DNSTrack [(Host, Port)] -> IO () Source #

Same as setChecksFromDNSDiscovery but only adding new checks. You should clear checks of permanently invalid backends.

healthyKeys :: SummaryMap -> [(Host, Port)] Source #

Returns the set of (Host,Port) that are healthy in a given SummaryMap.

Healthiness consists in having the latest healthcheck as healthy.

deadKeys :: SummaryMap -> [(Host, Port)] Source #

Returns the set of (Host,Port) that have no recent successful activity provided there is enough health-checking history.

safeHead :: [a] -> Maybe a Source #

withSpace :: Runtime -> Namespace -> (Space -> IO a) -> IO a Source #

initRuntimeSpace :: Runtime -> Namespace -> IO Space Source #

Only create a space (no registration).