k8s.io/perf-tests/clusterloader2@v0.0.0-20240304094227-64bdb12da87e/pkg/prometheus/manifests/dashboards/dns.dashboard.py (about)

     1  #!/usr/bin/env python3
     2  
     3  # Copyright 2019 The Kubernetes Authors.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  from grafanalib import core as g
    18  import defaults as d
    19  
    20  PROBER_PANEL = [
    21      d.Graph(
    22          title="In-cluster DNS latency SLI",
    23          targets=d.show_quantiles(
    24              (
    25                  "quantile_over_time("
    26                  + "0.99, "
    27                  + 'probes:dns_lookup_latency:histogram_quantile{{quantile="{quantile}"}}[24h])'
    28              ),
    29              legend="{{quantile}}",
    30          ),
    31          yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
    32          nullPointMode="null",
    33      ),
    34      d.Graph(
    35          title="DNS latency",
    36          targets=d.show_quantiles(
    37              'probes:dns_lookup_latency:histogram_quantile{{quantile="{quantile}"}}',
    38              legend="{{quantile}}",
    39          ),
    40          yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
    41          nullPointMode="null",
    42      ),
    43      d.Graph(
    44          title="probe: lookup rate",
    45          targets=[
    46              d.Target(
    47                  expr='sum(rate(probes_in_cluster_dns_lookup_count{namespace="probes", job="dns"}[1m]))',
    48                  legendFormat="lookup rate",
    49              ),
    50              d.Target(
    51                  expr='sum(rate(probes_in_cluster_network_latency_error{namespace="probes", job="dns"}[1m]))',
    52                  legendFormat="error rate",
    53              ),
    54          ],
    55      ),
    56      d.Graph(
    57          title="probe: # running",
    58          targets=[
    59              d.TargetWithInterval(
    60                  expr='count(container_memory_usage_bytes{namespace="probes", container="dns"}) by (container, namespace)'
    61              )
    62          ],
    63          nullPointMode="null",
    64      ),
    65      d.Graph(
    66          title="probe: memory usage",
    67          targets=d.min_max_avg(
    68              base='process_resident_memory_bytes{namespace="probes", job="dns"}',
    69              by=["job", "namespace"],
    70              legend="{{job}}",
    71          ),
    72          nullPointMode="null",
    73          yAxes=g.single_y_axis(format=g.BYTES_FORMAT),
    74      ),
    75  ]
    76  
    77  SERVICE_PANELS = [
    78      d.Graph(
    79          title="Service: # running",
    80          targets=[
    81              d.TargetWithInterval(
    82                  expr='count(process_resident_memory_bytes{namespace="kube-system", job="kube-dns"}) by (job, namespace)'
    83              )
    84          ],
    85          nullPointMode="null",
    86      ),
    87      d.Graph(
    88          title="Service: memory usage",
    89          targets=d.min_max_avg(
    90              base='process_resident_memory_bytes{namespace="kube-system", job="kube-dns"}',
    91              by=["job", "namespace"],
    92              legend="{{job}}",
    93          ),
    94          nullPointMode="null",
    95          yAxes=g.single_y_axis(format=g.BYTES_FORMAT),
    96      ),
    97  ]
    98  
    99  dashboard = d.Dashboard(
   100      title="DNS",
   101      rows=[
   102          d.Row(title="In-cluster DNS prober", panels=PROBER_PANEL),
   103          d.Row(title="In-cluster DNS service", panels=SERVICE_PANELS),
   104      ],
   105  ).auto_panel_ids()