k8s.io/test-infra@v0.0.0-20240520184403-27c6b4c223d8/config/prow/cluster/monitoring/mixins/grafana_dashboards/slo.jsonnet (about) 1 local config = import 'config.libsonnet'; 2 local grafana = import 'grafonnet/grafana.libsonnet'; 3 local dashboard = grafana.dashboard; 4 local graphPanel = grafana.graphPanel; 5 local prometheus = grafana.prometheus; 6 7 8 local legendConfig = { 9 legend+: { 10 sideWidth: 400 11 }, 12 }; 13 14 local dashboardConfig = { 15 uid: config._config.grafanaDashboardIDs['slo.json'], 16 }; 17 18 dashboard.new( 19 'SLO Compliance Dashboard', 20 time_from='now-7d', 21 schemaVersion=18, 22 ) 23 .addPanel( 24 (graphPanel.new( 25 'Prow overall SLO compliance', 26 description='slo_prow_ok', 27 datasource='prometheus', 28 legend_rightSide=true, 29 decimals=0, 30 min=0, 31 max=1.25, 32 labelY1='Compliant (T/F)', 33 legend_values=true, 34 legend_avg=true, 35 legend_alignAsTable=true, 36 ) 37 .addTarget(prometheus.target( 38 'label_replace(slo_prow_ok, "__name__", "SLO", "", "")' 39 )) + legendConfig), 40 gridPos={h: 4, w: 24, x: 0, y: 0}) 41 .addPanels([ 42 (graphPanel.new( 43 '%s SLO compliance' % comp, 44 description='slo_component_ok{slo="%s"}' % comp, 45 datasource='prometheus', 46 legend_rightSide=true, 47 decimals=0, 48 min=0, 49 max=1.25, 50 labelY1='Compliant (T/F)', 51 legend_values=true, 52 legend_avg=true, 53 legend_alignAsTable=true, 54 ) 55 .addTarget(prometheus.target( 56 'label_replace(min(slo_component_ok{slo="%s"}) without (slo), "__name__", "SLO", "", "")' % comp 57 )) + legendConfig) 58 {gridPos:{h: 4, w: 24, x: 0, y: 0}} 59 for comp in config._config.slo.components 60 ]) 61 + dashboardConfig