Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
title=title,
repeat=POD_TYPE_VARIABLE.lstrip("$") if pod_type else "",
panels=[
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="CPU",
expressions=[
dict(expr=reduction('sum', metric(m, selection), selection),
legendFormat=title)
for m, title in [('cpus_limit', 'Available')]
],
span=3,
steppedLine=True,
yAxes=G.YAxes(left=G.YAxis(format="short", decimals=0)),
),
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="Memory",
expressions=[
dict(expr=reduction('sum', metric(m, selection), selection),
legendFormat=title)
for m, title in [('mem_total', 'Used'),
('mem_limit', 'Available')]
],
span=3,
steppedLine=True,
yAxes=G.YAxes(left=G.YAxis(format=G.BYTES_FORMAT, decimals=0)),
),
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="Disk [PLACEHOLDER]",
expressions=[
return G.Row(
title="Scheduler statistics",
panels=[
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="cumulative offer statistic",
expressions=[
{"expr": sum(service_metric(m)), "legendFormat": m}
for m in offer_metrics
],
span=3,
steppedLine=True,
yAxes=G.YAxes(left=G.YAxis(format="short", decimals=0)),
),
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="offer events per second [{} rate]".format(resolution),
expressions=[
{
"expr": sum(service_metric(m, "rate", resolution)),
"legendFormat": m,
}
for m in offer_metrics
],
span=3,
steppedLine=True,
),
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="offer processing time",
expressions=[
yAxes=G.YAxes(left=G.YAxis(format="short", decimals=0)),
),
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="offer events per second [{} rate]".format(resolution),
expressions=[
{
"expr": sum(service_metric(m, "rate", resolution)),
"legendFormat": m,
}
for m in offer_metrics
],
span=3,
steppedLine=True,
),
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="offer processing time",
expressions=[
{"expr": sum(service_metric(m)), "legendFormat": m}
for m in offer_timers
],
span=3,
yAxes=G.YAxes(left=G.YAxis(format="ns")),
),
"""
Construct a Grafana row containing scheduler task statistics
"""
task_metrics = [
"task_status_task_running",
"task_status_task_finished",
"task_status_task_lost",
"task_status_task_failed",
]
resolution = "1m"
return G.Row(
title="Task statistics",
panels=[
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="cumulative task statistic",
expressions=[
{"expr": sum(service_metric(m)), "legendFormat": m}
for m in task_metrics
],
span=3,
steppedLine=True,
yAxes=G.YAxes(left=G.YAxis(format="short", decimals=0)),
),
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="task events per second [{} rate]".format(resolution),
expressions=[
{
"expr": sum(service_metric(m, "rate", resolution)),
"declines_short",
]
resolution = "1m"
offer_timers = [
"offers_process_p50",
"offers_process_p90",
"offers_process_p99",
"offers_process_max",
]
return G.Row(
title="Scheduler statistics",
panels=[
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="cumulative offer statistic",
expressions=[
{"expr": sum(service_metric(m)), "legendFormat": m}
for m in offer_metrics
],
span=3,
steppedLine=True,
yAxes=G.YAxes(left=G.YAxis(format="short", decimals=0)),
),
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="offer events per second [{} rate]".format(resolution),
expressions=[
{
"expr": sum(service_metric(m, "rate", resolution)),
return G.Row(
title="Task statistics",
panels=[
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="cumulative task statistic",
expressions=[
{"expr": sum(service_metric(m)), "legendFormat": m}
for m in task_metrics
],
span=3,
steppedLine=True,
yAxes=G.YAxes(left=G.YAxis(format="short", decimals=0)),
),
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="task events per second [{} rate]".format(resolution),
expressions=[
{
"expr": sum(service_metric(m, "rate", resolution)),
"legendFormat": m,
}
for m in task_metrics
],
span=3,
steppedLine=True,
),
yAxes=G.YAxes(left=G.YAxis(format="short", decimals=0)),
),
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="Memory",
expressions=[
dict(expr=reduction('sum', metric(m, selection), selection),
legendFormat=title)
for m, title in [('mem_total', 'Used'),
('mem_limit', 'Available')]
],
span=3,
steppedLine=True,
yAxes=G.YAxes(left=G.YAxis(format=G.BYTES_FORMAT, decimals=0)),
),
W.prometheus.PromGraph(
data_source=PROMETHEUS_DATA_SOURCE,
title="Disk [PLACEHOLDER]",
expressions=[
dict(expr=reduction('sum', metric(m, selection), selection),
legendFormat=title)
for m, title in [('disk_used', 'Used'),
('disk_limit', 'Available')]
],
span=3,
steppedLine=True,
yAxes=G.YAxes(left=G.YAxis(format=G.BYTES_FORMAT, decimals=0)),
),