From ee455ab5143a26fb4600f96417faa32ddaa93f51 Mon Sep 17 00:00:00 2001 From: nineonine Date: Mon, 27 Sep 2021 11:40:39 -0700 Subject: [PATCH] Add mteric timeout field --- src/Network/Datadog/Internal.hs | 3 ++- src/Network/Datadog/Types.hs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Network/Datadog/Internal.hs b/src/Network/Datadog/Internal.hs index 3b6e95e..eff060f 100644 --- a/src/Network/Datadog/Internal.hs +++ b/src/Network/Datadog/Internal.hs @@ -263,8 +263,9 @@ instance ToJSON MetricPoints where toJSON (Counter ps) = toJSON $ fmap (first Timestamp) ps instance ToJSON Metric where - toJSON m = object ks + toJSON m = object (g ks) where + g = maybe id (\x y -> ("interval" .= x) : y) $ metricInterval m f = maybe id (\x y -> ("host" .= x) : y) $ metricHost m ks = f [ "metric" .= metricName m , "points" .= metricPoints m diff --git a/src/Network/Datadog/Types.hs b/src/Network/Datadog/Types.hs index 0353e03..ec17d3a 100644 --- a/src/Network/Datadog/Types.hs +++ b/src/Network/Datadog/Types.hs @@ -220,8 +220,9 @@ data Metric = Metric , metricPoints :: MetricPoints , metricHost :: Maybe Text , metricTags :: [Text] + , metricInterval :: Maybe Integer } - + -- | Each monitor is of a specific type, which determines what sort of check -- the monitor performs. data MonitorType = MetricAlert