Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aggregated graphs to master dashboard #1188

Merged
merged 1 commit into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,60 +14,70 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from collections import namedtuple
from grafanalib import core as g
import defaults as d


def api_call_latency(title, verb, scope, threshold):
return d.Graph(
title=title,
targets=[
g.Target(expr=str(threshold), legendFormat="threshold"),
g.Target(
expr=d.one_line(
"""
def api_call_latency_panel(expression):
jprzychodzen marked this conversation as resolved.
Show resolved Hide resolved
def api_call_latency(title, verb, scope, threshold):
return d.Graph(
title=title,
targets=[
g.Target(expr=str(threshold), legendFormat="threshold"),
g.Target(
expr=d.one_line(expression % {"verb": verb, "scope": scope}
),
# TODO(github.com/grafana/grafana/issues/19410): uncomment once fixed
# legendFormat="{{verb}} {{scope}}/{{resource}}",
),
],
yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
)

return [
api_call_latency(
title="Read-only API call latency (percentaile=99, scope=resource, threshold=1s)",
verb="GET",
scope="namespace",
threshold=1,
),
api_call_latency(
title="Read-only API call latency (percentaile=99, scope=namespace, threshold=5s)",
verb="LIST",
scope="namespace",
threshold=5,
),
api_call_latency(
title="Read-only API call latency (percentaile=99, scope=cluster, threshold=30s)",
verb="LIST",
scope="cluster",
threshold=30,
),
api_call_latency(
title="Mutating API call latency (threshold=1s)",
verb=d.any_of("CREATE", "DELETE", "PATCH", "POST", "PUT"),
scope=d.any_of("namespace", "cluster"),
threshold=1,
),
]

API_CALL_LATENCY_PANELS = api_call_latency_panel("""
apiserver:apiserver_request_latency_1m:histogram_quantile{
quantile="0.99",
verb=~"%(verb)s",
scope=~"%(scope)s",
resource=~"${resource:regex}s*",
}"""
% {"verb": verb, "scope": scope}
),
# TODO(github.com/grafana/grafana/issues/19410): uncomment once fixed
# legendFormat="{{verb}} {{scope}}/{{resource}}",
),
],
yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
)

}""")

CLUSTERLOADER_PANELS = [
api_call_latency(
title="Read-only API call latency (percentaile=99, scope=resource, threshold=1s)",
verb="GET",
scope="namespace",
threshold=1,
),
api_call_latency(
title="Read-only API call latency (percentaile=99, scope=namespace, threshold=5s)",
verb="LIST",
scope="namespace",
threshold=5,
),
api_call_latency(
title="Read-only API call latency (percentaile=99, scope=cluster, threshold=30s)",
verb="LIST",
scope="cluster",
threshold=30,
),
api_call_latency(
title="Mutating API call latency (threshold=1s)",
verb=d.any_of("CREATE", "DELETE", "PATCH", "POST", "PUT"),
scope=d.any_of("namespace", "cluster"),
threshold=1,
),
]
QUANTILE_API_CALL_LATENCY_PANELS = api_call_latency_panel("""
quantile_over_time(0.99,
apiserver:apiserver_request_latency_1m:histogram_quantile{
quantile="0.99",
verb=~"%(verb)s",
scope=~"%(scope)s",
resource=~"${resource:regex}s*",
}[5d])""")

HEALTH_PANELS = [
d.simple_graph(
Expand Down Expand Up @@ -485,7 +495,8 @@ def api_call_latency(title, verb, scope, threshold):
title="Master dashboard",
refresh="",
rows=[
d.Row(title="Clusterloader", panels=CLUSTERLOADER_PANELS),
d.Row(title="API call latency", panels=API_CALL_LATENCY_PANELS),
d.Row(title="API call latency aggregated with quantile", panels=QUANTILE_API_CALL_LATENCY_PANELS, collapse=True),
d.Row(title="Overall cluster health", panels=HEALTH_PANELS, collapse=True),
d.Row(title="etcd", panels=ETCD_PANELS, collapse=True),
d.Row(title="kube-apiserver", panels=APISERVER_PANELS, collapse=True),
Expand Down
Loading