From c07bb3df14fb3d923d53f4f9339cee0bcab5d3da Mon Sep 17 00:00:00 2001 From: Johan Tibell Date: Fri, 31 Jul 2015 15:05:11 +0100 Subject: [PATCH] Document valueToJson --- System/Metrics/Json.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/System/Metrics/Json.hs b/System/Metrics/Json.hs index a4cc25d..03a5b84 100644 --- a/System/Metrics/Json.hs +++ b/System/Metrics/Json.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} --- | Encoding of metrics as JSON. The encoding defined by the +-- | Encoding of ekg metrics as JSON. The encoding defined by the -- functions in this module are standardized and used by the ekg web -- UI. The purpose of this module is to let other web servers and -- frameworks than the one used by the ekg package expose ekg metrics. @@ -77,6 +77,13 @@ typeMismatch expected actual = A.Bool _ -> "Boolean" A.Null -> "Null" +-- | Encodes a single metric as a JSON object. Example: +-- +-- > { +-- > "type": "c", +-- > "val": 89460 +-- > } +-- valueToJson :: Metrics.Value -> A.Value valueToJson (Metrics.Counter n) = scalarToJson n CounterType valueToJson (Metrics.Gauge n) = scalarToJson n GaugeType