Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
d.one_line(
"""
histogram_quantile(
0.50,
sum(
rate(
etcd_request_duration_seconds_bucket{
operation=~"${etcd_operation:regex}",
type=~".*(${etcd_type:pipe})"
}[1m]
)
) by (le, operation, type, instance)
)
"""
),
yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
),
d.simple_graph("etcd instance id", "sum(etcd_server_id) by (instance, server_id)"),
d.simple_graph(
"etcd network latency (99th percentile)",
"histogram_quantile(0.99, sum(rate(etcd_network_peer_round_trip_time_seconds_bucket[1m])) by (le, instance, To))",
yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
),
d.simple_graph(
"etcd compaction keys",
"delta(etcd_debugging_mvcc_db_compaction_keys_total[1m])",
),
d.simple_graph(
"etcd compaction pause sum duration",
"delta(etcd_debugging_mvcc_db_compaction_pause_duration_milliseconds_sum[1m])",
yAxes=g.single_y_axis(format=g.MILLISECONDS_FORMAT),
),
def api_call_latency(title, metric, verb, scope, threshold):
return d.Graph(
title=title,
targets=[
g.Target(expr=str(threshold), legendFormat="threshold"),
g.Target(
expr='quantile_over_time(0.99, %(metric)s{quantile="0.99", verb=~"%(verb)s", scope=~"%(scope)s"}[12h])'
% {"metric": metric, "verb": verb, "scope": scope}
),
],
yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
)
description=(
"NetworkProgrammingLatency is defined as the time it took to "
+ "program the network - from the time the service or pod has "
+ "changed to the time the change was propagated and the proper "
+ "kube-proxy rules were synced. Exported for each endpoints object "
+ "that were part of the rules sync."
),
targets=d.show_quantiles(
(
"quantile_over_time("
+ "0.99, "
+ 'kubeproxy:kubeproxy_network_programming_duration:histogram_quantile{{quantile="{quantile}"}}[24h])'
),
legend="{{quantile}}",
),
yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
),
d.Graph(
title="Network programming latency",
description=(
"NetworkProgrammingLatency is defined as the time it took to "
+ "program the network - from the time the service or pod has "
+ "changed to the time the change was propagated and the proper "
+ "kube-proxy rules were synced. Exported for each endpoints object "
+ "that were part of the rules sync."
),
targets=d.show_quantiles(
'kubeproxy:kubeproxy_network_programming_duration:histogram_quantile{{quantile="{quantile}"}}',
legend="{{quantile}}",
),
yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
),
+ "kube-proxy rules were synced. Exported for each endpoints object "
+ "that were part of the rules sync."
),
targets=d.show_quantiles(
'kubeproxy:kubeproxy_network_programming_duration:histogram_quantile{{quantile="{quantile}"}}',
legend="{{quantile}}",
),
yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
),
d.Graph(
title="kube-proxy: sync rules duation",
description="Latency of one round of kube-proxy syncing proxy rules.",
targets=d.show_quantiles(
"histogram_quantile({quantile}, sum(rate(kubeproxy_sync_proxy_rules_duration_seconds_bucket[5m])) by (le))"
),
yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
),
d.simple_graph(
"kube-proxy: rate of service changes",
"sum(rate(kubeproxy_sync_proxy_rules_service_changes_total[5m]))",
description="Rate of service changes that the proxy has seen over 5m",
legend="rate",
),
d.simple_graph(
"kube-proxy: pending service changes",
"sum(kubeproxy_sync_proxy_rules_service_changes_pending)",
description="Number of pending service changes that have not yet been synced to the proxy.",
legend="pending changes",
),
d.simple_graph(
"kube-proxy: rate of endpoint changes",
"sum(rate(kubeproxy_sync_proxy_rules_endpoint_changes_total[5m]))",
from grafanalib import core as g
import defaults as d
PROBER_PANEL = [
d.Graph(
title="In-cluster DNS latency SLI",
targets=d.show_quantiles(
(
"quantile_over_time("
+ "0.99, "
+ 'probes:dns_lookup_latency:histogram_quantile{{quantile="{quantile}"}}[24h])'
),
legend="{{quantile}}",
),
yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
nullPointMode="null",
),
d.Graph(
title="DNS latency",
targets=d.show_quantiles(
'probes:dns_lookup_latency:histogram_quantile{{quantile="{quantile}"}}',
legend="{{quantile}}",
),
yAxes=g.single_y_axis(format=g.SECONDS_FORMAT),
nullPointMode="null",
),
d.Graph(
title="probe: lookup rate",
targets=[
g.Target(
expr='sum(rate(probes_in_cluster_dns_lookup_count{namespace="probes", job="dns"}[1m]))',