fix(traefik): show Traefik's own figures before any router reports (#5710)
CI / lint (push) Successful in 2s
CI / unit (push) Successful in 1m32s
CI / integration (push) Successful in 1m33s
CI / publish (push) Successful in 26s

Moving the figures below the problem cards put them inside the routers
block, so with no routers yet the config-reload, connection and memory tiles
vanished (CI 9100, test_the_config_tile_says_when_it_last_reloaded). They are
a macro now, drawn in both branches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 10:53:18 -04:00
co-authored by Claude Opus 5.5
parent 0bac1d2068
commit 627193b00a
+17 -12
View File
@@ -19,6 +19,21 @@
{%- if gone %} <span class="tone-muted">{{ gone|length }} no longer reported.</span>{% endif %} {%- if gone %} <span class="tone-muted">{{ gone|length }} no longer reported.</span>{% endif %}
</p> </p>
{# ── The proxy's own figures: shown even before any router reports ───────── #}
{% macro proxy_figures() %}
{% if global_stat and (global_stat.config_last_reload_at or global_stat.open_conns_total is not none
or global_stat.process_memory_bytes is not none) %}
<div class="stat-strip">
{% if global_stat.config_last_reload_at %}
{{ stat_tile("Config reloaded", global_stat.config_last_reload_at|ago,
hint=(global_stat.config_reloads_total|int ~ " reloads") if global_stat.config_reloads_total is not none else none) }}
{% endif %}
{% if global_stat.open_conns_total is not none %}{{ stat_tile("Open connections", global_stat.open_conns_total|int) }}{% endif %}
{% if global_stat.process_memory_bytes is not none %}{{ stat_tile("Memory", global_stat.process_memory_bytes|bytes) }}{% endif %}
</div>
{% endif %}
{% endmacro %}
{% macro router_card(r) %} {% macro router_card(r) %}
<div class="card"> <div class="card">
<div class="host-health-head"> <div class="host-health-head">
@@ -49,18 +64,7 @@
</div> </div>
{% endif %} {% endif %}
{# ── The proxy's own figures ─────────────────────────────────────────────── #} {{ proxy_figures() }}
{% if global_stat and (global_stat.config_last_reload_at or global_stat.open_conns_total is not none
or global_stat.process_memory_bytes is not none) %}
<div class="stat-strip">
{% if global_stat.config_last_reload_at %}
{{ stat_tile("Config reloaded", global_stat.config_last_reload_at|ago,
hint=(global_stat.config_reloads_total|int ~ " reloads") if global_stat.config_reloads_total is not none else none) }}
{% endif %}
{% if global_stat.open_conns_total is not none %}{{ stat_tile("Open connections", global_stat.open_conns_total|int) }}{% endif %}
{% if global_stat.process_memory_bytes is not none %}{{ stat_tile("Memory", global_stat.process_memory_bytes|bytes) }}{% endif %}
</div>
{% endif %}
{# ── Healthy routers, folded ─────────────────────────────────────────────── #} {# ── Healthy routers, folded ─────────────────────────────────────────────── #}
{% if healthy %} {% if healthy %}
@@ -152,6 +156,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
{{ proxy_figures() }}
<div class="card"> <div class="card">
<p class="field-hint">No Traefik metrics yet. Configure <code>metrics_url</code> in <code>config.yaml</code> under <code>plugins.traefik</code>.</p> <p class="field-hint">No Traefik metrics yet. Configure <code>metrics_url</code> in <code>config.yaml</code> under <code>plugins.traefik</code>.</p>
</div> </div>