k8s.io/perf-tests/clusterloader2@v0.0.0-20240304094227-64bdb12da87e/pkg/prometheus/manifests/dashboards/master-dashboard.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  from master_panels import API_CALL_LATENCY_PANELS, QUANTILE_API_CALL_LATENCY_PANELS, APF_PANELS, HEALTH_PANELS, ETCD_PANELS, APISERVER_PANELS, CONTROLLER_MANAGER_PANELS, VM_PANELS
    20  
    21  
    22  # The final dashboard must be named 'dashboard' so that grafanalib will find it.
    23  dashboard = d.Dashboard(
    24      title="Master dashboard",
    25      refresh="",
    26      rows=[
    27          d.Row(title="API call latency", panels=API_CALL_LATENCY_PANELS),
    28          d.Row(title="API call latency aggregated with quantile", panels=QUANTILE_API_CALL_LATENCY_PANELS, collapse=True),
    29          d.Row(title="P&F metrics", panels=APF_PANELS, collapse=True),
    30          d.Row(title="Overall cluster health", panels=HEALTH_PANELS, collapse=True),
    31          d.Row(title="etcd", panels=ETCD_PANELS, collapse=True),
    32          d.Row(title="kube-apiserver", panels=APISERVER_PANELS, collapse=True),
    33          d.Row(title="kube-controller-manager", panels=CONTROLLER_MANAGER_PANELS, collapse=True),
    34          d.Row(title="Master VM", panels=VM_PANELS, collapse=True),
    35      ],
    36      templating=g.Templating(
    37          list=[
    38              d.SOURCE_TEMPLATE,
    39              g.Template(
    40                  name="etcd_type",
    41                  type="query",
    42                  dataSource="$source",
    43                  regex=r"\*\[+\]+(.*)",
    44                  query="label_values(etcd_request_duration_seconds_count, type)",
    45                  multi=True,
    46                  includeAll=True,
    47                  refresh=g.REFRESH_ON_TIME_RANGE_CHANGE,
    48              ),
    49              g.Template(
    50                  name="etcd_operation",
    51                  type="query",
    52                  dataSource="$source",
    53                  query="label_values(etcd_request_duration_seconds_count, operation)",
    54                  multi=True,
    55                  includeAll=True,
    56                  refresh=g.REFRESH_ON_TIME_RANGE_CHANGE,
    57              ),
    58              g.Template(
    59                  name="verb",
    60                  type="query",
    61                  dataSource="$source",
    62                  query="label_values(apiserver_request_duration_seconds_count, verb)",
    63                  multi=True,
    64                  includeAll=True,
    65                  refresh=g.REFRESH_ON_TIME_RANGE_CHANGE,
    66              ),
    67              g.Template(
    68                  name="resource",
    69                  type="query",
    70                  dataSource="$source",
    71                  regex="(.*)s",
    72                  query="label_values(apiserver_request_duration_seconds_count, resource)",
    73                  multi=True,
    74                  includeAll=True,
    75                  refresh=g.REFRESH_ON_TIME_RANGE_CHANGE,
    76              ),
    77              g.Template(
    78                  name="instance",
    79                  type="query",
    80                  dataSource="$source",
    81                  query="label_values(apiserver_request_duration_seconds_count, instance)",
    82                  multi=True,
    83                  includeAll=True,
    84                  refresh=g.REFRESH_ON_TIME_RANGE_CHANGE,
    85              ),
    86          ]
    87      ),
    88  ).auto_panel_ids()