monitoring(network): organize Traefik traffic lanes
This commit is contained in:
parent
5b91159831
commit
eeec8b72dc
@ -3786,28 +3786,34 @@ def build_network_dashboard():
|
|||||||
transformations=[{"id": "labelsToFields", "options": {}}],
|
transformations=[{"id": "labelsToFields", "options": {}}],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
traffic_thresholds = {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [{"color": "blue", "value": None}],
|
||||||
|
}
|
||||||
panels.append(
|
panels.append(
|
||||||
timeseries_panel(
|
bargauge_panel(
|
||||||
11,
|
11,
|
||||||
"Traefik Routers (req/s)",
|
"Traefik Routers (req/s)",
|
||||||
f"topk(10, {TRAEFIK_ROUTER_EXPR})",
|
f"topk(10, {TRAEFIK_ROUTER_EXPR})",
|
||||||
{"h": 9, "w": 12, "x": 0, "y": 25},
|
{"h": 9, "w": 12, "x": 0, "y": 25},
|
||||||
unit="req/s",
|
unit="req/s",
|
||||||
legend="{{router}}",
|
legend="{{router}}",
|
||||||
legend_display="table",
|
instant=True,
|
||||||
legend_placement="right",
|
thresholds=traffic_thresholds,
|
||||||
|
description="Current five-minute request rate, with one vertically aligned lane per router.",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
panels.append(
|
panels.append(
|
||||||
timeseries_panel(
|
bargauge_panel(
|
||||||
12,
|
12,
|
||||||
"Traefik Entrypoints (req/s)",
|
"Traefik Entrypoints (req/s)",
|
||||||
'sum by (entrypoint) (rate(traefik_entrypoint_requests_total[5m]))',
|
'sum by (entrypoint) (rate(traefik_entrypoint_requests_total[5m]))',
|
||||||
{"h": 9, "w": 12, "x": 12, "y": 25},
|
{"h": 9, "w": 12, "x": 12, "y": 25},
|
||||||
unit="req/s",
|
unit="req/s",
|
||||||
legend="{{entrypoint}}",
|
legend="{{entrypoint}}",
|
||||||
legend_display="table",
|
instant=True,
|
||||||
legend_placement="right",
|
thresholds=traffic_thresholds,
|
||||||
|
description="Current five-minute request rate, with one vertically aligned lane per entrypoint.",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -52,6 +52,23 @@ def test_node_filter_and_expr_helpers():
|
|||||||
assert "node_memory_MemAvailable_bytes" in mem_expr
|
assert "node_memory_MemAvailable_bytes" in mem_expr
|
||||||
|
|
||||||
|
|
||||||
|
def test_network_routes_render_as_vertical_lanes():
|
||||||
|
mod = load_module()
|
||||||
|
dashboard = mod.build_network_dashboard()
|
||||||
|
panels_by_title = {panel["title"]: panel for panel in dashboard["panels"]}
|
||||||
|
|
||||||
|
for title, label in (
|
||||||
|
("Traefik Routers (req/s)", "{{router}}"),
|
||||||
|
("Traefik Entrypoints (req/s)", "{{entrypoint}}"),
|
||||||
|
):
|
||||||
|
panel = panels_by_title[title]
|
||||||
|
assert panel["type"] == "bargauge"
|
||||||
|
assert panel["options"]["orientation"] == "horizontal"
|
||||||
|
assert panel["targets"][0]["instant"] is True
|
||||||
|
assert panel["targets"][0]["legendFormat"] == label
|
||||||
|
assert "one vertically aligned lane" in panel["description"]
|
||||||
|
|
||||||
|
|
||||||
def test_overview_availability_panel_uses_recorded_365d_rollup():
|
def test_overview_availability_panel_uses_recorded_365d_rollup():
|
||||||
mod = load_module()
|
mod = load_module()
|
||||||
dashboard = mod.build_overview()
|
dashboard = mod.build_overview()
|
||||||
|
|||||||
@ -579,7 +579,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 11,
|
"id": 11,
|
||||||
"type": "timeseries",
|
"type": "bargauge",
|
||||||
"title": "Traefik Routers (req/s)",
|
"title": "Traefik Routers (req/s)",
|
||||||
"datasource": {
|
"datasource": {
|
||||||
"type": "prometheus",
|
"type": "prometheus",
|
||||||
@ -593,30 +593,59 @@
|
|||||||
},
|
},
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "topk(10, sum by (router) (rate(traefik_router_requests_total[5m])))",
|
"expr": "sort_desc(topk(10, sum by (router) (rate(traefik_router_requests_total[5m]))))",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"legendFormat": "{{router}}"
|
"legendFormat": "{{router}}",
|
||||||
|
"instant": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fieldConfig": {
|
"fieldConfig": {
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"unit": "req/s"
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"unit": "req/s",
|
||||||
|
"min": 0,
|
||||||
|
"max": null,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "dark-blue",
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"overrides": []
|
"overrides": []
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"legend": {
|
"displayMode": "basic",
|
||||||
"displayMode": "table",
|
"orientation": "horizontal",
|
||||||
"placement": "right"
|
"reduceOptions": {
|
||||||
},
|
"calcs": [
|
||||||
"tooltip": {
|
"lastNotNull"
|
||||||
"mode": "multi"
|
],
|
||||||
|
"fields": "",
|
||||||
|
"values": false
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"description": "Current five-minute request rate, with one vertically aligned lane per router.",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "sortBy",
|
||||||
|
"options": {
|
||||||
|
"fields": [
|
||||||
|
"Value"
|
||||||
|
],
|
||||||
|
"order": "desc"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 12,
|
"id": 12,
|
||||||
"type": "timeseries",
|
"type": "bargauge",
|
||||||
"title": "Traefik Entrypoints (req/s)",
|
"title": "Traefik Entrypoints (req/s)",
|
||||||
"datasource": {
|
"datasource": {
|
||||||
"type": "prometheus",
|
"type": "prometheus",
|
||||||
@ -630,26 +659,55 @@
|
|||||||
},
|
},
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "sum by (entrypoint) (rate(traefik_entrypoint_requests_total[5m]))",
|
"expr": "sort_desc(sum by (entrypoint) (rate(traefik_entrypoint_requests_total[5m])))",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"legendFormat": "{{entrypoint}}"
|
"legendFormat": "{{entrypoint}}",
|
||||||
|
"instant": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fieldConfig": {
|
"fieldConfig": {
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"unit": "req/s"
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"unit": "req/s",
|
||||||
|
"min": 0,
|
||||||
|
"max": null,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "dark-blue",
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"overrides": []
|
"overrides": []
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"legend": {
|
"displayMode": "basic",
|
||||||
"displayMode": "table",
|
"orientation": "horizontal",
|
||||||
"placement": "right"
|
"reduceOptions": {
|
||||||
},
|
"calcs": [
|
||||||
"tooltip": {
|
"lastNotNull"
|
||||||
"mode": "multi"
|
],
|
||||||
|
"fields": "",
|
||||||
|
"values": false
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"description": "Current five-minute request rate, with one vertically aligned lane per entrypoint.",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "sortBy",
|
||||||
|
"options": {
|
||||||
|
"fields": [
|
||||||
|
"Value"
|
||||||
|
],
|
||||||
|
"order": "desc"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": {
|
"time": {
|
||||||
|
|||||||
@ -588,7 +588,7 @@ data:
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 11,
|
"id": 11,
|
||||||
"type": "timeseries",
|
"type": "bargauge",
|
||||||
"title": "Traefik Routers (req/s)",
|
"title": "Traefik Routers (req/s)",
|
||||||
"datasource": {
|
"datasource": {
|
||||||
"type": "prometheus",
|
"type": "prometheus",
|
||||||
@ -602,30 +602,59 @@ data:
|
|||||||
},
|
},
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "topk(10, sum by (router) (rate(traefik_router_requests_total[5m])))",
|
"expr": "sort_desc(topk(10, sum by (router) (rate(traefik_router_requests_total[5m]))))",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"legendFormat": "{{router}}"
|
"legendFormat": "{{router}}",
|
||||||
|
"instant": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fieldConfig": {
|
"fieldConfig": {
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"unit": "req/s"
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"unit": "req/s",
|
||||||
|
"min": 0,
|
||||||
|
"max": null,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "dark-blue",
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"overrides": []
|
"overrides": []
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"legend": {
|
"displayMode": "basic",
|
||||||
"displayMode": "table",
|
"orientation": "horizontal",
|
||||||
"placement": "right"
|
"reduceOptions": {
|
||||||
},
|
"calcs": [
|
||||||
"tooltip": {
|
"lastNotNull"
|
||||||
"mode": "multi"
|
],
|
||||||
|
"fields": "",
|
||||||
|
"values": false
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"description": "Current five-minute request rate, with one vertically aligned lane per router.",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "sortBy",
|
||||||
|
"options": {
|
||||||
|
"fields": [
|
||||||
|
"Value"
|
||||||
|
],
|
||||||
|
"order": "desc"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 12,
|
"id": 12,
|
||||||
"type": "timeseries",
|
"type": "bargauge",
|
||||||
"title": "Traefik Entrypoints (req/s)",
|
"title": "Traefik Entrypoints (req/s)",
|
||||||
"datasource": {
|
"datasource": {
|
||||||
"type": "prometheus",
|
"type": "prometheus",
|
||||||
@ -639,26 +668,55 @@ data:
|
|||||||
},
|
},
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "sum by (entrypoint) (rate(traefik_entrypoint_requests_total[5m]))",
|
"expr": "sort_desc(sum by (entrypoint) (rate(traefik_entrypoint_requests_total[5m])))",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"legendFormat": "{{entrypoint}}"
|
"legendFormat": "{{entrypoint}}",
|
||||||
|
"instant": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fieldConfig": {
|
"fieldConfig": {
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"unit": "req/s"
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"unit": "req/s",
|
||||||
|
"min": 0,
|
||||||
|
"max": null,
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "dark-blue",
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"overrides": []
|
"overrides": []
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"legend": {
|
"displayMode": "basic",
|
||||||
"displayMode": "table",
|
"orientation": "horizontal",
|
||||||
"placement": "right"
|
"reduceOptions": {
|
||||||
},
|
"calcs": [
|
||||||
"tooltip": {
|
"lastNotNull"
|
||||||
"mode": "multi"
|
],
|
||||||
|
"fields": "",
|
||||||
|
"values": false
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"description": "Current five-minute request rate, with one vertically aligned lane per entrypoint.",
|
||||||
|
"transformations": [
|
||||||
|
{
|
||||||
|
"id": "sortBy",
|
||||||
|
"options": {
|
||||||
|
"fields": [
|
||||||
|
"Value"
|
||||||
|
],
|
||||||
|
"order": "desc"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": {
|
"time": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user