From d3413f99bb7e37f663b8edabbafa8897d8346618 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 24 Nov 2017 18:23:32 +0100 Subject: [PATCH] Add option to hide value on dashboard Signed-off-by: Knut Ahlers --- apiary.apib | 1 + structs.go | 2 ++ templates/dashboard.html | 2 ++ 3 files changed, 5 insertions(+) diff --git a/apiary.apib b/apiary.apib index 431a989..494c147 100644 --- a/apiary.apib +++ b/apiary.apib @@ -74,6 +74,7 @@ This API controls the metrics on your dashboard + freshness: 3600 (optional, number) - Time in seconds when to switch to `Unkown` state of there is no update (Valid: `0 < x < 604800`) + ignore_mad: false (optional, boolean) - If set to true the status passed in the update will be used instead of the median absolute deviation + hide_mad: false (optional, boolean) - If set to true the median absolute deviation is hidden on the dashboard for this metric + + hide_value: false (optional, boolean) - If set to true the current value will not be shown on the dashboard (useful for checks not having values) + Response 200 (text/plain) diff --git a/structs.go b/structs.go index 82f097d..5be2da3 100644 --- a/structs.go +++ b/structs.go @@ -63,6 +63,7 @@ type dashboardMetric struct { Freshness int64 `json:"freshness,omitifempty"` IgnoreMAD bool `json:"ignore_mad"` HideMAD bool `json:"hide_mad"` + HideValue bool `json:"hide_value"` HistoricalData dashboardMetricHistory `json:"history,omitifempty"` Meta dashboardMetricMeta `json:"meta,omitifempty"` } @@ -217,6 +218,7 @@ func (dm *dashboardMetric) Update(m *dashboardMetric) { dm.Value = m.Value dm.IgnoreMAD = m.IgnoreMAD dm.HideMAD = m.HideMAD + dm.HideValue = m.HideValue if m.Expires != 0 { dm.Expires = m.Expires } diff --git a/templates/dashboard.html b/templates/dashboard.html index 050843f..1ce5563 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -98,6 +98,7 @@

{{ metric.Title }}

{{ metric.Description }}

+ {% if !metric.HideValue %} {% if metric.Status == "OK" %} Current Value: {{ metric.Value }} @@ -112,6 +113,7 @@ MAD: {{ metric.MadMultiplier }} above the Median ({{ metric.Median }}) {% endif %} + {% endif %} {% if !metric.HideMAD %}