feat(traefik): request chart shows the total, a time axis and a weighted 5xx share; says why if it can't draw (#5256)
#5256 "Traefik — Request chart: blank on the live dashboard; time axis and honest labels". - "Req/s" was the average of the routers, not the total. Each scrape is now summed over routers, then averaged per bucket (request_history). - The 5xx share is now weighted by each router's traffic. The axis is no longer pinned at 0–100 (suggestedMax 5). - The x axis shows times, in the viewer's local time. The tooltip shows both series at that time. - A verdict line comes first: now / peak req/s and the peak 5xx share. The figures read even if the chart doesn't. - The blank live chart's cause is still unknown. Chart.js and chart-colors.js both load on the dashboard. A missing library or a thrown error is now written into the widget instead of leaving it empty, so the cause will show on the page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -230,3 +230,19 @@ async def test_the_page_sets_certificates_traefik_no_longer_serves_apart(app):
|
||||
page = " ".join(page.split())
|
||||
assert "also www.app.example" in page and ">app</td>" in page and ">not in use</td>" in page
|
||||
assert page.index("spare.example") < page.index("No longer served (1)") < page.index("gone.example")
|
||||
|
||||
|
||||
async def test_the_request_chart_says_its_figures_before_the_chart(app):
|
||||
async with app.test_request_context("/plugins/traefik/widget/request_chart"):
|
||||
page = await render_plugin_template(
|
||||
app, "traefik", "traefik/widget_request_chart.html", labels_json="[1, 2]",
|
||||
req_rate_json="[1.5, 4.25]", error_rate_json="[0, 0.5]", widget_id="7", hours=6,
|
||||
now_req=4.25, peak_req=4.25, peak_err=0.5)
|
||||
empty = await render_plugin_template(
|
||||
app, "traefik", "traefik/widget_request_chart.html", labels_json="[]", hours=6)
|
||||
page = " ".join(page.split())
|
||||
assert "Now 4.25 req/s across all routers, peak 4.25. 5xx peaked at 0.50% of responses." in page
|
||||
assert page.index("w-verdict") < page.index("<canvas")
|
||||
assert "Requests/s (all routers)" in page and "max: 100" not in page
|
||||
assert "couldn't be drawn" in page # a failure says why in place of the chart
|
||||
assert "No Traefik requests recorded in the last 6h." in empty
|
||||
|
||||
Reference in New Issue
Block a user