k8s.io/test-infra@v0.0.0-20240520184403-27c6b4c223d8/config/prow/cluster/monitoring/mixins/grafana_dashboards/boskos-http.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  local template = grafana.template;
     7  
     8  local legendConfig = {
     9          legend+: {
    10              sideWidth: 350
    11          },
    12      };
    13  
    14  local dashboardConfig = {
    15          uid: config._config.grafanaDashboardIDs['boskos-http.json'],
    16      };
    17  
    18  local histogramQuantileDuration(phi, selector='') = prometheus.target(
    19          std.format('histogram_quantile(%s, sum(rate(boskos_http_request_duration_seconds_bucket%s[5m])) by (le))', [phi, selector]),
    20          legendFormat=std.format('phi=%s', phi),
    21      );
    22  
    23  local boskosTemplate(name, labelInQuery, includeAll) = template.new(
    24          name,
    25          'prometheus',
    26          std.format('label_values(boskos_http_request_duration_seconds_bucket, %s)', labelInQuery),
    27          label=name,
    28          allValues='.*',
    29          includeAll=includeAll,
    30          refresh='time',
    31      );
    32  
    33  dashboard.new(
    34          'Boskos Server Dashboard',
    35          time_from='now-1h',
    36          schemaVersion=18,
    37        )
    38  .addTemplate(boskosTemplate('instance', 'instance', false))
    39  .addTemplate(boskosTemplate('path', 'path', true))
    40  .addTemplate(boskosTemplate('status', 'status', true))
    41  .addPanel(
    42      (graphPanel.new(
    43          'Latency distribution for instance ${instance} path ${path} and status ${status}',
    44          description='histogram_quantile(phi, sum(rate(boskos_http_request_duration_seconds_bucket[5m])) by (le))',
    45          datasource = 'prometheus',
    46          legend_alignAsTable=true,
    47          legend_rightSide=true,
    48          legend_values=true,
    49          legend_current=true,
    50          legend_avg=true,
    51          legend_sort='avg',
    52          legend_sortDesc=true,
    53          ) + legendConfig)
    54          .addTarget(histogramQuantileDuration('0.99','{path=~"${path}", status=~"${status}", instance=~"${instance}"}'))
    55          .addTarget(histogramQuantileDuration('0.95','{path=~"${path}", status=~"${status}", instance=~"${instance}"}'))
    56          .addTarget(histogramQuantileDuration('0.5','{path=~"${path}", status=~"${status}", instance=~"${instance}"}')), gridPos={
    57          h: 9,
    58          w: 24,
    59          x: 0,
    60          y: 0
    61      })
    62  .addPanel(
    63      (graphPanel.new(
    64          'Request rate for instance ${instance}',
    65          description='sum(rate(boskos_http_request_duration_seconds_count{instance=~"${instance}"}[5m])) by (path, status)',
    66          datasource = 'prometheus',
    67          legend_alignAsTable=true,
    68          legend_rightSide=true,
    69          legend_values=true,
    70          legend_current=true,
    71          legend_avg=true,
    72          legend_sort='avg',
    73          legend_sortDesc=true,
    74          ) + legendConfig)
    75          .addTarget(prometheus.target(
    76              'sum(rate(boskos_http_request_duration_seconds_count{instance=~"${instance}"}[5m])) by (path, status)',
    77              legendFormat='{{path}} {{status}}'
    78          )), gridPos={
    79          h: 9,
    80          w: 24,
    81          x: 0,
    82          y: 0
    83      })