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