-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Datadog client for Haskell. Supports both the HTTP API and StatsD. -- -- Datadog client for Haskell. Supports both the HTTP API and StatsD. @package datadog @version 0.2.5.0 module Network.Datadog.Types newtype Timestamp Timestamp :: NominalDiffTime -> Timestamp [fromTimestamp] :: Timestamp -> NominalDiffTime newtype Write Write :: ByteString -> Write [writeApiKey] :: Write -> ByteString data ReadWrite ReadWrite :: ByteString -> ByteString -> ReadWrite [readWriteApiKey] :: ReadWrite -> ByteString [readWriteApplicationKey] :: ReadWrite -> ByteString data DatadogClient a DatadogClient :: Manager -> a -> DatadogClient a [datadogClientManager] :: DatadogClient a -> Manager [datadogClientKeys] :: DatadogClient a -> a -- | Wraps the keys needed by Datadog to fully access the API. data Keys Keys :: String -> String -> Keys [apiKey] :: Keys -> String [appKey] :: Keys -> String -- | An Environment contains everything needed to interact with Datadog. data Environment Environment :: Keys -> String -> Manager -> Environment -- | Auth keys to permit communication with Datadog [environmentKeys] :: Environment -> Keys -- | The root URL for the Datadog API [environmentApiUrl] :: Environment -> String -- | HTTP manager used to make requests to Datadog [environmentManager] :: Environment -> Manager -- | Entity descriptor. -- -- Entities in Datadog (hosts, metrics, events, etc) are frequently -- associated with one more more "tags". These tags are labels that -- identify an entity as belonging to a particular group or having -- particular properties. A tag can come in two forms: a simple text -- label, describing entities associated with the tag, or a key-value -- pair, associating entities with a specific slice of a larger -- categorization. -- -- As strings, the key and value parts of a key-value pair are separated -- by a (:). As such, any tag with no colons is a label, and any -- tag with one (or more) is a key-value pair - if more than one -- : is specified, the additional :s will become part -- of the value. data Tag KeyValueTag :: Text -> Text -> Tag LabelTag :: Text -> Tag -- | The status of a service, based on a check that is run against it. data CheckStatus -- | Everything is as it should be. CheckOk :: CheckStatus -- | Something abnormal, but not critical, is amiss. CheckWarning :: CheckStatus -- | Something dangerously critical is amiss. CheckCritical :: CheckStatus -- | The current status cannot be determined. CheckUnknown :: CheckStatus -- | The result of running a check on some service. data CheckResult CheckResult :: Text -> Text -> CheckStatus -> Maybe UTCTime -> Maybe Text -> [Tag] -> CheckResult -- | Text describing the check [checkResultCheck] :: CheckResult -> Text -- | Name of the host which the check applies to [checkResultHostName] :: CheckResult -> Text -- | Status result of the check [checkResultStatus] :: CheckResult -> CheckStatus -- | Time at which the check occurred (Nothing will wait until the check is -- sent to Datadog to compute the time) [checkResultTimestamp] :: CheckResult -> Maybe UTCTime -- | Information related to why this specific check run supplied the status -- it did [checkResultMessage] :: CheckResult -> Maybe Text -- | Tags to associate with this check run [checkResultTags] :: CheckResult -> [Tag] -- | A description of when downtime should occur. data DowntimeSpec DowntimeSpec :: Maybe UTCTime -> Maybe UTCTime -> Maybe Text -> Tag -> DowntimeSpec -- | When to start the downtime (or immediately) [downtimeSpecStart] :: DowntimeSpec -> Maybe UTCTime -- | When to stop the downtime (or indefinitely) [downtimeSpecEnd] :: DowntimeSpec -> Maybe UTCTime -- | A message to include with notifications for this downtime [downtimeSpecMessage] :: DowntimeSpec -> Maybe Text -- | The scope to apply downtime to (if applying downtime to a host, use a -- tag of the form "host:hostname", NOT just "hostname") [downtimeSpecScope] :: DowntimeSpec -> Tag -- | Datadog's internal reference to a specific donwtime instance. type DowntimeId = Int -- | A scheduled donwtime stored in Datadog. data Downtime Downtime :: DowntimeId -> DowntimeSpec -> Downtime -- | Datadog's unique reference to the scheduled downtime [downtimeId'] :: Downtime -> DowntimeId -- | Context on the downtime schedule [downtimeSpec] :: Downtime -> DowntimeSpec -- | A set of priorities used to denote the importance of an event. data EventPriority NormalPriority :: EventPriority LowPriority :: EventPriority -- | The failure levels for an alert. data AlertType Error :: AlertType Warning :: AlertType Info :: AlertType Success :: AlertType -- | A source from which an event may originate, recognized by Datadog. data SourceType Nagios :: SourceType Hudson :: SourceType Jenkins :: SourceType User :: SourceType MyApps :: SourceType Feed :: SourceType Chef :: SourceType Puppet :: SourceType Git :: SourceType BitBucket :: SourceType Fabric :: SourceType Capistrano :: SourceType -- | Details that describe an event. data EventSpec EventSpec :: Text -> Text -> UTCTime -> EventPriority -> Maybe Text -> [Tag] -> AlertType -> Maybe SourceType -> EventSpec [eventSpecTitle] :: EventSpec -> Text -- | The description/body of the event [eventSpecText] :: EventSpec -> Text -- | The time at which the event occurred [eventSpecDateHappened] :: EventSpec -> UTCTime [eventSpecPriority] :: EventSpec -> EventPriority -- | The hostname associated with the event [eventSpecHost] :: EventSpec -> Maybe Text [eventSpecTags] :: EventSpec -> [Tag] [eventSpecAlertType] :: EventSpec -> AlertType -- | The trigger of the event (if identifiable) [eventSpecSourceType] :: EventSpec -> Maybe SourceType -- | Datadog's internal reference to a specific event. type EventId = Int -- | An event stored within Datadog. An event represents some sort of -- occurrence that was recorded in Datadog. data Event Event :: EventId -> EventSpec -> Event -- | Datadog's unique reference to the event [eventId'] :: Event -> EventId -- | Context on what happened during this event [eventDetails] :: Event -> EventSpec data WrappedEvent WrappedEvent :: Event -> WrappedEvent [wrappedEvent] :: WrappedEvent -> Event data WrappedEvents WrappedEvents :: [Event] -> WrappedEvents [wrappedEvents] :: WrappedEvents -> [Event] newtype Series Series :: DList Metric -> Series [fromSeries] :: Series -> DList Metric data MetricPoints Gauge :: [(POSIXTime, Float)] -> MetricPoints Counter :: [(POSIXTime, Int64)] -> MetricPoints data Metric Metric :: Text -> MetricPoints -> Maybe Text -> [Text] -> Metric [metricName] :: Metric -> Text [metricPoints] :: Metric -> MetricPoints [metricHost] :: Metric -> Maybe Text [metricTags] :: Metric -> [Text] -- | Each monitor is of a specific type, which determines what sort of -- check the monitor performs. data MonitorType -- | Watches a (combination of) metric(s), alerting when it crosses some -- threshold. MetricAlert :: MonitorType -- | Watches a service and alerts when the service enters a failing state. ServiceCheck :: MonitorType -- | Checks the event stream for events meeting certain criteria. EventAlert :: MonitorType -- | Advanced configuration parameters for a monitor. data MonitorOptions MonitorOptions :: HashMap Text (Maybe Integer) -> Bool -> Maybe Integer -> Maybe Integer -> Maybe Integer -> Text -> Bool -> MonitorOptions [monitorOptionsSilenced] :: MonitorOptions -> HashMap Text (Maybe Integer) [monitorOptionsNotifyNoData] :: MonitorOptions -> Bool [monitorOptionsNoDataTimeframe] :: MonitorOptions -> Maybe Integer [monitorOptionsTimeoutH] :: MonitorOptions -> Maybe Integer [monitorOptionsRenotifyInterval] :: MonitorOptions -> Maybe Integer [monitorOptionsEscalationMessage] :: MonitorOptions -> Text [monitorOptionsNotifyAudit] :: MonitorOptions -> Bool -- | A representation of a monitor's configuration, from which a monitor -- could be rebuilt. data MonitorSpec MonitorSpec :: MonitorType -> Text -> Maybe Text -> Maybe Text -> MonitorOptions -> MonitorSpec [monitorSpecType'] :: MonitorSpec -> MonitorType -- | The query string the monitor uses to determine its state. [monitorSpecQuery] :: MonitorSpec -> Text -- | The human-readable name of the monitor. [monitorSpecName] :: MonitorSpec -> Maybe Text -- | The message sent with the notification when the monitor is triggered. [monitorSpecMessage] :: MonitorSpec -> Maybe Text -- | Optional configuration parameters specifying advanced monitor -- beahviour. [monitorSpecOptions] :: MonitorSpec -> MonitorOptions -- | Datadog's internal reference to a specific monitor. type MonitorId = Int -- | A Datadog monitor. These monitors actively check multiple different -- types of data within Datadog against user-provided conditions, -- triggering notifications when condition(s) are met. data Monitor Monitor :: MonitorId -> MonitorSpec -> Monitor -- | Datadog's internal reference to this specific monitor. [monitorId'] :: Monitor -> MonitorId -- | The specification from which this monitor can be re-created. [monitorSpec] :: Monitor -> MonitorSpec instance GHC.Classes.Eq Network.Datadog.Types.Monitor instance GHC.Classes.Eq Network.Datadog.Types.MonitorSpec instance GHC.Classes.Eq Network.Datadog.Types.MonitorOptions instance GHC.Classes.Eq Network.Datadog.Types.MonitorType instance GHC.Base.Monoid Network.Datadog.Types.Series instance GHC.Base.Semigroup Network.Datadog.Types.Series instance GHC.Show.Show Network.Datadog.Types.Event instance GHC.Classes.Eq Network.Datadog.Types.Event instance GHC.Show.Show Network.Datadog.Types.EventSpec instance GHC.Classes.Eq Network.Datadog.Types.EventSpec instance GHC.Classes.Eq Network.Datadog.Types.SourceType instance GHC.Classes.Eq Network.Datadog.Types.AlertType instance GHC.Classes.Eq Network.Datadog.Types.EventPriority instance GHC.Classes.Eq Network.Datadog.Types.Downtime instance GHC.Classes.Eq Network.Datadog.Types.DowntimeSpec instance GHC.Classes.Eq Network.Datadog.Types.CheckResult instance GHC.Classes.Eq Network.Datadog.Types.CheckStatus instance GHC.Classes.Eq Network.Datadog.Types.Tag instance GHC.Classes.Eq Network.Datadog.Types.Keys instance GHC.Show.Show Network.Datadog.Types.MonitorType instance GHC.Show.Show Network.Datadog.Types.SourceType instance GHC.Show.Show Network.Datadog.Types.AlertType instance GHC.Show.Show Network.Datadog.Types.EventPriority instance GHC.Show.Show Network.Datadog.Types.Tag instance GHC.Read.Read Network.Datadog.Types.Tag module Network.Datadog.Lens instance Network.Datadog.Lens.AsMonitorType Network.Datadog.Types.MonitorType instance Network.Datadog.Lens.AsMetricPoints Network.Datadog.Types.MetricPoints instance Network.Datadog.Lens.AsSourceType Network.Datadog.Types.SourceType instance Network.Datadog.Lens.AsAlertType Network.Datadog.Types.AlertType instance Network.Datadog.Lens.AsEventPriority Network.Datadog.Types.EventPriority instance Network.Datadog.Lens.AsCheckStatus Network.Datadog.Types.CheckStatus instance Network.Datadog.Lens.AsTag Network.Datadog.Types.Tag instance Network.Datadog.Lens.HasId' Network.Datadog.Types.Monitor Network.Datadog.Types.MonitorId instance Network.Datadog.Lens.HasSpec Network.Datadog.Types.Monitor Network.Datadog.Types.MonitorSpec instance Network.Datadog.Lens.HasType' Network.Datadog.Types.MonitorSpec Network.Datadog.Types.MonitorType instance Network.Datadog.Lens.HasQuery Network.Datadog.Types.MonitorSpec Data.Text.Internal.Text instance Network.Datadog.Lens.HasOptions Network.Datadog.Types.MonitorSpec Network.Datadog.Types.MonitorOptions instance Network.Datadog.Lens.HasMessage Network.Datadog.Types.MonitorSpec (GHC.Maybe.Maybe Data.Text.Internal.Text) instance Network.Datadog.Lens.HasName Network.Datadog.Types.MonitorSpec (GHC.Maybe.Maybe Data.Text.Internal.Text) instance Network.Datadog.Lens.HasTimeoutH Network.Datadog.Types.MonitorOptions (GHC.Maybe.Maybe GHC.Integer.Type.Integer) instance Network.Datadog.Lens.HasSilenced Network.Datadog.Types.MonitorOptions (Data.HashMap.Base.HashMap Data.Text.Internal.Text (GHC.Maybe.Maybe GHC.Integer.Type.Integer)) instance Network.Datadog.Lens.HasRenotifyInterval Network.Datadog.Types.MonitorOptions (GHC.Maybe.Maybe GHC.Integer.Type.Integer) instance Network.Datadog.Lens.HasNotifyNoData Network.Datadog.Types.MonitorOptions GHC.Types.Bool instance Network.Datadog.Lens.HasNotifyAudit Network.Datadog.Types.MonitorOptions GHC.Types.Bool instance Network.Datadog.Lens.HasNoDataTimeframe Network.Datadog.Types.MonitorOptions (GHC.Maybe.Maybe GHC.Integer.Type.Integer) instance Network.Datadog.Lens.HasEscalationMessage Network.Datadog.Types.MonitorOptions Data.Text.Internal.Text instance Network.Datadog.Lens.HasPoints Network.Datadog.Types.Metric Network.Datadog.Types.MetricPoints instance Network.Datadog.Lens.HasName Network.Datadog.Types.Metric Data.Text.Internal.Text instance Network.Datadog.Lens.HasHost Network.Datadog.Types.Metric (GHC.Maybe.Maybe Data.Text.Internal.Text) instance Network.Datadog.Lens.HasTags Network.Datadog.Types.Metric [Data.Text.Internal.Text] instance Network.Datadog.Lens.HasDetails Network.Datadog.Types.Event Network.Datadog.Types.EventSpec instance Network.Datadog.Lens.HasId' Network.Datadog.Types.Event Network.Datadog.Types.EventId instance Network.Datadog.Lens.HasTitle Network.Datadog.Types.EventSpec Data.Text.Internal.Text instance Network.Datadog.Lens.HasText Network.Datadog.Types.EventSpec Data.Text.Internal.Text instance Network.Datadog.Lens.HasSourceType Network.Datadog.Types.EventSpec (GHC.Maybe.Maybe Network.Datadog.Types.SourceType) instance Network.Datadog.Lens.HasPriority Network.Datadog.Types.EventSpec Network.Datadog.Types.EventPriority instance Network.Datadog.Lens.HasHost Network.Datadog.Types.EventSpec (GHC.Maybe.Maybe Data.Text.Internal.Text) instance Network.Datadog.Lens.HasDateHappened Network.Datadog.Types.EventSpec Data.Time.Clock.Internal.UTCTime.UTCTime instance Network.Datadog.Lens.HasAlertType Network.Datadog.Types.EventSpec Network.Datadog.Types.AlertType instance Network.Datadog.Lens.HasTags Network.Datadog.Types.EventSpec [Network.Datadog.Types.Tag] instance Network.Datadog.Lens.HasSpec Network.Datadog.Types.Downtime Network.Datadog.Types.DowntimeSpec instance Network.Datadog.Lens.HasId' Network.Datadog.Types.Downtime Network.Datadog.Types.DowntimeId instance Network.Datadog.Lens.HasStart Network.Datadog.Types.DowntimeSpec (GHC.Maybe.Maybe Data.Time.Clock.Internal.UTCTime.UTCTime) instance Network.Datadog.Lens.HasScope Network.Datadog.Types.DowntimeSpec Network.Datadog.Types.Tag instance Network.Datadog.Lens.HasEnd Network.Datadog.Types.DowntimeSpec (GHC.Maybe.Maybe Data.Time.Clock.Internal.UTCTime.UTCTime) instance Network.Datadog.Lens.HasMessage Network.Datadog.Types.DowntimeSpec (GHC.Maybe.Maybe Data.Text.Internal.Text) instance Network.Datadog.Lens.HasTimestamp Network.Datadog.Types.CheckResult (GHC.Maybe.Maybe Data.Time.Clock.Internal.UTCTime.UTCTime) instance Network.Datadog.Lens.HasTags Network.Datadog.Types.CheckResult [Network.Datadog.Types.Tag] instance Network.Datadog.Lens.HasStatus Network.Datadog.Types.CheckResult Network.Datadog.Types.CheckStatus instance Network.Datadog.Lens.HasMessage Network.Datadog.Types.CheckResult (GHC.Maybe.Maybe Data.Text.Internal.Text) instance Network.Datadog.Lens.HasHostName Network.Datadog.Types.CheckResult Data.Text.Internal.Text instance Network.Datadog.Lens.HasCheck Network.Datadog.Types.CheckResult Data.Text.Internal.Text module Network.Datadog.Internal prependMaybe :: (a -> b) -> Maybe a -> [b] -> [b] prependBool :: Bool -> b -> [b] -> [b] datadogHttp :: Environment -> String -> [(String, String)] -> StdMethod -> Maybe ByteString -> IO ByteString decodeDatadog :: FromJSON a => String -> ByteString -> IO a baseRequest :: Request -- | Creates the most basic specification required by a monitor, containing -- the type of monitor and the query string used to detect the monitor's -- state. -- -- Generates a set of "default" Monitor options, which specify as little -- optional configuration as possible. This includes: -- --
-- main = do
-- env <- createEnvironment =<< loadKeysFromEnv
-- -- Check if the average bytes received in the last five minutes is >100 on host0
-- let query = "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100"
-- let mspec = minimalMonitorSpec MetricAlert query
-- monitor <- createMonitor env mspec
-- print $ mId monitor
--
module Network.Datadog.Monitor
-- | A representation of a monitor's configuration, from which a monitor
-- could be rebuilt.
data MonitorSpec
MonitorSpec :: MonitorType -> Text -> Maybe Text -> Maybe Text -> MonitorOptions -> MonitorSpec
[monitorSpecType'] :: MonitorSpec -> MonitorType
-- | The query string the monitor uses to determine its state.
[monitorSpecQuery] :: MonitorSpec -> Text
-- | The human-readable name of the monitor.
[monitorSpecName] :: MonitorSpec -> Maybe Text
-- | The message sent with the notification when the monitor is triggered.
[monitorSpecMessage] :: MonitorSpec -> Maybe Text
-- | Optional configuration parameters specifying advanced monitor
-- beahviour.
[monitorSpecOptions] :: MonitorSpec -> MonitorOptions
-- | Each monitor is of a specific type, which determines what sort of
-- check the monitor performs.
data MonitorType
-- | Watches a (combination of) metric(s), alerting when it crosses some
-- threshold.
MetricAlert :: MonitorType
-- | Watches a service and alerts when the service enters a failing state.
ServiceCheck :: MonitorType
-- | Checks the event stream for events meeting certain criteria.
EventAlert :: MonitorType
-- | Advanced configuration parameters for a monitor.
data MonitorOptions
MonitorOptions :: HashMap Text (Maybe Integer) -> Bool -> Maybe Integer -> Maybe Integer -> Maybe Integer -> Text -> Bool -> MonitorOptions
[monitorOptionsSilenced] :: MonitorOptions -> HashMap Text (Maybe Integer)
[monitorOptionsNotifyNoData] :: MonitorOptions -> Bool
[monitorOptionsNoDataTimeframe] :: MonitorOptions -> Maybe Integer
[monitorOptionsTimeoutH] :: MonitorOptions -> Maybe Integer
[monitorOptionsRenotifyInterval] :: MonitorOptions -> Maybe Integer
[monitorOptionsEscalationMessage] :: MonitorOptions -> Text
[monitorOptionsNotifyAudit] :: MonitorOptions -> Bool
-- | Provide a list of the silenced scopes for this monitor and the time at
-- which the silencer will expire (may be indefinite). The monitor
-- "*" refers to the monitor at large (un-scoped).
getSilencedMonitorScopes :: MonitorOptions -> [(Text, Maybe UTCTime)]
-- | Silence a given scope until some time (or indefinitely), replacing the
-- current silencer on the given scope if one already exists.
silenceMonitorScope :: Text -> Maybe UTCTime -> MonitorOptions -> MonitorOptions
-- | Remove the silencer from a given scope, if the scope is currently
-- silenced.
unsilenceMonitorScope :: Text -> MonitorOptions -> MonitorOptions
-- | Unsilence every scope in the monitor, including the global scope.
unsilenceAllMonitorScope :: MonitorOptions -> MonitorOptions
-- | Determine how long without data a monitor will go before notifying to
-- such, providing Nothing if the monitor will never notify on lack of
-- data.
doesNotifyOnNoMonitorData :: MonitorOptions -> Maybe NominalDiffTime
-- | Have the monitor notify when it does not receive data for some given
-- amount of time (rounded down to the nearest minute).
notifyOnNoMonitorData :: NominalDiffTime -> MonitorOptions -> MonitorOptions
-- | Prevent the monitor from notifying when it is missing data.
noNotifyOnNoMonitorData :: MonitorOptions -> MonitorOptions
-- | Determine after how long the monitor will stop alerting after it is
-- triggered, providing Nothing if the monitor will never stop alerting.
getMonitorTimeout :: MonitorOptions -> Maybe NominalDiffTime
-- | Have the monitor stop alerting some time after it is triggered
-- (rounded up to the nearest hour).
setMonitorTimeout :: NominalDiffTime -> MonitorOptions -> MonitorOptions
-- | Prevent the monitor from timing out after it is triggered.
clearMonitorTimeout :: MonitorOptions -> MonitorOptions
-- | Determine after how long after being triggered the monitor will
-- re-notify, and what message it will include in the re-notification (if
-- any), providing Nothing if the monitor will never re-notify.
doesRenotifyMonitor :: MonitorOptions -> Maybe (NominalDiffTime, Maybe Text)
-- | Have the monitor re-notify some amount of time after the most recent
-- notification (rounded down to the nearest minute) and optionally what
-- text it will include in the re-notification.
renotifyMonitor :: NominalDiffTime -> Maybe Text -> MonitorOptions -> MonitorOptions
-- | Prevent the monitor from re-notifying after it triggers an un-resolved
-- notification.
noRenotifyMonitor :: MonitorOptions -> MonitorOptions
-- | Determine if the monitor triggers a notification when it is modified.
doesNotifyOnAudit :: MonitorOptions -> Bool
-- | Have the monitor trigger a notification when it is modified.
notifyOnAudit :: MonitorOptions -> MonitorOptions
-- | Prevent the monitor from triggering a notification when it is
-- modified.
noNotifyOnAudit :: MonitorOptions -> MonitorOptions
-- | A Datadog monitor. These monitors actively check multiple different
-- types of data within Datadog against user-provided conditions,
-- triggering notifications when condition(s) are met.
data Monitor
Monitor :: MonitorId -> MonitorSpec -> Monitor
-- | Datadog's internal reference to this specific monitor.
[monitorId'] :: Monitor -> MonitorId
-- | The specification from which this monitor can be re-created.
[monitorSpec] :: Monitor -> MonitorSpec
-- | Datadog's internal reference to a specific monitor.
type MonitorId = Int
-- | Creates the most basic specification required by a monitor, containing
-- the type of monitor and the query string used to detect the monitor's
-- state.
--
-- This uses defaultMonitorOptions to set the options (see that
-- function for disclaimer(s)).
minimalMonitorSpec :: MonitorType -> Text -> MonitorSpec
-- | Create a new monitor in Datadog matching a specification.
createMonitor :: Environment -> MonitorSpec -> IO Monitor
-- | Sync a monitor with Datadog.
--
-- This must be called on any active monitors to apply the changes with
-- Datadog itself; merely modifying a monitor locally is not enough to
-- store the changes.
--
-- Beware: If a monitor has changed on the Datadog remote endpoint
-- between the time it was copied locally and when this function is
-- called, those changes already made remotely will be overwritten by
-- this change.
updateMonitor :: Environment -> MonitorId -> MonitorSpec -> IO Monitor
-- | Delete a monitor from Datadog.
--
-- Note that once a monitor is deleted, it cannot be used locally
-- anymore, however you can always create a new monitor using the deleted
-- monitor's specification.
deleteMonitor :: Environment -> MonitorId -> IO ()
-- | Load a monitor from Datadog by its ID.
loadMonitor :: Environment -> MonitorId -> IO Monitor
-- | Load monitors from Datadog.
--
-- This function takes a filter list argument, which should contain any
-- tags the user wishes to filter on. If the filter list is left empty,
-- no filters will be applied. The list of tags is ANDed together; if you
-- specify more than one filter tag, only metrics which match all filter
-- tags will be provided.
loadMonitors :: Environment -> [Tag] -> IO [Monitor]
-- | Prevent all monitors from notifying indefinitely.
muteAllMonitors :: Environment -> IO ()
-- | Allow all monitors to notify.
unmuteAllMonitors :: Environment -> IO ()
class HasId' s a | s -> a
id' :: HasId' s a => Lens' s a
class HasSpec s a | s -> a
spec :: HasSpec s a => Lens' s a
class HasType' s a | s -> a
type' :: HasType' s a => Lens' s a
class HasQuery s a | s -> a
query :: HasQuery s a => Lens' s a
class HasOptions s a | s -> a
options :: HasOptions s a => Lens' s a
class HasMessage s a | s -> a
message :: HasMessage s a => Lens' s a
class HasName s a | s -> a
name :: HasName s a => Lens' s a
class HasNotifyNoData s a | s -> a
notifyNoData :: HasNotifyNoData s a => Lens' s a
class HasTimeoutH s a | s -> a
timeoutH :: HasTimeoutH s a => Lens' s a
class HasRenotifyInterval s a | s -> a
renotifyInterval :: HasRenotifyInterval s a => Lens' s a
class HasNoDataTimeframe s a | s -> a
noDataTimeframe :: HasNoDataTimeframe s a => Lens' s a
class HasSilenced s a | s -> a
silenced :: HasSilenced s a => Lens' s a
class AsMonitorType r_arkZ
_MonitorType :: AsMonitorType r_arkZ => Prism' r_arkZ MonitorType
_MetricAlert :: AsMonitorType r_arkZ => Prism' r_arkZ ()
_ServiceCheck :: AsMonitorType r_arkZ => Prism' r_arkZ ()
_EventAlert :: AsMonitorType r_arkZ => Prism' r_arkZ ()
module Network.Datadog.Metrics
newtype Series
Series :: DList Metric -> Series
[fromSeries] :: Series -> DList Metric
data Metric
Metric :: Text -> MetricPoints -> Maybe Text -> [Text] -> Metric
[metricName] :: Metric -> Text
[metricPoints] :: Metric -> MetricPoints
[metricHost] :: Metric -> Maybe Text
[metricTags] :: Metric -> [Text]
data MetricPoints
Gauge :: [(POSIXTime, Float)] -> MetricPoints
Counter :: [(POSIXTime, Int64)] -> MetricPoints
sendMetrics :: DatadogCredentials k => DatadogClient k -> Series -> IO ()
series :: [Metric] -> Series
class HasName s a | s -> a
name :: HasName s a => Lens' s a
class HasPoints s a | s -> a
points :: HasPoints s a => Lens' s a
class HasTags s a | s -> a
tags :: HasTags s a => Lens' s a
class HasHost s a | s -> a
host :: HasHost s a => Lens' s a
class AsMetricPoints r_arhC
_MetricPoints :: AsMetricPoints r_arhC => Prism' r_arhC MetricPoints
_Gauge :: AsMetricPoints r_arhC => Prism' r_arhC [(POSIXTime, Float)]
_Counter :: AsMetricPoints r_arhC => Prism' r_arhC [(POSIXTime, Int64)]
-- | Controls host muting in Datadog.
module Network.Datadog.Host
-- | Do not allow alerts to trigger on a specific host
muteHost :: Environment -> Text -> Maybe UTCTime -> Bool -> IO ()
-- | Allow alerts to trigger on a specific host
unmuteHost :: Environment -> Text -> IO ()
-- | Events in Datadog represent notable occurrences.
module Network.Datadog.Event
-- | A set of priorities used to denote the importance of an event.
data EventPriority
NormalPriority :: EventPriority
LowPriority :: EventPriority
-- | The failure levels for an alert.
data AlertType
Error :: AlertType
Warning :: AlertType
Info :: AlertType
Success :: AlertType
-- | A source from which an event may originate, recognized by Datadog.
data SourceType
Nagios :: SourceType
Hudson :: SourceType
Jenkins :: SourceType
User :: SourceType
MyApps :: SourceType
Feed :: SourceType
Chef :: SourceType
Puppet :: SourceType
Git :: SourceType
BitBucket :: SourceType
Fabric :: SourceType
Capistrano :: SourceType
-- | Details that describe an event.
data EventSpec
EventSpec :: Text -> Text -> UTCTime -> EventPriority -> Maybe Text -> [Tag] -> AlertType -> Maybe SourceType -> EventSpec
[eventSpecTitle] :: EventSpec -> Text
-- | The description/body of the event
[eventSpecText] :: EventSpec -> Text
-- | The time at which the event occurred
[eventSpecDateHappened] :: EventSpec -> UTCTime
[eventSpecPriority] :: EventSpec -> EventPriority
-- | The hostname associated with the event
[eventSpecHost] :: EventSpec -> Maybe Text
[eventSpecTags] :: EventSpec -> [Tag]
[eventSpecAlertType] :: EventSpec -> AlertType
-- | The trigger of the event (if identifiable)
[eventSpecSourceType] :: EventSpec -> Maybe SourceType
-- | An event stored within Datadog. An event represents some sort of
-- occurrence that was recorded in Datadog.
data Event
-- | Datadog's internal reference to a specific event.
type EventId = Int
-- | Creates the most basic description required for an event, containing
-- the event title, descriptive text, time of occurrence, and priority of
-- the event. This event will be of type Info.
minimalEventSpec :: Text -> Text -> UTCTime -> EventPriority -> EventSpec
-- | Store a new event in Datadog.
createEvent :: Environment -> EventSpec -> IO Event
-- | Load an event from Datadog by its ID.
loadEvent :: Environment -> EventId -> IO Event
-- | Query Datadog for events within a specific time range.
loadEvents :: Environment -> (UTCTime, UTCTime) -> Maybe EventPriority -> [Text] -> IO [Event]
class AsEventPriority r_aqTL
_EventPriority :: AsEventPriority r_aqTL => Prism' r_aqTL EventPriority
_NormalPriority :: AsEventPriority r_aqTL => Prism' r_aqTL ()
_LowPriority :: AsEventPriority r_aqTL => Prism' r_aqTL ()
class AsAlertType r_aqX4
_AlertType :: AsAlertType r_aqX4 => Prism' r_aqX4 AlertType
_Error :: AsAlertType r_aqX4 => Prism' r_aqX4 ()
_Warning :: AsAlertType r_aqX4 => Prism' r_aqX4 ()
_Info :: AsAlertType r_aqX4 => Prism' r_aqX4 ()
_Success :: AsAlertType r_aqX4 => Prism' r_aqX4 ()
class AsSourceType r_ar2H
_SourceType :: AsSourceType r_ar2H => Prism' r_ar2H SourceType
_Nagios :: AsSourceType r_ar2H => Prism' r_ar2H ()
_Hudson :: AsSourceType r_ar2H => Prism' r_ar2H ()
_Jenkins :: AsSourceType r_ar2H => Prism' r_ar2H ()
_User :: AsSourceType r_ar2H => Prism' r_ar2H ()
_MyApps :: AsSourceType r_ar2H => Prism' r_ar2H ()
_Feed :: AsSourceType r_ar2H => Prism' r_ar2H ()
_Chef :: AsSourceType r_ar2H => Prism' r_ar2H ()
_Puppet :: AsSourceType r_ar2H => Prism' r_ar2H ()
_Git :: AsSourceType r_ar2H => Prism' r_ar2H ()
_BitBucket :: AsSourceType r_ar2H => Prism' r_ar2H ()
_Fabric :: AsSourceType r_ar2H => Prism' r_ar2H ()
_Capistrano :: AsSourceType r_ar2H => Prism' r_ar2H ()
class HasTitle s a | s -> a
title :: HasTitle s a => Lens' s a
class HasText s a | s -> a
text :: HasText s a => Lens' s a
class HasPriority s a | s -> a
priority :: HasPriority s a => Lens' s a
class HasDateHappened s a | s -> a
dateHappened :: HasDateHappened s a => Lens' s a
class HasAlertType s a | s -> a
alertType :: HasAlertType s a => Lens' s a
class HasDetails s a | s -> a
details :: HasDetails s a => Lens' s a
class HasTags s a | s -> a
tags :: HasTags s a => Lens' s a
class HasSourceType s a | s -> a
sourceType :: HasSourceType s a => Lens' s a
class HasHost s a | s -> a
host :: HasHost s a => Lens' s a
class HasId' s a | s -> a
id' :: HasId' s a => Lens' s a
-- | Downtime prevents all alerting related to specific Datadog scopes.
module Network.Datadog.Downtime
-- | A description of when downtime should occur.
data DowntimeSpec
DowntimeSpec :: Maybe UTCTime -> Maybe UTCTime -> Maybe Text -> Tag -> DowntimeSpec
-- | When to start the downtime (or immediately)
[downtimeSpecStart] :: DowntimeSpec -> Maybe UTCTime
-- | When to stop the downtime (or indefinitely)
[downtimeSpecEnd] :: DowntimeSpec -> Maybe UTCTime
-- | A message to include with notifications for this downtime
[downtimeSpecMessage] :: DowntimeSpec -> Maybe Text
-- | The scope to apply downtime to (if applying downtime to a host, use a
-- tag of the form "host:hostname", NOT just "hostname")
[downtimeSpecScope] :: DowntimeSpec -> Tag
-- | A scheduled donwtime stored in Datadog.
data Downtime
-- | Creates the most basic possible downtime specification, which just
-- contains the scope to which the downtime applies.
minimalDowntimeSpec :: Tag -> DowntimeSpec
-- | Schedule a new downtime in Datadog.
scheduleDowntime :: Environment -> DowntimeSpec -> IO Downtime
-- | Update the specification of a downtime in Datadog.
updateDowntime :: Environment -> DowntimeId -> DowntimeSpec -> IO Downtime
-- | Cancel scheduled downtime in Datadog.
cancelDowntime :: Environment -> DowntimeId -> IO ()
-- | Load a scheduled downtime from Datadog by its ID.
loadDowntime :: Environment -> DowntimeId -> IO Downtime
-- | Load all scheduled downtimes, optionally filtering for only downtimes
-- that are currently active.
loadDowntimes :: Environment -> Bool -> IO [Downtime]
class HasScope s a | s -> a
scope :: HasScope s a => Lens' s a
class HasSpec s a | s -> a
spec :: HasSpec s a => Lens' s a
class HasMessage s a | s -> a
message :: HasMessage s a => Lens' s a
class HasStart s a | s -> a
start :: HasStart s a => Lens' s a
class HasEnd s a | s -> a
end :: HasEnd s a => Lens' s a
class HasId' s a | s -> a
id' :: HasId' s a => Lens' s a
-- | Datadog's internal reference to a specific donwtime instance.
type DowntimeId = Int
-- | Checks allow users to post check statuses, for use with monitors.
module Network.Datadog.Check
-- | The status of a service, based on a check that is run against it.
data CheckStatus
-- | Everything is as it should be.
CheckOk :: CheckStatus
-- | Something abnormal, but not critical, is amiss.
CheckWarning :: CheckStatus
-- | Something dangerously critical is amiss.
CheckCritical :: CheckStatus
-- | The current status cannot be determined.
CheckUnknown :: CheckStatus
-- | The result of running a check on some service.
data CheckResult
CheckResult :: Text -> Text -> CheckStatus -> Maybe UTCTime -> Maybe Text -> [Tag] -> CheckResult
-- | Text describing the check
[checkResultCheck] :: CheckResult -> Text
-- | Name of the host which the check applies to
[checkResultHostName] :: CheckResult -> Text
-- | Status result of the check
[checkResultStatus] :: CheckResult -> CheckStatus
-- | Time at which the check occurred (Nothing will wait until the check is
-- sent to Datadog to compute the time)
[checkResultTimestamp] :: CheckResult -> Maybe UTCTime
-- | Information related to why this specific check run supplied the status
-- it did
[checkResultMessage] :: CheckResult -> Maybe Text
-- | Tags to associate with this check run
[checkResultTags] :: CheckResult -> [Tag]
-- | Record the result of a check in Datadog.
recordCheck :: Environment -> CheckResult -> IO ()
class HasStatus s a | s -> a
status :: HasStatus s a => Lens' s a
class HasHostName s a | s -> a
hostName :: HasHostName s a => Lens' s a
class HasCheck s a | s -> a
check :: HasCheck s a => Lens' s a
class HasTimestamp s a | s -> a
timestamp :: HasTimestamp s a => Lens' s a
class HasTags s a | s -> a
tags :: HasTags s a => Lens' s a
class HasMessage s a | s -> a
message :: HasMessage s a => Lens' s a
class AsCheckStatus r_aqO8
_CheckStatus :: AsCheckStatus r_aqO8 => Prism' r_aqO8 CheckStatus
_CheckOk :: AsCheckStatus r_aqO8 => Prism' r_aqO8 ()
_CheckWarning :: AsCheckStatus r_aqO8 => Prism' r_aqO8 ()
_CheckCritical :: AsCheckStatus r_aqO8 => Prism' r_aqO8 ()
_CheckUnknown :: AsCheckStatus r_aqO8 => Prism' r_aqO8 ()
-- | Datadog is a monitoring service for IT, Operations and
-- Development teams who write and run applications at scale, and want to
-- turn the massive amounts of data produced by their apps, tools and
-- services into actionable insight.
module Network.Datadog
-- | Wraps the keys needed by Datadog to fully access the API.
data Keys
Keys :: String -> String -> Keys
[apiKey] :: Keys -> String
[appKey] :: Keys -> String
-- | Load Datadog keys from environment variables.
--
-- The keys will be read from the enviornment variables
-- DATADOG_API_KEY and DATADOG_APP_KEY. If the keys
-- cannot be read, this function will throw an IOException.
loadKeysFromEnv :: IO Keys
-- | An Environment contains everything needed to interact with Datadog.
data Environment
-- | Create a new environment using authentication keys, defaulting to the
-- Datadog documented default API URL.
createEnvironment :: Keys -> IO Environment
withDatadog :: DatadogCredentials k => k -> (DatadogClient k -> IO a) -> IO a
writeCredentials :: Text -> Write
readWriteCredentials :: Text -> Text -> ReadWrite
-- | DogStatsD accepts custom application metrics points over UDP, and then
-- periodically aggregates and forwards the metrics to Datadog, where
-- they can be graphed on dashboards. The data is sent by using a client
-- library such as this one that communicates with a DogStatsD server.
module Network.StatsD.Datadog
data DogStatsSettings
DogStatsSettings :: HostName -> !Int -> !Int -> !Int -> (SomeException -> Seq ByteString -> IO (Seq ByteString -> Seq ByteString)) -> DogStatsSettings
-- | The hostname or IP of the DogStatsD server (default: 127.0.0.1)
[dogStatsSettingsHost] :: DogStatsSettings -> HostName
-- | The port that the DogStatsD server is listening on (default: 8125)
[dogStatsSettingsPort] :: DogStatsSettings -> !Int
-- | Maximum buffer size. Stats are sent over UDP, so the maximum possible
-- value is 65507 bytes per packet. In some scenarios, however, you may
-- wish to send smaller packets. (default: 65507)
[dogStatsSettingsBufferSize] :: DogStatsSettings -> !Int
-- | Maximum amount of time (in microseconds) between having no stats to
-- send locally and when new stats will be sent to the statsd server.
-- (default: 1 second)
[dogStatsSettingsMaxDelay] :: DogStatsSettings -> !Int
-- | Handler to recover from exceptions thrown while sending stats to the
-- server. Caution: Throwing an exception from this handler will shut
-- down the worker that sends stats to the server, but is not able to
-- prevent you from enqueuing stats via the client. Default: print the
-- exception and throw away any accumulated stats.
[dogStatsSettingsOnException] :: DogStatsSettings -> SomeException -> Seq ByteString -> IO (Seq ByteString -> Seq ByteString)
defaultSettings :: DogStatsSettings
-- | Create a StatsClient and provide it to the provided function.
-- The StatsClient will be finalized as soon as the inner block is
-- exited, whether normally or via an exception.
withDogStatsD :: MonadUnliftIO m => DogStatsSettings -> (StatsClient -> m a) -> m a
-- | Create a stats client. Be sure to close it with
-- finalizeStatsClient in order to send any pending stats and
-- close the underlying handle when done using it. Alternatively, use
-- withDogStatsD to finalize it automatically.
mkStatsClient :: MonadIO m => DogStatsSettings -> m StatsClient
-- | Send all pending unsent events and close the connection to the
-- specified statsd server.
finalizeStatsClient :: MonadIO m => StatsClient -> m ()
-- | Send a Metric, Event, or StatusCheck to the
-- DogStatsD server.
--
-- Since UDP is used to send the events, there is no ack that sent values
-- are successfully dealt with.
--
-- -- withDogStatsD defaultSettings $ \client -> do -- send client $ event "Wombat attack" "A host of mighty wombats has breached the gates" -- send client $ metric "wombat.force_count" Gauge (9001 :: Int) -- send client $ serviceCheck "Wombat Radar" ServiceOk --send :: (MonadIO m, ToStatsD v) => StatsClient -> v -> m () -- | Smart Metric constructor. Use the lens functions to set the -- optional fields. metric :: ToMetricValue a => MetricName -> MetricType -> a -> Metric -- | Metric -- -- The fields accessible through corresponding lenses are: -- --
-- metric ("foo"" :: Text) Counter (1 :: Int) & value .~ (5 :: Double)
--
value :: ToMetricValue a => Setter Metric Metric (Utf8Builder ()) a
data Priority
Low :: Priority
Normal :: Priority
data AlertType
Error :: AlertType
Warning :: AlertType
Info :: AlertType
Success :: AlertType
class HasName s a | s -> a
name :: HasName s a => Lens' s a
class HasSampleRate s a | s -> a
sampleRate :: HasSampleRate s a => Lens' s a
class HasType' s a | s -> a
type' :: HasType' s a => Lens' s a
class HasTags s a | s -> a
tags :: HasTags s a => Lens' s a
class HasTitle s a | s -> a
title :: HasTitle s a => Lens' s a
class HasText s a | s -> a
text :: HasText s a => Lens' s a
class HasDateHappened s a | s -> a
dateHappened :: HasDateHappened s a => Lens' s a
class HasHostname s a | s -> a
hostname :: HasHostname s a => Lens' s a
class HasAggregationKey s a | s -> a
aggregationKey :: HasAggregationKey s a => Lens' s a
class HasPriority s a | s -> a
priority :: HasPriority s a => Lens' s a
class HasSourceTypeName s a | s -> a
sourceTypeName :: HasSourceTypeName s a => Lens' s a
class HasAlertType s a | s -> a
alertType :: HasAlertType s a => Lens' s a
class HasHost s a | s -> a
host :: HasHost s a => Lens' s a
class HasPort s a | s -> a
port :: HasPort s a => Lens' s a
class HasBufferSize s a | s -> a
bufferSize :: HasBufferSize s a => Lens' s a
class HasMaxDelay s a | s -> a
maxDelay :: HasMaxDelay s a => Lens' s a
class HasOnException s a | s -> a
onException :: HasOnException s a => Lens' s a
class HasStatus s a | s -> a
status :: HasStatus s a => Lens' s a
class HasMessage s a | s -> a
message :: HasMessage s a => Lens' s a
-- | Note that Dummy is not the only constructor, just the only publicly
-- available one.
data StatsClient
-- | Just drops all stats.
Dummy :: StatsClient
instance Network.StatsD.Datadog.HasPort Network.StatsD.Datadog.DogStatsSettings GHC.Types.Int
instance Network.StatsD.Datadog.HasOnException Network.StatsD.Datadog.DogStatsSettings (GHC.Exception.Type.SomeException -> Data.Sequence.Internal.Seq Data.ByteString.Internal.ByteString -> GHC.Types.IO (Data.Sequence.Internal.Seq Data.ByteString.Internal.ByteString -> Data.Sequence.Internal.Seq Data.ByteString.Internal.ByteString))
instance Network.StatsD.Datadog.HasMaxDelay Network.StatsD.Datadog.DogStatsSettings GHC.Types.Int
instance Network.StatsD.Datadog.HasHost Network.StatsD.Datadog.DogStatsSettings Network.Socket.Info.HostName
instance Network.StatsD.Datadog.HasBufferSize Network.StatsD.Datadog.DogStatsSettings GHC.Types.Int
instance Network.StatsD.Datadog.ToStatsD Network.StatsD.Datadog.Metric
instance Network.StatsD.Datadog.ToStatsD Network.StatsD.Datadog.Event
instance Network.StatsD.Datadog.ToStatsD Network.StatsD.Datadog.ServiceCheck
instance Network.StatsD.Datadog.HasStatus Network.StatsD.Datadog.ServiceCheck Network.StatsD.Datadog.ServiceCheckStatus
instance Network.StatsD.Datadog.HasMessage Network.StatsD.Datadog.ServiceCheck (GHC.Maybe.Maybe Data.Text.Internal.Text)
instance Network.StatsD.Datadog.HasDateHappened Network.StatsD.Datadog.ServiceCheck (GHC.Maybe.Maybe Data.Time.Clock.Internal.UTCTime.UTCTime)
instance Network.StatsD.Datadog.HasHostname Network.StatsD.Datadog.ServiceCheck (GHC.Maybe.Maybe Data.Text.Internal.Text)
instance Network.StatsD.Datadog.HasName Network.StatsD.Datadog.ServiceCheck Data.Text.Internal.Text
instance Network.StatsD.Datadog.HasTags Network.StatsD.Datadog.ServiceCheck [Network.StatsD.Datadog.Tag]
instance GHC.Enum.Enum Network.StatsD.Datadog.ServiceCheckStatus
instance GHC.Classes.Ord Network.StatsD.Datadog.ServiceCheckStatus
instance GHC.Classes.Eq Network.StatsD.Datadog.ServiceCheckStatus
instance GHC.Show.Show Network.StatsD.Datadog.ServiceCheckStatus
instance GHC.Read.Read Network.StatsD.Datadog.ServiceCheckStatus
instance Network.StatsD.Datadog.HasTitle Network.StatsD.Datadog.Event Data.Text.Internal.Text
instance Network.StatsD.Datadog.HasText Network.StatsD.Datadog.Event Data.Text.Internal.Text
instance Network.StatsD.Datadog.HasSourceTypeName Network.StatsD.Datadog.Event (GHC.Maybe.Maybe Data.Text.Internal.Text)
instance Network.StatsD.Datadog.HasPriority Network.StatsD.Datadog.Event (GHC.Maybe.Maybe Network.StatsD.Datadog.Priority)
instance Network.StatsD.Datadog.HasHostname Network.StatsD.Datadog.Event (GHC.Maybe.Maybe Data.Text.Internal.Text)
instance Network.StatsD.Datadog.HasDateHappened Network.StatsD.Datadog.Event (GHC.Maybe.Maybe Data.Time.Clock.Internal.UTCTime.UTCTime)
instance Network.StatsD.Datadog.HasAlertType Network.StatsD.Datadog.Event (GHC.Maybe.Maybe Network.StatsD.Datadog.AlertType)
instance Network.StatsD.Datadog.HasAggregationKey Network.StatsD.Datadog.Event (GHC.Maybe.Maybe Data.Text.Internal.Text)
instance Network.StatsD.Datadog.HasTags Network.StatsD.Datadog.Event [Network.StatsD.Datadog.Tag]
instance Network.StatsD.Datadog.HasType' Network.StatsD.Datadog.Metric Network.StatsD.Datadog.MetricType
instance Network.StatsD.Datadog.HasTags Network.StatsD.Datadog.Metric [Network.StatsD.Datadog.Tag]
instance Network.StatsD.Datadog.HasSampleRate Network.StatsD.Datadog.Metric GHC.Types.Double
instance Network.StatsD.Datadog.HasName Network.StatsD.Datadog.Metric Network.StatsD.Datadog.MetricName
instance Network.StatsD.Datadog.ToMetricValue GHC.Types.Int
instance Network.StatsD.Datadog.ToMetricValue GHC.Types.Double
instance GHC.Show.Show Network.StatsD.Datadog.Tag
instance GHC.Classes.Eq Network.StatsD.Datadog.Tag