From f3958503527a813de23320dce39bf1cd64606296 Mon Sep 17 00:00:00 2001 From: Clement Erena Date: Wed, 27 Mar 2024 12:14:02 +0100 Subject: [PATCH] feat(dashboard): add summary don panels --- dashboard-lib/atlas-don/component.go | 41 ++++++++++++++++++++++++++++ dashboard-lib/atlas-don/utils.go | 5 ++++ dashboard-lib/k8s-pods/component.go | 8 ++++++ 3 files changed, 54 insertions(+) create mode 100644 dashboard-lib/atlas-don/utils.go diff --git a/dashboard-lib/atlas-don/component.go b/dashboard-lib/atlas-don/component.go index 9db9b19e526..0bdec7c5258 100644 --- a/dashboard-lib/atlas-don/component.go +++ b/dashboard-lib/atlas-don/component.go @@ -39,6 +39,46 @@ func vars(p Props) []dashboard.Option { } } +func summary(p Props) []dashboard.Option { + return []dashboard.Option{ + dashboard.Row("Summary", + row.Collapse(), + row.WithStat( + "Telemetry Down", + stat.DataSource(p.PrometheusDataSource), + stat.Text(stat.TextValueAndName), + stat.Description("Which jobs are not receiving any telemetry?"), + stat.Orientation(stat.OrientationHorizontal), + stat.TitleFontSize(12), + stat.ValueFontSize(12), + stat.Span(12), + stat.WithPrometheusTarget( + `bool:`+p.OcrVersion+`_telemetry_down{`+p.PlatformOpts.LabelQuery+`} == 1`, + prometheus.Legend("{{job}} | {{report_type}}"), + ), + ), + row.WithStat( + "Oracles Down", + stat.DataSource(p.PrometheusDataSource), + stat.Text(stat.TextName), + stat.Description("Which NOPs are not providing any telemetry?"), + stat.Orientation(stat.OrientationHorizontal), + stat.TitleFontSize(12), + stat.ValueFontSize(12), + stat.Span(12), + stat.ValueType(stat.Last), + stat.WithPrometheusTarget( + `bool:`+p.OcrVersion+`_oracle_telemetry_down_except_telemetry_down{job=~"${job}", oracle!="csa_unknown"} == 1`, + prometheus.Legend("{{oracle}} | {{report_type}}"), + ), + stat.AbsoluteThresholds([]stat.ThresholdStep{ + {Color: "#FF0000", Value: float64Ptr(1.0)}, + }), + ), + ), + } +} + func ocrContractConfigOracle(p Props) []dashboard.Option { return []dashboard.Option{ dashboard.Row("OCR Contract Oracle", @@ -381,6 +421,7 @@ func roundEpochProgression(p Props) []dashboard.Option { func New(p Props) []dashboard.Option { opts := vars(p) + opts = append(opts, summary(p)...) opts = append(opts, ocrContractConfigOracle(p)...) opts = append(opts, ocrContractConfigNodes(p)...) opts = append(opts, ocrContractConfigDelta(p)...) diff --git a/dashboard-lib/atlas-don/utils.go b/dashboard-lib/atlas-don/utils.go new file mode 100644 index 00000000000..03221905493 --- /dev/null +++ b/dashboard-lib/atlas-don/utils.go @@ -0,0 +1,5 @@ +package atlas_don + +func float64Ptr(input float64) *float64 { + return &input +} diff --git a/dashboard-lib/k8s-pods/component.go b/dashboard-lib/k8s-pods/component.go index 1ea83294f42..7203fde6574 100644 --- a/dashboard-lib/k8s-pods/component.go +++ b/dashboard-lib/k8s-pods/component.go @@ -42,6 +42,14 @@ func vars(p Props) []dashboard.Option { query.Request("label_values(up{namespace=\"$namespace\"}, job)"), query.Sort(query.NumericalAsc), ), + dashboard.VariableAsQuery( + "service", + query.DataSource(p.PrometheusDataSource), + query.Multiple(), + query.IncludeAll(), + query.Request("label_values(up{namespace=\"$namespace\"}, service)"), + query.Sort(query.NumericalAsc), + ), } }