k8s.io/test-infra@v0.0.0-20240520184403-27c6b4c223d8/config/prow/cluster/monitoring/mixins/grafana_dashboards/tide.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 local legendConfig = { 8 legend+: { 9 sideWidth: 500 10 }, 11 }; 12 13 local dashboardConfig = { 14 uid: 'd69a91f76d8110d3e72885ee5ce8038e', 15 }; 16 17 dashboard.new( 18 'tide dashboard', 19 time_from='now-2d', 20 schemaVersion=18, 21 ) 22 .addPanel( 23 (graphPanel.new( 24 'Tide Pool Sizes', 25 description="The number of PRs eligible for merge in each Tide pool.", 26 datasource='prometheus', 27 legend_values=true, 28 legend_current=true, 29 legend_avg=true, 30 legend_alignAsTable=true, 31 legend_rightSide=true, 32 nullPointMode='null as zero', 33 ) + legendConfig) 34 .addTarget(prometheus.target( 35 'avg(pooledprs and ((time() - updatetime) < 240)) by (org, repo, branch)', 36 legendFormat='{{org}}/{{repo}}:{{branch}}', 37 )), gridPos={ 38 h: 9, 39 w: 24, 40 x: 0, 41 y: 0, 42 }) 43 .addPanel( 44 (graphPanel.new( 45 'Tide Daily Merge Rate', 46 description="Calculated on a 24 hour interval.", 47 datasource='prometheus', 48 legend_values=true, 49 legend_current=true, 50 legend_avg=true, 51 legend_alignAsTable=true, 52 legend_rightSide=true, 53 legend_sort='avg', 54 legend_sortDesc=true, 55 nullPointMode='null as zero', 56 ) + legendConfig) 57 .addTarget(prometheus.target( 58 '(sum(rate(merges_sum[1d]) > 0) by (org, repo, branch)) * 86400', 59 legendFormat='{{org}}/{{repo}}:{{branch}}', 60 )), gridPos={ 61 h: 9, 62 w: 24, 63 x: 0, 64 y: 9, 65 }) 66 .addPanel( 67 (graphPanel.new( 68 'Tide Daily Merge Rate: Batches Only', 69 description="Calculated on a 24 hour interval.", 70 datasource='prometheus', 71 legend_values=true, 72 legend_current=true, 73 legend_avg=true, 74 legend_alignAsTable=true, 75 legend_rightSide=true, 76 legend_sort='avg', 77 legend_sortDesc=true, 78 nullPointMode='null as zero', 79 ) + legendConfig) 80 .addTarget(prometheus.target( 81 '(sum( rate(merges_sum[1d]) - (sum(rate(merges_bucket{le=\"1\"}[1d])) without (le)) > 0 ) by (org, repo, branch)) * 86400', 82 legendFormat='{{org}}/{{repo}}:{{branch}}', 83 )), gridPos={ 84 h: 9, 85 w: 24, 86 x: 0, 87 y: 18, 88 }) 89 .addPanels([ 90 //TODO: Merge Event + Recent merges: might be related the protmetheus setting 91 (graphPanel.new( 92 'Tide Pool: %s/%s:%s' % [pool.org, pool.repo, pool.branch], 93 description="Tide stats for the %s branch of the %s/%s repo.\nSpecifically, the number of pooled PRs and the daily merge rate.\n(See the more general graphs for details on how these are calculated.)" % [pool.branch, pool.org, pool.repo], 94 datasource='prometheus', 95 legend_values=true, 96 legend_current=true, 97 legend_avg=true, 98 legend_alignAsTable=true, 99 legend_rightSide=true, 100 nullPointMode='null as zero', 101 ) + legendConfig) 102 .addTarget(prometheus.target( 103 'avg(pooledprs{org="%s",repo="%s",branch="%s"} and ((time() - updatetime) < 240)) or vector(0)' % [pool.org, pool.repo, pool.branch], 104 legendFormat='Pool size', 105 )).addTarget(prometheus.target( 106 'sum(rate(merges_sum{org="%s",repo="%s",branch="%s"}[1d])) * 86400' % [pool.org, pool.repo, pool.branch], 107 legendFormat='Daily merge rate', 108 )){gridPos:{h: 9, w: 24, x: 0, y: 27}} 109 110 for pool in config._config.tideDashboardExplicitPools 111 ]) 112 .addPanel( 113 (graphPanel.new( 114 'Tide Pool Sync Errors', 115 description="Rate of sync errors over a 10m window for each Tide pool.", 116 datasource='prometheus', 117 legend_alignAsTable=true, 118 legend_rightSide=true, 119 nullPointMode='null as zero', 120 ) + legendConfig) 121 .addTarget(prometheus.target( 122 'sum(increase(tidepoolerrors[10m])) by (org, repo, branch)', 123 legendFormat='{{org}}/{{repo}}:{{branch}}', 124 )), gridPos={ 125 h: 9, 126 w: 24, 127 x: 0, 128 y: 36, 129 }) 130 .addPanel( 131 (graphPanel.new( 132 'Tide Processing Time (seconds)', 133 datasource='prometheus', 134 legend_alignAsTable=true, 135 legend_rightSide=true, 136 ) + legendConfig) 137 .addTarget(prometheus.target( 138 'max(syncdur and (changes(syncdur[10m]) > 0))', 139 legendFormat='Sync time', 140 )).addTarget(prometheus.target( 141 'max(statusupdatedur and (changes(statusupdatedur[10m]) > 0))', 142 legendFormat='Status update time', 143 )), gridPos={ 144 h: 9, 145 w: 24, 146 x: 0, 147 y: 45, 148 }) 149 + dashboardConfig